Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.07k stars 1.67k forks source link

MQTT Invalid color mode received hassio ZNLDP12LM #7736

Closed tomdudu38 closed 2 years ago

tomdudu38 commented 3 years ago

What happened

hello:

"MQTT Invalid color mode received" spam in hassio log

hassio: Logger: homeassistant.components.mqtt.light.schema_json Source: components/mqtt/light/schema_json.py:247 Integration: MQTT (documentation, issues) First occurred: 8 juin 2021, 16:32:41 (133 occurrences) MQTT : { "availability": [ { "topic": "zigbee2mqtt/bridge/state" }, { "topic": "zigbee2mqtt/lampe3/availability" } ], "brightness": true, "brightness_scale": 254, "color_mode": true, "command_topic": "zigbee2mqtt/lampe3/set", "device": { "identifiers": [ "zigbee2mqtt_0x00158d0004850447" ], "manufacturer": "Xiaomi", "model": "Aqara smart LED bulb (ZNLDP12LM)", "name": "lampe3", "sw_version": "Zigbee2MQTT 1.19.1" }, "effect": true, "effect_list": [ "blink", "breathe", "okay", "channel_change", "finish_effect", "stop_effect" ], "json_attributes_topic": "zigbee2mqtt/lampe3", "max_mireds": 500, "min_mireds": 150, "name": "lampe3", "schema": "json", "state_topic": "zigbee2mqtt/lampe3", "supported_color_modes": [ "color_temp" ], "unique_id": "0x00158d0004850447_light_zigbee2mqtt" } zigbee2mqtt: ` MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":239,"linkquality":99,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}'

`

What did you expect to happen

no log

How to reproduce it (minimal and precise)

use some ZNLDP12LM in hassio

Debug info

Zigbee2MQTT version: latest Adapter hardware: CC2531 Adapter firmware version: latest

Koenkk commented 3 years ago

This happens because you are on an older HA version, make sure to be on 2021.4.5 as least as mentioned in the changelog: https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.18.3

tomdudu38 commented 3 years ago

i am on 2021.6.3 and it happened on the previous version i keep my HA up to date as i do for zigbee2mqtt & mqtt and still happen on 2021.6.4

Koenkk commented 3 years ago

What z2m version are you using? If you are still on 1.18.1 check first point of https://github.com/Koenkk/zigbee2mqtt/releases/tag/1.19.0

tomdudu38 commented 3 years ago

i pull the latest tag i, so 1.19.0. should i try latest-dev?

Koenkk commented 3 years ago

Can you try if this issue disappears when setting the color temp via HA? Does the error then appear when setting the XY color of the group?

tomdudu38 commented 3 years ago

I tried setting groups and individual lights color_temp via HA but the issue still there. And, i tried some custom color_mode (xy, true , false,) in the customize.yaml it does nothing much. So removed lights groups. and still happen. I don't think it's a group issue.this bulb have color temp, but it have only one color (white) but: if i look at mqtt log , i can see: "color_mode": true and zigbee2mqtt send : color_mode: xy

Koenkk commented 3 years ago

When setting the color temp of the individual light in HA, does z2m send color_mode: "color_temp"? (can you provide the debug log of that).

See https://www.zigbee2mqtt.io/information/debug.html on how to enable debug logging.

tomdudu38 commented 3 years ago

Publishing 'set' 'color_temp' to 'lampe1' Debug Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0x00158d0004850409! Debug Received Zigbee message from 'lampe1', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":307,"tuyaRgbMode":117440598}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":97,"color_mode":"xy","color_temp":307,"linkquality":60,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Received Zigbee message from 'lampe1', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":307,"tuyaRgbMode":4406784}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":97,"color_mode":"xy","color_temp":307,"linkquality":63,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":97,"color_mode":"xy","color_temp":307,"linkquality":63,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Failed to ping 'lampe3' Debug Received MQTT message on 'zigbee2mqtt/lampe1/set' with data '{"state": "ON", "color_temp": 226}' Debug Skipping state because of Home Assistant Debug Publishing 'set' 'color_temp' to 'lampe1' Debug Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0x00158d0004850409!

Koenkk commented 3 years ago

Could you provide your configuration.yaml file?

tomdudu38 commented 3 years ago

sure:

