steilerDev / homebridge-openhab2-complete

A homebridge plugin for openHAB, that has the expectation to fully support all Services offered by Apple's Homekit Accessory Protocol (HAP)
GNU General Public License v3.0
52 stars 16 forks source link

Allow to define fan speed intervals #22

Closed maisun closed 5 years ago

maisun commented 5 years ago

Hi, I'd also like to request a new feature to add an additional configuration for fan speeds which can be mapped to other values other than 0% - 100%. The situation is my fan has only 5 steps, 0 is off and 1-4 for low to high speeds. I'd like to configure the fan accessary to allow only 5 steps - 0%, 25%, 50%, 75% and 100%. Basically this can be done by the following code: that.fanService.getCharacteristic(Characteristic.RotationSpeed).setProps({ minStep: 25 }) And then of course mapping logic from 0-4 to 0%-100% and the other way around. Thank you in advance for considering.

steilerDev commented 5 years ago
that.fanService.getCharacteristic(Characteristic.RotationSpeed).setProps({
minStep: 25
})

That is very interesting I did not know that, thanks!

Coming back to your request: I will not implement this kind of feature, since it is a product specific request and my target is a full and accurate HomeKit protocol accordance. Some users will need discrete steps, some need percentages, if I follow the spec I should use Apple's common sense on what the majority needs.

The fan accessory type's characteristic RotationSpeed is defined in 8.29 (HAP Specification, Version 2017-06-07) as a percentage value. If you want to reflect a specific behavior for your accessory I would like to ask you to implement a rule and proxy item in OpenHAB. I can help you with that if you have never done that.

maisun commented 5 years ago

Hi, Thank you for your reply! This won't change the value in percentage terms, but rather to restrict users to only choose 0%, 25%, 50% 75% and 100%. It's kind of input validation and I think it's better to be done in user interface (HomeKit).