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

Brightness, color and transition with ikea light #1810

Closed
irgusite opened this issue Aug 3, 2019 · 39 comments
Closed

Brightness, color and transition with ikea light #1810

irgusite opened this issue Aug 3, 2019 · 39 comments

Comments

@irgusite
Copy link

irgusite commented Aug 3, 2019

Bug Report

What happened

Related to : #341

I'm using circadian lighting and zigbee2mqtt with ikea lights.
When circadian is updating the light brightness and color, the bulb doesn't apply the new brightness.
What I saw, is that when updating the brightness and color, along with a transition time, only the color updates but not the brightness, and the z2m plugin reports the new brightness (but not applied)

After more observation, as long as the color transition is not over, the brightness is reset to it's precedent state but not communicated to the bulb.

What did you expect to happen

To have the brightness and color changed with a transition time

How to reproduce it (minimal and precise)

  • Have an ikea bulb or pannel (tested on both)
  • Turn off circadian and such.
  • Change the brightness and color of the bulb with a transition time
  • see only the color change

Debug Info

zigbee2mqtt version: 59a5c6b
CC253X firmware version: from july 2019

@Koenkk
Copy link
Owner

Koenkk commented Aug 3, 2019

Can you provide the debug log when the MQTT commands are send?

To enable debug logging set in configuration.yaml:

advanced:
  log_level: debug

@irgusite
Copy link
Author

irgusite commented Aug 5, 2019 via email

@irgusite
Copy link
Author

irgusite commented Aug 6, 2019

Hey! I found time to do the debug. Find here the 3 log extracts with color+brightness+transition, color+transition and brightness+transition:

https://pastebin.com/7pbihrRC

@Koenkk
Copy link
Owner

Koenkk commented Aug 8, 2019

  • Which cases don't give expected behaviour?
  • On line 17 I see brightness":200, on line 11 "brightness":20, what happend in between? Do you see any pointers why the brightness did increase?

@irgusite
Copy link
Author

irgusite commented Aug 8, 2019 via email

@irgusite
Copy link
Author

Oh, I didn't answer your second question. For the brightness change I have no idea. I don't remember changing it in-between and I had the other plug-ins off...

@Koenkk
Copy link
Owner

Koenkk commented Aug 18, 2019

Could you try to investigate that further?

@irgusite
Copy link
Author

Hey, sorry for the delay, I hasn't got any time. So for the brightness change, it was me that changed it.
So, if I send

{ "entity_id": "light.ampoule_salon_mqtt", "color_temp":440, "brightness":10, "transition":2 }
to my bulb, the color temps is applied with the transition delay. But the brighness isn't changed (in real, you see the light dim a little bit, and come back to it's original brightness, as if the brightness change is interupted by the color change)
The log lines for this event are these: https://pastebin.com/N5Pxf98x

As I see in the log, the two commands are send one after another, and this could be the cause of that, the first "moveToLevelWithOnOff " is received, but just after, ignored by the bulb because it receives the "moveToColorTemp " which is applied.

@Koenkk
Copy link
Owner

Koenkk commented Aug 26, 2019

As I see in the log, the two commands are send one after another, and this could be the cause of that, the first "moveToLevelWithOnOff " is received, but just after, ignored by the bulb because it receives the "moveToColorTemp " which is applied.

Can you also reproduce this manually?

@irgusite
Copy link
Author

Can you also reproduce this manually?

What do you mean by manually?

@Koenkk
Copy link
Owner

Koenkk commented Aug 27, 2019

By sending the mqtt commands via a client like mqtt.fx. It seems that the bulb discards the command, could you try to find a sequence when it doenst? Maybe e.g. first color temperature and then brightness?

I will also investigate this after #1888

@irgusite
Copy link
Author