homeassistant: true permit_join: false mqtt: base_topic: zigbee2mqtt server: 'mqtt://192.168.1.253' serial: port: /dev/ttyACM0 frontend: port: 8080 devices: '0x00124b001b783bed': friendly_name: htemp1 '0x00158d0004850447': friendly_name: lampe3 retain: true optimistic: true '0x00158d0004850409': friendly_name: lampe1 retain: true optimistic: true '0x00158d000484ec5b': friendly_name: lampe2 retain: true optimistic: true '0x00158d00042f4d67': advanced: availability_timeout: 60 availability_passlist:

Koenkk commented 3 years ago

Can you try again with the latest dev branch? After upgrading set the color temperature at least once and provide the complete debug log starting at the point where you set the color temperature of the individual bulb via HA till 10 seconds after this.

tomdudu38 commented 3 years ago

yes i can...

Received MQTT message on 'zigbee2mqtt/lampe1/set' with data '{"state": "ON", "color_temp": 269}' Debug Skipping state because of Home Assistant Debug Publishing 'set' 'color_temp' to 'lampe1' Debug Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0x00158d0004850409! Debug Received Zigbee message from 'lampe1', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":269,"tuyaRgbMode":117440704}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":66,"color_mode":"color_temp","color_temp":269,"linkquality":63,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":66,"color_mode":"color_temp","color_temp":269,"linkquality":63,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Received Zigbee message from 'lampe1', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":269,"tuyaRgbMode":4406784}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":66,"color_mode":"color_temp","color_temp":269,"linkquality":63,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Received Zigbee message from 'lampe2', type 'readResponse', cluster 'genBasic', data '{"zclVersion":1}' from endpoint 1 with groupID 0 Debug Successfully pinged 'lampe2' Debug Received Zigbee message from 'cc2530', type 'attributeReport', cluster 'genOnOff', data '{"onOff":1}' from endpoint 8 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/cc2530', payload '{"led":true,"linkquality":68}' Debug Received MQTT message on 'zigbee2mqtt/lampe2/set' with data '{"state": "ON", "color_temp": 275}' Debug Skipping state because of Home Assistant Debug Publishing 'set' 'color_temp' to 'lampe2' Debug Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0x00158d000484ec5b! Debug Received Zigbee message from 'lampe2', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":275,"tuyaRgbMode":117440706}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe2', payload '{"brightness":132,"color_mode":"color_temp","color_temp":275,"linkquality":55,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe2', payload '{"brightness":132,"color_mode":"color_temp","color_temp":275,"linkquality":55,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Received Zigbee message from 'lampe2', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":275,"tuyaRgbMode":11021824}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe2', payload '{"brightness":132,"color_mode":"color_temp","color_temp":275,"linkquality":55,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Received Zigbee message from 'htemp1', type 'attributeReport', cluster 'msTemperatureMeasurement', data '{"measuredValue":2365}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/htemp1', payload '{"battery":81.5,"humidity":67.49,"linkquality":70,"temperature":23.65,"voltage":2900}' Debug Received MQTT message on 'zigbee2mqtt/lampe3/set' with data '{"state": "ON", "color_temp": 299}' Debug Skipping state because of Home Assistant Debug Publishing 'set' 'color_temp' to 'lampe3' Debug Missing colorTempPhysicalMin and/or colorTempPhysicalMax for endpoint 0x00158d0004850447! Debug Received Zigbee message from 'lampe3', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":299,"tuyaRgbMode":117440707}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":132,"color_mode":"color_temp","color_temp":299,"linkquality":92,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":132,"color_mode":"color_temp","color_temp":299,"linkquality":92,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Received Zigbee message from 'lampe3', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":299,"tuyaRgbMode":3324416}' from endpoint 1 with groupID 0

Koenkk commented 3 years ago

Does HA still throw the error now? The payload looks good now: "color_mode":"color_temp"

tomdudu38 commented 3 years ago

thanks you koenkk. today my payload was : MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":82,"color_mode":"color_temp","color_temp":291,"linkquality":49,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":82,"color_mode":"color_temp","color_temp":291,"linkquality":47,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe2', payload '{"brightness":110,"color_mode":"xy","color_temp":275,"linkquality":89,"power_outage_memory":null,"state":"OFF","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe2', payload '{"brightness":110,"color_mode":"xy","color_temp":275,"linkquality":92,"power_outage_memory":null,"state":"OFF","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe2', payload '{"brightness":110,"color_mode":"xy","color_temp":275,"linkquality":92,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe2', payload '{"brightness":110,"color_mode":"xy","color_temp":275,"linkquality":89,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":299,"linkquality":99,"power_outage_memory":null,"state":"OFF","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":299,"linkquality":99,"power_outage_memory":null,"state":"OFF","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":299,"linkquality":99,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":299,"linkquality":97,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/cc2530', payload '{"led":true,"linkquality":89}' Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":82,"color_mode":"color_temp","color_temp":291,"linkquality":47,"power_outage_memory":null,"state":"OFF","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe1', payload '{"brightness":82,"color_mode":"color_temp","color_temp":291,"linkquality":42,"power_outage_memory":null,"state":"OFF","update":{"state":"idle"},"update_available":false}'

BUT i rebooted hassio, set each bulb color_temp in hassio and the logs disapeared,and i can't see those bad logs come back for now.

tomdudu38 commented 3 years ago

the error still there: please look my logs, what i did:

Received MQTT message on 'zigbee2mqtt/lampe3/set' with data '{"state": "ON", "color_temp": 269}' Debug Publishing 'set' 'color_temp' to 'lampe3' Debug Received Zigbee message from 'lampe3', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":269,"tuyaRgbMode":117440744}' from endpoint 1 with groupID 0 Debug Received Zigbee message from 'lampe3', type 'attributeReport', cluster 'lightingColorCtrl', data '{"colorTemperature":269,"tuyaRgbMode":3324416}' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"color_temp","color_temp":269,"linkquality":89,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Device 'lampe3' announced itself Info MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"lampe3","ieee_address":"0x00158d0004850447"},"type":"device_announce"}' Info MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"message":"announce","meta":{"friendly_name":"lampe3"},"type":"device_announced"}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"color_temp","color_temp":269,"linkquality":84,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"color_temp","color_temp":269,"linkquality":86,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":269,"linkquality":84,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Debug Received Zigbee message from 'lampe3', type 'read', cluster 'genTime', data '["time"]' from endpoint 1 with groupID 0 Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":269,"linkquality":94,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}' Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":115,"color_mode":"xy","color_temp":269,"linkquality":86,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}'

Koenkk commented 3 years ago

Does this issue disappear when setting availability_timeout to 0 in your configuration?

tomdudu38 commented 3 years ago

the issue has disappeared with avaibility_timeout to 0. thanks you sir.

nicx commented 3 years ago

Unfortunately setting availability_timeout to 0 does not help, still getting a lot of these warning messages:

2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received
2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received
2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received
2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received

@Koenkk any other idea? Should I create another Issue or shall we reopen this one?

hmorkemo commented 3 years ago

Unfortunately setting availability_timeout to 0 does not help, still getting a lot of these warning messages:

2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received
2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received
2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received
2021-08-10 08:44:26 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid or incomplete color value received

@Koenkk any other idea? Should I create another Issue or shall we reopen this one?

This still happens here as well. zigbee2mqtt 1.21.1, HA Core 2021.9.6, availability_timeout: 0

sygys commented 3 years ago

Im not sure why this thread is closed. The color mode en and color value warnings are still not fixed. Besides that i get around 200 - 300 warnings a day about the click attribute.

z2mqtt is spamming an awful lot warnings in my logs with no reason.

Im using 100% hue lights which all are supported by z2mqtt and all work like expected. Still i get these warnings allot. Im running z2m version 1.21.1-1, home assistant core 2021.9.3, supervisor 2021.09.0, home assistant OS 6.3

In Which version will this be fixed? and even more important what is causing this? It doesn't make sense to set availability_timeout to 0 to fix a wrong color mode. or any other of the 500 warnings a day i get from z2m. Which by the way is the standard value in my z2m config but doesnt help at all.

Thanks in advance

tomdudu38 commented 3 years ago

hi.... this topic was not about hue light, not about color_value. i have no more log since few months.closed.

hmorkemo commented 3 years ago

I've had both the 1) click attribute and 2) invalid color mode spams, for a long time, also in HA 2021.10.2. But, now I've found a solution to problem 2! The messages occur only for light devices with color temperature capabilities. And ONLY for those where the color temp has never been set. (Seems like a typical uninitialized data error). Once I set the color temp for all my bulbs, the message no longer appears. But problem 1 still isn't solved.

sygys commented 3 years ago

Funny you say that. I just yesterday found out the same too. It indeed is the lack of color temp set for the first time indeed. It's fun y how posts like these are closed while they weren't fixed. The json click is making me crazy. I just can't seem te find out what's causing this. They seem to random appear. I have tried everything mentioned in here. Can someone just remove this message from the logs if it isnt doing anything? I read about legacy. But even set that in the configuration.yaml makes no difference. If it's old just remove it I would think.

hmorkemo commented 3 years ago

I've done some more research: The "Template variable warning: 'dict object' has no attribute 'click' when rendering '{{ value_json.click }}'" is related to remote controls/switches. Watching my mqtt log and home-assistant.log while pressing switches, I see that the error appears at every click (and probably sometimes without clicks as well). So far, I have verified this on Xiaomi switches (WXKG01LM and WXKG12LM), and IKEA TRÅDFRI Open/Close remote (E1766). Please re-open this case and fix these bugs, as they cause a lot of annoyance.

tomdudu38 commented 2 years ago

today, i got this "color mode log back". with hassio and/or zb2mqtt update. Logs disapears if setting the color temp, in hassio hassio: 2021.11.1 zb2mqtt:1.22.0 commit: 0a1fccf

when power on (electricity) a lampe :

Info MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":65,"color_mode":"xy","color_temp":306,"linkquality":96,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}'

after setting the color temp in hassio:

MQTT publish: topic 'zigbee2mqtt/lampe3', payload '{"brightness":65,"color_mode":"color_temp","color_temp":318,"linkquality":93,"power_outage_memory":null,"state":"ON","update":{"state":"idle"},"update_available":false}'

same configuration.yaml :

advanced: availability_timeout: 0 availability_passlist:

tomdudu38 commented 2 years ago

my new configuration.yaml:

'0x00158d0004850409': friendly_name: lampe1 retain: true optimistic: true filtered_attributes: ["color_mode"] availability: active: timeout: 10 passive: timeout: 1500

RadioLed2000 commented 2 years ago

z2m sends "color_mode"="xy", but Home Assistant expects boolean (true or false). https://www.home-assistant.io/integrations/light.mqtt/#color_mode This causes an error. I add "color_mode" to Filtered attributes and have no errors anymore. Maybe this option is not needed. This lamp doesn't support colors. Only color temp.

RadioLed2000 commented 2 years ago

BTW, there are wrong min and max values for color_temp. Right are 153-370 https://github.com/Koenkk/zigbee2mqtt/issues/621#issuecomment-483214288

adekloet commented 2 years ago

the error is back: 2021-12-17 12:03:35 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received

availability_timeout: 0 does not fix the error, tyhe light control is still working from HA though.

Rjaap commented 2 years ago

the error is back: 2021-12-17 12:03:35 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received

availability_timeout: 0 does not fix the error, tyhe light control is still working from HA though.

Same here, update to home assistant latest core 2021-12.3, light control works as expected but throws an error: invalid color mode received.

NicolaiPetri commented 2 years ago

I also see this on some Ikea devices, and it makes the HA powercalc module unhappy: 2022-01-09 16:18:00 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received 2022-01-09 16:18:00 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.livingroomfloorlamp1: Could not calculate power. color mode unknown Only happens for some specific bulb types, this bulb is reported as "IKEA LED1903C5/LED1835C6" in Z2M

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

dummylabs commented 2 years ago

I add "color_mode" to Filtered attributes and have no errors anymore.

@RadioLed2000 How did you achieve this?

RadioLed2000 commented 2 years ago

How did you achieve this?

Now in the latest Zigbee2mqtt version: 1.23.0-1 I remove "color_mode" from Filtered attributes and have no errors. Maybe this issue is already fixed.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

mrfind commented 2 years ago

I'm still seeing the "Invalid color mode received" warnings.

I'm on the latest ha version 2022.3.5 and z2m version 1.24.0 I'm using different types of Philips Hue Color lights and it happens for all of them, both for individual lights and groups. It only happens when setting hs colors or when using "hue_step", not when setting rgb or xy colors or color_temp. In other words: It happens whenever the lights report color_mode: "hs". This is the log when sending a command to a single light (which is part of 5 groups):

  debug Received MQTT message on 'zigbee2mqtt/light/ofc/desk/rght/set' with data '{"color":{"h":100,"s":80}}'
  debug Skipping state because of Home Assistant
  debug Publishing 'set' 'color' to 'light/ofc/desk/rght'
  info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/all', payload '{"brightness":79,"color":{"h":100,"hue":100,"s":80,"saturation":80,"x":0.3151,"y":0.514},"color_mode":"hs","color_temp":170,"state":"ON"}'
  info MQTT publish: topic 'zigbee2mqtt/light/ofc/desk/rght', payload '{"brightness":79,"color":{"h":100,"hue":100,"s":80,"saturation":80,"x":0.3151,"y":0.514},"color_mode":"hs","color_temp":170,"color_temp_startup":250,"linkquality":131,"state":"ON","update":{"state":"idle"},"update_available":false}'
  info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/all', payload '{"brightness":254,"color":{"h":100,"hue":100,"s":80,"saturation":80,"x":0.3151,"y":0.514},"color_mode":"hs","color_temp":170,"state":"ON"}'
  info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/brm', payload '{"brightness":254,"color":{"h":100,"hue":100,"s":80,"saturation":80,"x":0.3151,"y":0.514},"color_mode":"hs","color_temp":170,"state":"ON"}'
  info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/cor', payload '{"brightness":254,"color":{"h":100,"hue":100,"s":80,"saturation":80,"x":0.3151,"y":0.514},"color_mode":"hs","color_temp":170,"state":"ON"}'
  info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/desk', payload '{"brightness":79,"color":{"h":100,"hue":100,"s":80,"saturation":80,"x":0.3151,"y":0.514},"color_mode":"hs","color_temp":170,"state":"ON"}'

Interestingly there are 6 mqtt messages reporting the new state and I get 12 warnings in the ha log - 2 per message?

Setting the color_temp for those lights doesn't change anything. I added "color_mode" to the filtered_attributes for this light. Result: Only 10 instead of 12 warnings (for the 5 groups?) but a new ERROR in ha log:

  2022-03-16 01:40:22 ERROR (MainThread) [homeassistant.util.logging] Exception in state_received when handling msg on 'zigbee2mqtt/light/ofc/desk/rght': '{"brightness":79,"color":{"h":200,"hue":200,"s":80,"saturation":80,"x":0.1999,"y":0.2912},"color_temp":153,"color_temp_startup":250,"linkquality":134,"state":"ON","update":{"state":"idle"},"update_available":false}'
  Traceback (most recent call last):
    File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 47, in wrapper
      msg_callback(msg)
    File "/usr/src/homeassistant/homeassistant/components/mqtt/light/schema_json.py", line 327, in state_received
      self._update_color(values)
    File "/usr/src/homeassistant/homeassistant/components/mqtt/light/schema_json.py", line 265, in _update_color
      color_mode = values["color_mode"]
  KeyError: 'color_mode'

So that's no solution. Also, I'd have to set the filtered attribute for the groups as well and I don't know how to do that...

I really hope you find a solution for this; I'm working on animated light scenes which need the h/s option, so I get loads of these warnings and after a few thousand of them ha keeps restarting. Thanks a lot for your work! Martin

krasatos commented 2 years ago

Same here, Hassio 2022.4.1 z2m 1.25.0-1 ZNLDP12LM

Logger: homeassistant.components.mqtt.light.schema_json
Source: components/mqtt/light/schema_json.py:267
Integration: MQTT ([documentation](https://www.home-assistant.io/integrations/mqtt), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+mqtt%22))
First occurred: 4:06:54 AM (25 occurrences)
Last logged: 2:30:32 PM

Invalid color mode received
ThatTallGuy21 commented 2 years ago

Hey guys-- I was receiving this same error and I think I may have resolved it. Still trying to test it out, but so far it has worked, even after restarting HA. I noticed that my color and ambient bulbs (Hue brand in my case) that were throwing this error were never actually set via color or temperature from my HA dashboard. I have numerous automations to turn lights on/off, or switches that would change the state of these different types of bulbs. However, once I went into the dashboard, and changed both color and temperature (when applicable), the warnings/errors disappeared from HA and Zigbee2Mqtt logs.

If this actually does work, my guess is that the default initial value in HA isn't being set by Zigbee2Mqtt so while it's passing over the color/temp value and working correctly in HA, it's not stored in and coming from HA? Idk.. Kind of grasping at straws but it seems to have worked.

Note: This is best tested by grouping all your lights in Z2M and adding the group light with temp/color to the dashboard and adjusting it until you're happy with the setting.

mrfind commented 2 years ago

Thanks for sharing that, ThatTallGuy21, but sadly it doesn't apply to my situation. I have changed color and/or temperature of my lights loads of times via the dashboard, but the problem persists. I'm now on ha 2022.4.4 and z2m 1.25.0 and nothing has changed.

@Koenkk Do you have any ideas what else I might try to get to the bottom of this?

Koenkk commented 2 years ago

@mrfind could you provide the debug log when setting the color temperature and this error pops-up in HA?

See https://www.zigbee2mqtt.io/guide/usage/debug.html on how to enable debug logging.

mrfind commented 2 years ago

@Koenkk there's no error when setting the color temp, only when setting color in hs mode (see my post from 16 March).

Here's the log when I set hs color for a light that's a member of multiple groups - the ha log shows multiple Invalid color mode received warnings:

debug Received MQTT message on 'zigbee2mqtt/light/ofc/desk/rght/set' with data '{"state":"on","color":{"hue":139,"saturation":99}}'
debug Skipping state because of Home Assistant
debug Publishing 'set' 'color' to 'light/ofc/desk/rght'
debug Requested color_temp 103 is lower than minimum supported 153, using minimum!
info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/all', payload '{"brightness":254,"color":{"h":139,"hue":139,"s":99,"saturation":99,"x":0.1652,"y":0.5318},"color_mode":"hs","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/light/ofc/desk/rght', payload '{"brightness":99,"color":{"h":139,"hue":139,"s":99,"saturation":99,"x":0.1652,"y":0.5318},"color_mode":"hs","color_temp":153,"color_temp_startup":250,"linkquality":105,"state":"ON","update":{"state":"idle"},"update_available":false}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/all', payload '{"brightness":254,"color":{"h":139,"hue":139,"s":99,"saturation":99,"x":0.1652,"y":0.5318},"color_mode":"hs","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/brm', payload '{"brightness":254,"color":{"h":139,"hue":139,"s":99,"saturation":99,"x":0.1652,"y":0.5318},"color_mode":"hs","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/cor', payload '{"brightness":254,"color":{"h":139,"hue":139,"s":99,"saturation":99,"x":0.1652,"y":0.5318},"color_mode":"hs","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/desk', payload '{"brightness":99,"color":{"h":139,"hue":139,"s":99,"saturation":99,"x":0.1652,"y":0.5318},"color_mode":"hs","color_temp":153,"state":"ON"}'

...and here's the log when I try the same with rgb color - the ha log shows NO warnings:

debug Received MQTT message on 'zigbee2mqtt/light/ofc/desk/rght/set' with data '{"state":"on","color":{"rgb":"0,255,0"}}'
debug Skipping state because of Home Assistant
debug Publishing 'set' 'color' to 'light/ofc/desk/rght'
debug Requested color_temp 129 is lower than minimum supported 153, using minimum!
info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/all', payload '{"brightness":254,"color":{"h":120,"hue":120,"s":100,"saturation":100,"x":0.1724,"y":0.7468},"color_mode":"xy","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/light/ofc/desk/rght', payload '{"brightness":99,"color":{"h":120,"hue":120,"s":100,"saturation":100,"x":0.1724,"y":0.7468},"color_mode":"xy","color_temp":153,"color_temp_startup":250,"linkquality":94,"state":"ON","update":{"state":"idle"},"update_available":false}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/all', payload '{"brightness":254,"color":{"h":120,"hue":120,"s":100,"saturation":100,"x":0.1724,"y":0.7468},"color_mode":"xy","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/brm', payload '{"brightness":254,"color":{"h":120,"hue":120,"s":100,"saturation":100,"x":0.1724,"y":0.7468},"color_mode":"xy","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/cor', payload '{"brightness":254,"color":{"h":120,"hue":120,"s":100,"saturation":100,"x":0.1724,"y":0.7468},"color_mode":"xy","color_temp":153,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/desk', payload '{"brightness":99,"color":{"h":120,"hue":120,"s":100,"saturation":100,"x":0.1724,"y":0.7468},"color_mode":"xy","color_temp":153,"state":"ON"}'
mrfind commented 2 years ago

As per your request, here's also the log for changing the color temp, which does not result in warnings:

debug Received MQTT message on 'zigbee2mqtt/light/ofc/desk/rght/set' with data '{"state":"on","color_temp":300}'
debug Skipping state because of Home Assistant
debug Publishing 'set' 'color_temp' to 'light/ofc/desk/rght'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/all', payload '{"brightness":254,"color":{"h":36,"hue":36,"s":67,"saturation":67,"x":0.4152,"y":0.3954},"color_mode":"color_temp","color_temp":300,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/light/ofc/desk/rght', payload '{"brightness":99,"color":{"h":36,"hue":36,"s":67,"saturation":67,"x":0.4152,"y":0.3954},"color_mode":"color_temp","color_temp":300,"color_temp_startup":250,"linkquality":72,"state":"ON","update":{"state":"idle"},"update_available":false}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/all', payload '{"brightness":254,"color":{"h":36,"hue":36,"s":67,"saturation":67,"x":0.4152,"y":0.3954},"color_mode":"color_temp","color_temp":300,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/brm', payload '{"brightness":254,"color":{"h":36,"hue":36,"s":67,"saturation":67,"x":0.4152,"y":0.3954},"color_mode":"color_temp","color_temp":300,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/hom/not/cor', payload '{"brightness":254,"color":{"h":36,"hue":36,"s":67,"saturation":67,"x":0.4152,"y":0.3954},"color_mode":"color_temp","color_temp":300,"state":"ON"}'
info MQTT publish: topic 'zigbee2mqtt/lightgroup/ofc/desk', payload '{"brightness":99,"color":{"h":36,"hue":36,"s":67,"saturation":67,"x":0.4152,"y":0.3954},"color_mode":"color_temp","color_temp":300,"state":"ON"}'

Thanks for your support!

Koenkk commented 2 years ago

This is because hs is not marked as a supported color mode in the HA discovery for the reason below:

@emontnemery I've tested with supported_color_modes: [ 'xy', 'hs', 'color_temp' ] but after this HA only sends the HS color when changing the color via the picker wheel. We actually want this to be XY for default (according to the Zigbee spec HS is optional and XY mandatory). Could the first color mode be the preferred one? e.g.:

mrfind commented 2 years ago

Not sure if this is relevant, but just in case: Note that the problem also occurs when changing colors from node-red by writing to MQTT (Mosquitto) directly.

Happy Easter! :-)

Koenkk commented 2 years ago

@mrfind it will only happen if you control in HS, if you send XY values from node-red you should be fine.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

kirush0280 commented 1 year ago
2022-11-23 11:03:09.301 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received for entity light.svet_koridor_2
2022-11-23 11:03:09.362 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received for entity light.svet_koridor_2
2022-11-23 11:03:51.213 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received for entity light.svet_koridor_1
2022-11-23 11:03:51.378 WARNING (MainThread) [homeassistant.components.mqtt.light.schema_json] Invalid color mode received for entity light.svet_koridor_2

Model Zigbee lumi.light.aqcn02 Производитель Zigbee: LUMI Aqara smart LED bulb Version Zigbee2MQTT: [1.28.2]

HA: Home Assistant 2022.11.4 Supervisor 2022.10.2 Operating System 9.3 Frontend 20221108.0 - latest

phoxy84 commented 1 year ago

I solved my issue by going into the bulb info in Home assistant and set the color temperature once there manually. On the bulbs with the error message the slider was all the way to the left. Now no errors (for now) Schermafbeelding 2022-12-06 om 11 07 24

sygys commented 1 year ago

Haven't been having these errors for months now. Just change the color modes once indeed and it will be fixed

robobobo00 commented 1 year ago

Haven't been having these errors for months now. Just change the color modes once indeed and it will be fixed

hello, and how i can do that ?