Skip to content

Add support for FilterMaintenanceAccessory #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 11, 2020
Merged

Add support for FilterMaintenanceAccessory #124

merged 8 commits into from
Dec 11, 2020

Conversation

gjvanderheiden
Copy link
Contributor

#124

Pull Request Checklist

Please confirm that you've done the following when opening a new pull request:

  • For fixes and other improvements, please reference the GitHub issue that your change addresses.
  • For fixes, optimizations and new features, please add an entry to the CHANGES.md file.
  • Run mvn compile before committing, so that the auto-code formatter will format your changes consistently with the rest of the project.

@gjvanderheiden
Copy link
Contributor Author

linked issue : #123

Had to change the IntegerCharacteristic too. It didn't support unit nor no value. (needed for ResetFilter). Tested it with my own project, which uses this characteristic excessively.

Really missing exciting unit tests here. Unit test could test how the IntegerCharacteristic is responding to this in the json build.

Copy link
Contributor

@yfre yfre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for filter maintenance we need additional characteristics but i could not find them in PR.
e.g.
ResetFilterIndicationCharacteristic
FilterLifeLevelCharacteristic
FilterChangeIndicationCharacteristic

@yfre
Copy link
Contributor

yfre commented Dec 10, 2020

with the new linked service support we dont need to have any dedicated methods on accessory levels but can basically add any service to any accessory, e.g. we can add Fan to Air Purifier
it looks like this (im adding battery service to switch but it works the same for all other accessories and services)

final MockSwitch switch1 = new MockSwitch();
final MockBatteryService batteryService = new MockBatteryService();
switch1.getServices().add(batteryService.getPrimaryService());

means the only thing we need to implement is the FilterMaintanceService

@gjvanderheiden
Copy link
Contributor Author

for filter maintenance we need additional characteristics but i could not find them in PR.
e.g.
ResetFilterIndicationCharacteristic
FilterLifeLevelCharacteristic
FilterChangeIndicationCharacteristic

buggar. beep**-ed something up with the change lists in my IDE. Thanks for mentioning

@gjvanderheiden
Copy link
Contributor Author

gjvanderheiden commented Dec 10, 2020

with the new linked service support we dont need to have any dedicated methods on accessory levels but can basically add any service to any accessory, e.g. we can add Fan to Air Purifier
it looks like this (im adding battery service to switch but it works the same for all other accessories and services)

final MockSwitch switch1 = new MockSwitch();
final MockBatteryService batteryService = new MockBatteryService();
switch1.getServices().add(batteryService.getPrimaryService());

means the only thing we need to implement is the FilterMaintanceService

I like the dynamic possibilities.
I could be missing something, but getServices() returns a new instance of the service with every call. I can't see this working with HomekitBridge.addAccessory().

edit:

also see
HomeKitRegistry.reset():
....
for (Service service : accessory.getServices()) {
newServices.add(service);
newServices.addAll(service.getLinkedServices());
}
...

@gjvanderheiden
Copy link
Contributor Author

Another alternative would be:

HomekitAccessory accessory = new MockSwitch(...);
accessory.addLinkedAccessory(new MockBatteryAccessory());

@gjvanderheiden
Copy link
Contributor Author

@yfre thrown the 2 modification out of the window. How to link the services is another issue. Thank you for the review

@gjvanderheiden
Copy link
Contributor Author

added comment to #104(#104). Can't add the accessory right now.

Copy link
Contributor

@yfre yfre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good for me.

@ccutrer ccutrer merged commit ee9cf3e into hap-java:master Dec 11, 2020
@gjvanderheiden gjvanderheiden deleted the FilterMaintenanceAccessory branch December 11, 2020 17:05
J-N-K pushed a commit to J-N-K/HAP-Java that referenced this pull request Dec 28, 2020
* fix HAP subscription process

* increase java version for travis

* update fmt-maven-plugin to latest version

