deconz: fix light.turn_off with transition#15222
Conversation
When light.turn_off is invoked with a transition, the following payload was
sent to deCONZ via PUT to /light/N/state:
{ "bri": 0, "transitiontime": transition }
However, on recent versions of deCONZ (latest is 2.05.31 at the time of
writing) this does not turn off the light, just sets it to minimum brightness
level (brightness is clamped to minimum level the light supports without
turning it off).
This commit makes the code send this payload instead:
{ "on": false, "transitiontime": transition }
This works as intended and the light does transition to the 'off' state.
This change was tested with Philips Hue colored lights, IKEA colored lights
and IKEA white spectrum lights: they were all able to be turned off
successfully with the new payload, and none of them could be turned off with
the old payload.
|
Hi @lbschenkel, It seems you haven't yet signed a CLA. Please do so here. Once you do that we will be able to review and accept this pull request. Thanks! |
|
What a coincidence, this was just requested over at the deconz GitHub. Looks good, can be merged as soon as tests pass |
|
I just realized I typed |
|
Amended. |
|
Thanks for your contribution 🎉 |
|
I've just tested this fix by coping light/deconz.py to custom_components/light/deconz.py and remove line 177 , but now the light turns of immediately instead of after 30 seconds. "entity_id": "light.lamp_naast_de_kast","transition":30 |
|
If you enable debug logging for |
|
I'll try that out. it's a hue light which was previously connected via a hue bridge and supporting transition. So i'm pretty sure the light supports it :) Transition whith turn_on works as it should also. |
|
i've tried |
|
No, just |
|
|
|
OK. I also have a color Hue that I tested yesterday and just re-rested right now as I write this and the off+transition definitely works. What version of deCONZ do you have running? I'm running the latest one (2.05.31 from https://github.com/dresden-elektronik/deconz-rest-plugin/) and firmware |
|
I'm also runnning 2.05.31 with the same firmware |
|
the deconz web frontend does not show a firmware version but i'm sure I flashed it. |
|
And you're asking to turn off the light with a transition of 10s and it turns off immediately? That's odd. I cannot really explain this, different lamp firmware perhaps? Do you have other lamps you could test, just to see what happens? |
|
` flashing 126188 bytes: |==============================| webui: Version 2.05.31 / 22-6-2018 |
|
i've tested with 3 hue color bulbs, 1 hue white and 1 innr bulb. All go off instant. |
|
Can you really override a platform by just adding a custom component with the same name? |
|
Oh, I missed that it was an override. I thought you edited the original |
|
A component at least yes. Done this before but let me edit the original to be sure.
… Op 30 jun. 2018 om 10:15 heeft Robert Svensson ***@***.***> het volgende geschreven:
Can you really override a platform by just adding a custom component with the same name?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Thing is. Before it dimmed the light and did not turn them off. So behavior is certainly different |
|
Im asking so we don't diagnose an issue that is something else |
|
But anyhow, the REST payload sent to deCONZ looks correct. Whatever is happening here and if there is a bug, I believe it is on the deCONZ side — at least in theory. This payload is the correct payload to request the light to be turned off with a transition. I cannot explain why this is not being honoured by deCONZ (or maybe the lights) in your case. I tried just now with 4 different models of bulbs from 2 different brands and they all worked, so it's odd. |
|
just te be sure; it's just deleting this one line in light/deconz.py right? |
|
i'm a bit unsure because the deconz web ui does not show my firmware version, so there might be something wrong there? |
|
Actually I think I might have found the issue. I played with the REST interface a bit. You're not seeing the light go immediately off, but with a transition of ~1s, correct? |
|
yes, that is right. But that is quite normal with hue light anyway so I did not notice it being different then going off instantly |
|
It is just a cosmetic issue with Phoscon not showing the fw ID. There is an issue reported with DE to solve. |
|
Ok, just tested with the change to the original light/deconz.py file, same issue :) |
|
OK, so I think this is on me. My PR ended up being incomplete. I was doing experimentation to figure out why the lights were not turning off and what was the exact payload to fix that. The payload that actually solves it is this one: Without What muddied the waters completely is that my "production" HASS, due to my experimentation, ended up having this version with the |
|
awesome work man! thanks for the effort! |
|
@lbschenkel so you should change to not rewrite the dict when using transition as was previously the case |
|
Yes: #15227 |
When light.turn_off is invoked with a transition, the following payload was
sent to deCONZ via PUT to /light/N/state:
{ "bri": 0, "transitiontime": transition }
However, on recent versions of deCONZ (latest is 2.05.31 at the time of
writing) this does not turn off the light, just sets it to minimum brightness
level (brightness is clamped to minimum level the light supports without
turning it off).
This commit makes the code send this payload instead:
{ "on": false, "transitiontime": transition }
This works as intended and the light does transition to the 'off' state.
This change was tested with Philips Hue colored lights, IKEA colored lights
and IKEA white spectrum lights: they were all able to be turned off
successfully with the new payload, and none of them could be turned off with
the old payload.
When light.turn_off is invoked with a transition, the following payload was
sent to deCONZ via PUT to /light/N/state:
{ "bri": 0, "transitiontime": transition }
However, on recent versions of deCONZ (latest is 2.05.31 at the time of
writing) this does not turn off the light, just sets it to minimum brightness
level (brightness is clamped to minimum level the light supports without
turning it off).
This commit makes the code send this payload instead:
{ "on": false, "transitiontime": transition }
This works as intended and the light does transition to the 'off' state.
This change was tested with Philips Hue colored lights, IKEA colored lights
and IKEA white spectrum lights: they were all able to be turned off
successfully with the new payload, and none of them could be turned off with
the old payload.
This is my first PR against this project, so apologies if there's something I'm missing. I'm submitting this so the review can happen while I set up my local environment to be able to run
tox.Description:
When
light.turn_offis invoked with a transition, the following payload wassent to deCONZ via
PUTto/light/N/state:However, on recent versions of deCONZ (latest is 2.05.31 at the time of
writing) this does not turn off the light, just sets it to minimum brightness
level (brightness is clamped to minimum level the light supports without
turning it off).
This commit makes the code send this payload instead:
This works as intended and the light does transition to the 'off' state.
This change was tested with Philips Hue colored lights, IKEA colored lights
and IKEA white spectrum lights: they were all able to be turned off
successfully with the new payload, and none of them could be turned off with
the old payload.
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
REQUIREMENTSvariable (example).requirements_all.txtby runningscript/gen_requirements_all.py..coveragerc.If the code does not interact with devices: