Skip to content
Prev Previous commit
Next Next commit
Add support for FilterMaintenanceAccessory
  • Loading branch information
gjvanderheiden committed Dec 10, 2020
commit 3c462a52c1e84ce4e2233944c5ad17cb6c417e9f
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,8 @@ public interface AirPurifierAccessory extends HomekitAccessory {
/** Unsubscribes from changes in the target state of the air purifier. */
void unsubscribeTargetState();

/**
* If a filter maintenance service is needed as a linked service to this AirPurifier, this is the
* place.
*
* @return an instance of FilterMaintenanceAccessory, null if not needed.
*/
default FilterMaintenanceAccessory getFilterMaintenanceAccessory() {
return null;
};

@Override
default Collection<Service> getServices() {
AirPurifierService service = new AirPurifierService(this);
FilterMaintenanceAccessory fmAccessory = this.getFilterMaintenanceAccessory();
if (fmAccessory != null) {
service.addLinkedService(fmAccessory.getPrimaryService());
}
return Collections.singleton(service);
return Collections.singleton(new AirPurifierService(this));
}
}