* another fix for travis build. switch to openjdk

* switch to openjdk8

* fix thermostat for io13. make temprature unit changeable

* switch to openjdk

* add subscribe/unsubscribe

* fix the names of the garage door characteristics

* switch to openjdk

* hap-java#93 Fix discoverability & pairing with ios13 (hap-java#95)

Switch discoverable to false once client is authenticated

* Fixed package (hap-java#98)

* add carbon dioxide sensor (hap-java#82)

* increase java version
* switch to openjdk8

* major refactoring to support optional attributes

* add name, active and fault interfaces

* make service characteristics complete

* update CHANGES.md and README.md

* Apply J-N-K patches for Openhab. update dependencies to be aligned with OH

* fix some typos in the characteristics descriptions

* fix for javadoc bug

* fix potential NPE. adapt log level

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* fix typo and add some logging

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* Add Doorbell, Microphone, Slat, Speaker, StatelessProgrammableSwitch accessories

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* update readme

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add air purifier and air quality

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* reduce log leve. align more with OH guidance on logging

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add service label service and hap protocol version service. fix Mute characteristic

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* fix the Id for TargetHorizontalTiltAngleCharacteristic

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add Faucet and HeaterCooler

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add humidifier dehumidifier accessory

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add irrigation system, clean up javadocs

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* remove reference to spec

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add support for custom min/max values for temperatures

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* fix typos. add support for custom min/max values for threshold  temperatures

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add constants for default min/max values

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* put debugData back

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* fix the typo in CarbonDioxideSensorService

* add support for valid-values (for enum characteristics)

* CHANGES update

* [hap-java#119] added support for valid values for target HumidifierDehumidifierState

* [hap-java#119] added support for valid values for target HumidifierDehumidifierState

* [hap-java#119] added support for valid values for target HumidifierDehumidifierState

* [hap-java#119] added support for valid values for target HumidifierDehumidifierState

* add support for qr code

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add default implementation for setup Id

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* add support for linked services

Some services require linked services to work, for example, the Television service which requires each input to be a linked service.
With this change, support to link services is added, though it's not used in any existing service, as they don't need linking.

This change also centralizes the generation of interface ids. They are now only generated in the registry.
We were previously also generating them in the accessory controller, relying on an identical processing sequence.

* port of hap-java#68 PR on jmDNS to latest code base

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* incorporate review feedback

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* Add support for FilterMaintenanceAccessory
[hap-java#124](hap-java#124)

* Add support for FilterMaintenanceAccessory
[hap-java#124](hap-java#124)

* [hap-java#124](hap-java#124

* Add support for FilterMaintenanceAccessory
[hap-java#124](hap-java#124)

* Add support for FilterMaintenanceAccessory
[hap-java#124](hap-java#124)

* Add support for FilterMaintenanceAccessory
[hap-java#124](hap-java#124)

typo in JavaDoc

* Add support for FilterMaintenanceAccessory
[hap-java#124](hap-java#124)

JavaDoc error fixed

* Add support for FilterMaintenanceAccessory
[hap-java#124](hap-java#124)

JavaDoc error fixed

* add linked service API

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* expose addLinkedService at Service interface

Signed-off-by: Eugen Freiter <freiter@gmx.de>

* prepare release

Signed-off-by: Eugen Freiter <freiter@gmx.de>

Co-authored-by: Cody Cutrer <cody@cutrer.us>
Co-authored-by: Eugen Freiter <efreiter@deloitte.de>
Co-authored-by: sobeos <sobeos@gmail.com>
Co-authored-by: Eugen Freiter <freiter@gmx.de>
Co-authored-by: Martin Hanes <martin.hanes@gmail.com>
Co-authored-by: Jiří Václavovič <jvaclavovic@gmail.com>
Co-authored-by: Gert-Jan van der Heiden <gjvdspam@gmail.com>
Co-authored-by: Dennis Frommknecht <dfrommi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants