Zigbee2mqtt: Color ignored when specifying brightness in automation with Hue color bulb

Created on 31 Dec 2018  路  16Comments  路  Source: Koenkk/zigbee2mqtt

When turning on my hue lights with an automation in homeassistant if I provide both brightness and color as parameters color is ignored.

Example:

 - alias: Adam Light Switch
   trigger:
     platform: mqtt
     topic: 'zigbee2mqtt/Adams_Switch'
   condition:
     condition: and
     conditions:
      - condition: template
        value_template: "{{ 'single' == trigger.payload_json.click}}"
      - condition: state
        entity_id: light.0x0017880110460c0f_light
        state: 'off'
   action:
     - service: homeassistant.turn_on
       entity_id: light.0x0017880110460c0f_light
       data:
         hs_color: [16.471,100]
         brightness: 255

See log here:
https://pastebin.com/wMAiA8xw

The only way around this I have found is to to turn on the light with the turn_on service then set the color afterwards as a secondary action.

All 16 comments

hi
same for me, a simple set brightness (from standard light HA object) result in a error :
Jan 01 19:21:00 ubuntu59 npm[15784]: zigbee2mqtt:debug 1/1/2019, 7:21:00 PM Received MQTT message on 'zigbee2mqtt/rgbcct_01/set' with data '{"state": "ON", "color": {"r": 115, "g": 108, "b": 255, "x": 0.2, "y": 0.132}, "brightness": 255}'
Jan 01 19:21:00 ubuntu59 npm[15784]: zigbee2mqtt:debug 1/1/2019, 7:21:00 PM Skipping 'state' because of 'brightness'

@khzd do you also have hue bulbs? (as this works as expected on my innr bulb). Note that Skipping 'state' because of 'brightness' is not an error.

Hi
no I have GLEDOPTO (008), for this I get this "warning" Jan 01 19:21:00 ubuntu59 npm[15784]: zigbee2mqtt:debug 1/1/2019, 7:21:00 PM Skipping 'state' because of 'brightness'
so I cannot changed it, it work before 1.0.1 if I'm not wrong
from HA:
action:
service: light.turn_on
entity_id: light.my_office_light_rgbw
data_template:
brightness: 255
rgb_color: ['{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}','{{ (range(0, 255)|random) }}']

Can you verify it worked in an earlier version? In which version did it work?

It worked with the last version before 1.x upgrade.

