Skip to content
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

dimmer setting on and value 0 #252

Open
akamming opened this issue Dec 19, 2022 · 6 comments
Open

dimmer setting on and value 0 #252

akamming opened this issue Dec 19, 2022 · 6 comments

Comments

@akamming
Copy link

Hi,

1st of all: tx for this great peace of software. I am a very happy user...

I just found one issue, which was present in domoticz as well, but is now fixed in domoticz. But still present in thi homebridge plugin:

A dimmer should be able to be have a state "on", but with brightness value "0". In domoticz this works, but in this plugin, when the brightness is set to 0, it ignores this value and leaves it on the latest brightness setting.

e.g. dimmer is on, with brightness value 27.

  • In domoticz: brightness changes to 10 --> in homekit: The brightness goes to 10 (correct!)
  • In domoticz: brightness changes to 0 (while leaving the light on) --> in homekit: light remains on, but also brightness remains 10 (incorrect!)

Can this be fixed?

@PatchworkBoy
Copy link
Owner

I don't have ANY dimmers in Domoticz that I can set brightness to 0% without them tallying automatically over to "Off"... unless this is a behaviour change in the latest version of Domoticz (which I'm yet to update to).

@PatchworkBoy
Copy link
Owner

Righty... yes, domoticz allows in latest version.

Not a simple fix and will require a rework of all the dimming features in homebridge-edomoticz... which has a knock on effect on anything else that can set a percentage level. This will only be fixed if someone else undertakes the work.

@akamming
Copy link
Author

This will only be fixed if someone else undertakes the work.

can you point me a bit in the right direction? i'm not a very experienced programmer, bit I can take a look....

@PatchworkBoy
Copy link
Owner

Modifications required around...

@akamming
Copy link
Author

i will take a look,. might take some time with my programming skills ;)

@akamming
Copy link
Author

akamming commented Dec 27, 2022

hmm... gonna need some more help, cause i don't understand the program logic.

I started with these corrections (make sure brightness is still set to 0 when value = 0 in the cachedVariables):

290c290
<             // if (value > 0) {
---
>             if (value > 0) {
292c292
<             // }
---
>             }
1114c1114
<                             // if (level > 0) {
---
>                             if (level > 0) {
1119c1119
<                             // }
---
> 

but now dimmer goes to 100% in homekit when set to zero. So probably cached vars are presented to homekit somewhere in the code and there there's some conversion as well (i assume, but i want to check). Where can i find that code?

EDIT: Did some more investigation: i think the issue is in homekit. Cause in homebridge an dimmer with value on and brightness 0 is presented as just "on" (no brightness shown in the ui). In homekit it is changed to "100%".

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

No branches or pull requests

2 participants