Sooooo, after multiple tries (don't have the logs). When you first set brightness and then color (during the transition interval) the brightness gets reset to original brightness and color is applied with transition.

When doing it in reverse (color and THEN brightness) the brightness gets ignored. But, the next time the color is updated with the SAME value, the brightness is applied.

TL;DR; The brightness is always ignored by the bulb if a color command is send in the transition interval. (before of after)

@irgusite
Copy link
Author

Furthermore, if color_temp is send, before brightness, but the color is the same as alread set, the brightness is updated

@Koenkk
Copy link
Owner

Koenkk commented Aug 28, 2019

Thanks for your investigation, so it seems that a current transition is discarded when a new transition is started.

@irgusite
Copy link
Author

only the brightness transition is discarded, the color isn't....

@abmantis
Copy link
Contributor

abmantis commented Aug 29, 2019

I'm also having the same issue and after reproducing it manually, the brightness is always the discarded one. Independently of it being the first or last one.

@Koenkk
Copy link
Owner

Koenkk commented Aug 30, 2019

So it seems this is just a software limitation of the bulb itself, not sure how we can work around it.

@irgusite
Copy link
Author

Would it be possible to add a delay between the 2 orders (via config param or something similar)?

@abmantis
Copy link
Contributor

I don't think a delay would work. Let's say you do a change to brightness and ct that should take 5 seconds. For it to work with a delay, it would have to send the ct change command 5 seconds after the brightness command, which would make the whole change take 10 seconds.

@irgusite
Copy link
Author

Yeah, but at the moment, it just cancels the other command.
Personally I don't care if the 2 transitions take each 5 seconds to complete, with the bulb you can't have both at the same time. But at the moment you just have 1 of the transitions and not the other

That why I'm proposing a config, so you can activate or not the behavior. But at the moment, it just doesn't work at all with half of the integrations from HA.

Making the correction at the level of z2m makes it easier for every integration.

@abmantis
Copy link
Contributor

Yeah, you're right. I too prefer that it takes longer but gets there. If there's no other way, that is better than the current behavior.
By the way, have you checked if there is any firmware update for the bulb? I may do that later with deconz.

@irgusite
Copy link
Author

Any news on a possible implementation/correction?

@Koenkk
Copy link
Owner

Koenkk commented Sep 24, 2019

I was just thinking about this, what if we only pusblish the transition for the last published value?

E.g. when sending {brightness: 100, color_temp: 200, transition: 5} :

Currently:

  • brightness 100 with transition 5 <--- fails to apply
  • color temp 200 with transition 5

Proposed fix:

  • brightness 100 without transition
  • color temp 200 with transition 5

@irgusite
Copy link
Author

irgusite commented Sep 24, 2019 via email

@abmantis
Copy link
Contributor

Good idea. I just suggest changing the order. I think brightness changing abruptly is worse than color temp.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Sep 25, 2019
@Koenkk
Copy link
Owner

Koenkk commented Sep 25, 2019

  • I've pushed a fix for this in the dev branch (Brightness, color and transition with ikea light #1810 (comment)).
  • I've only enabled this for TRADFRI bulbs as this works fine already for e.g. Philips Hue bulbs.
  • @abmantis this is a bit tricky as in zigbee the brightness command can also control the state while the color cannot. Therefore currently the brightness command is always executed before the color one.

@irgusite can you confirm that it works?

@irgusite
Copy link
Author

irgusite commented Sep 26, 2019

Nope it doesn't work. The brightness is still with transition (it is cut)

I updated like this:
sudo systemctl stop zigbee2mqtt
cd /opt/zigbee2mqtt

Backup configuration

cp -R data data-backup

Update

git pull origin dev
git checkout dev
rm -rf node_modules
npm install

Restore configuration

cp -R data-backup/* data

Start zigbee2mqtt

sudo systemctl start zigbee2mqtt

@Koenkk
Copy link
Owner

Koenkk commented Sep 27, 2019

Can you share the contents of node_modules/zigbee-herdsman-converters/converters/toZigbee.js?

EDIT: nevermind I found the issue, should be fixed in the dev branch now.

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Sep 27, 2019
@atxbyea
Copy link

atxbyea commented Oct 3, 2019

I installed the latest-dev docker yesterday, but it appears to still be having issues with adjusting brightness and temperature of my IKEA bulbs.

@Koenkk
Copy link
Owner

Koenkk commented Oct 30, 2019

@atxbyea do you control them via groups?

@irgusite
Copy link
Author

Just tested, and it seems to work fine :) Thanks for your work 👍

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Oct 30, 2019
@Koenkk
Copy link
Owner

Koenkk commented Oct 30, 2019

@irgusite thanks for confirming.

I've also pushed a fix for TRADFRI devices in a group. Assuming this is fixed now.

@dgarciadonado
Copy link

Hello @Koenkk , I am experimenting the same issue with Ikea Tradfri bulbs.
When I turn on the light defining both brightness and color, and specifiying a transition, the bulb applies the correct brightness and color but doesn't show the transition. Is it solved in the Dev branch or this is now applied on the Master branch?
If a new issue is needed, just tell me and I will open it.
Thank you very much.

@Koenkk
Copy link
Owner

Koenkk commented May 2, 2020

@dgarciadonado in that case the transition will be only applied over the color, the brightness is set immediately (tradfri bulbs don't support transitioning on both properties).

@dgarciadonado
Copy link

@dgarciadonado in that case the transition will be only applied over the color, the brightness is set immediately (tradfri bulbs don't support transitioning on both properties).

Thank you @Koenkk , and is there any way to force brightness transition instead of temperature transition (if using both at the same time)

@Koenkk
Copy link
Owner

Koenkk commented May 2, 2020

@dgarciadonado no at the moment not (and not very easy to change).

@w3host
Copy link

w3host commented May 22, 2020

This workaround can help in HA:
https://www.wouterbulten.nl/blog/tech/ikea-tradfri-temp-and-brightness-with-home-assistant/

So firstly set brightness and transition and after 1s delay set color_temp...

action:

  • data:
    brightness_pct: 100
    transition: 1
    entity_id: light.0x14b457fffe4e0ecf_light
    service: light.turn_on
  • delay: 00:00:01
  • data:
    color_temp: 300
    entity_id: light.0x14b457fffe4e0ecf_light
    service: light.turn_on

@dgarciadonado
Copy link

Thank you!! I will give a try!

@dgarciadonado
Copy link

Hello @w3host, now is working! Thank you!
I am using many scripts like this (changing brightness and temperature):

      - service: light.turn_on
        data_template:
          entity_id: light.salon_1_zigbee_group
          brightness: 127 
          transition: 2
      - delay: '00:00:02'
      - service: light.turn_on
        data_template:
          entity_id: light.salon_1_zigbee_group           
          color_temp: 266 
          transition: 3 

Now I have another problem: if the script is executing the final transition and I call another script which affects this light, the lights changes to be crazy and doesn`t reflect the real Brightness and Color.
Maybe you have experiencing this behaviour?

Thank you again!

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

6 participants