Would you mind posting the logging before the 1.x upgrade? (as I'm unable to reproduce this)

Hi
Unfortunately I delete all my old logs :(
May be another syntaxe in HA to trigger that ? Via Mqtt directly. will look later
Cheers

it's working on my end (can set color and brightness at once), running latest-dev and current firmware, here's my automation: https://pastebin.com/zTgVATC4

@AnhDuc85 I have just tested with the latest edge version of:

https://github.com/danielwelch/hassio-zigbee2mqtt

And it still doesnt work for me.

Are you using HASSIO?

Also which firmware are you running? I am using:

"firmware":{"transportrev":2,"product":0,"version":"2.6.3","revision":20181024}

I'm also experincing this with Hue bulbs running the latest firmware and dev branch. (All npm_modules also refreshed).

Looking at the converters, I am not sure if the color is actually being sent when power on is called. See here: https://github.com/Koenkk/zigbee-shepherd-converters/blob/master/converters/toZigbee.js#L98

I think that needs to be updated to send the colour the bulb should turn on to

@philhawthorne the color is send by a separate converter, if you look at the zigbee messages being send, you see that genOnOff and lightingColorCtrl messages are send. The problem is that the bulb doesn't execute the lightingColorCtrl cmd.

I see.

So when the bulb is off, and I specify both brightness and color, the following logs are displayed.

zigbee2mqtt:debug 2019-1-20 07:15:58 Received MQTT message on 'zigbee2mqtt/Office Spotlight/set' with data '{"state": "ON", "color": {"x": 0.701, "y": 0.299}, "transition": 3, "brightness": 100}'
zigbee2mqtt:debug 2019-1-20 07:15:58 Skipping 'state' because of 'brightness'
zigbee2mqtt:info 2019-1-20 07:15:58 Zigbee publish to device '0x0017880100b623e9', lightingColorCtrl - moveToColor - {"colorx":45940,"colory":19595,"transtime":30} - {"manufSpec":0,"disDefaultRsp":0} - null
zigbee2mqtt:info 2019-1-20 07:15:58 Zigbee publish to device '0x0017880100b623e9', genLevelCtrl - moveToLevelWithOnOff - {"level":100,"transtime":30} - {"manufSpec":0,"disDefaultRsp":0} - null
zigbee2mqtt:info 2019-1-20 07:15:58 MQTT publish: topic 'zigbee2mqtt/Office Spotlight', payload '{"state":"ON","last_seen":"2019-01-18T08:58:44.779Z","color_temp":365,"color_mode":1,"color":{"x":0.409,"y":0.518},"brightness":254}'
zigbee2mqtt:debug 2019-1-20 07:15:58 Received zigbee message of type 'devChange' with data '{"cid":"genLevelCtrl","data":{"currentLevel":14,"remainingTime":27}}' of device 'LCT001' (0x0017880100b623e9)
zigbee2mqtt:info 2019-1-20 07:15:58 MQTT publish: topic 'zigbee2mqtt/Office Spotlight', payload '{"state":"ON","last_seen":"2019-01-18T08:58:44.779Z","color_temp":365,"color_mode":1,"color":{"x":0.409,"y":0.518},"brightness":14}'
zigbee2mqtt:debug 2019-1-20 07:15:59 Received zigbee message of type 'devChange' with data '{"cid":"lightingColorCtrl","data":{"currentHue":100,"currentSaturation":254,"remainingTime":0,"colorTemperature":290,"enhancedCurrentHue":25600}}' of device 'LCT001' (0x0017880100b623e9)
zigbee2mqtt:info 2019-1-20 07:15:59 MQTT publish: topic 'zigbee2mqtt/Office Spotlight', payload '{"state":"ON","last_seen":"2019-01-18T08:58:44.779Z","color_temp":290,"color_mode":1,"color":{"x":0.409,"y":0.518},"brightness":14}'
zigbee2mqtt:info 2019-1-20 07:16:01 Zigbee publish to device '0x0017880100b623e9', lightingColorCtrl - read - [{"attrId":3},{"attrId":4}] - {"manufSpec":0,"disDefaultRsp":0} - null
zigbee2mqtt:info 2019-1-20 07:16:01 Zigbee publish to device '0x0017880100b623e9', genLevelCtrl - read - [{"attrId":0}] - {"manufSpec":0,"disDefaultRsp":0} - null
zigbee2mqtt:debug 2019-1-20 07:16:01 Received zigbee message of type 'devChange' with data '{"cid":"genLevelCtrl","data":{"currentLevel":100}}' of device 'LCT001' (0x0017880100b623e9)
zigbee2mqtt:info 2019-1-20 07:16:01 MQTT publish: topic 'zigbee2mqtt/Office Spotlight', payload '{"state":"ON","last_seen":"2019-01-18T08:58:44.779Z","color_temp":290,"color_mode":1,"color":{"x":0.409,"y":0.518},"brightness":100}'

Here, the light turns on to the correct brightness, but doesn't change colour. I can see here that it is using moveToLevelWithOnOff and moveToColor. I am wondering if it also requires something like moveToColorWithOnOff. But not sure if that exists.

Alternatively, it might need to send the moveToLevelWithOnOff before it sends the MoveToColor command. This way, the bulb is told to turn on first, and then change its colour. Unfortunately I couldn't see how to force the order easily.

I've seen the exact same, resulting in the described behavior. (With Hue bulbs)

@philhawthorne thanks for figuring this out

Should be fixed in the dev branch.

Cheers @Koenkk

I'll test this out tonight and confirm!

This seems to be fixed for me now!

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jerrychong25 picture jerrychong25  路  4Comments

jeroenterheerdt picture jeroenterheerdt  路  3Comments

mpuff picture mpuff  路  3Comments

RefineryX picture RefineryX  路  4Comments

pepp86 picture pepp86  路  4Comments