Closed pjrt closed 1 year ago
So I see this was removed here: https://github.com/bieniu/ha-shellies-discovery/pull/297 due to the white_value change.
The documentation says it to use COLOR_MODE. https://developers.home-assistant.io/docs/core/entity/light#color-modes
The given examples use the default MQTT light schema and the script uses the template schema. I don't want to use the default schema because it doesn't support tansition
, so this would be a breaking change. Theoretically, we can use JSON schema for RGBW2, but I don't have a device and I'm not able to create a proper configuration. If you provide me a working configuration for the JSON schema, I'll try to implement it in a script.
EDIT: I've read the documentation again and the JSON schema cannot be used for RGBW2.
Please test the script from this branch https://github.com/bieniu/ha-shellies-discovery/compare/rgbw2-fix
Got this error:
Exception in discovery_callback when dispatching 'mqtt_discovery_updated_('light', 'shellyrgbw2-A890BA-0')': ({'name': 'Shelly RGBW2 A890BA Light 0', 'availability_topic': 'shellies/shellyrgbw2-A890BA/online', 'payload_available': 'true', 'payload_not_available': 'false', 'command_topic': 'shellies/shellyrgbw2-A890BA/color/0/command', 'state_topic': 'shellies/shellyrgbw2-A890BA/color/0', 'state_value_template': '{{value.lower()}}', 'payload_on': 'on', 'payload_off': 'off', 'rgbw_command_topic': 'shellies/shellyrgbw2-A890BA/color/0/set', 'rgbw_command_template': "{'red':{{red}},'green':{{green}},'blue':{{blue}},'white':{{white}}}", 'rgbw_state_topic': 'shellies/shellyrgbw2-A890BA/color/0/status', 'rgbw_value_template': '{{value_json.red}},{{value_json.green}},{{value_json.blue}},{{value_json.white}}', 'brightness_state_topic': 'shellies/shellyrgbw2-A890BA/color/0/status', 'brightness_value_template': '{{value_json.gain|float|multiply(2.55)|round(0)}}', 'brightness_command_topic': 'shellies/shellyrgbw2-A890BA/color/0/set', 'brightness_command_template': "{'gain':{{value|float|multiply(0.3922)|round(0)}}}", 'effect_command_topic': 'shellies/shellyrgbw2-A890BA/color/0/set', 'effect_command_template': "{ {%if value=='Off'%}'effect':0{%elif value=='Meteor Shower'%}'effect':1{%elif value=='Gradual Change'%}'effect':2{%elif value=='Flash'%}'effect':3{%endif%} }", 'effect_list': ['Off', 'Meteor Shower', 'Gradual Change', 'Flash'], 'effect_state_topic': 'shellies/shellyrgbw2-A890BA/color/0/status', 'effect_value_template': '{%if value_json.effect==1%}Meteor Shower{%elif value_json.effect==2%}Gradual Change{%elif value_json.effect==3%}Flash{%else%}Off{%endif%}', 'unique_id': 'shellyrgbw2-a890ba-light-0', 'qos': 0, 'device': {'connections': [['mac', 'e8:db:84:a8:90:ba']], 'name': 'Shelly RGBW2 A890BA', 'model': 'Shelly RGBW2', 'sw_version': '20221027-095909/v1.12.1-ga9117d3', 'hw_version': 'gen1 (SHRGBW2)', 'manufacturer': 'Allterco Robotics', 'configuration_url': 'http://192.168.1.199/'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 864, in discovery_callback await self._discovery_update(payload) File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 1057, in discovery_update config: DiscoveryInfoType = self.config_schema()(discovery_payload) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec v = func(v) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable return schema(data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: required key not provided @ data['command_on_template']
Exception in discovery_callback when dispatching 'mqtt_discovery_updated_('light', 'shellyrgbw2-DE3731-0')': ({'name': 'Shelly RGBW2 DE3731 Light 0', 'availability_topic': 'shellies/shellyrgbw2-DE3731/online', 'payload_available': 'true', 'payload_not_available': 'false', 'command_topic': 'shellies/shellyrgbw2-DE3731/color/0/command', 'state_topic': 'shellies/shellyrgbw2-DE3731/color/0', 'state_value_template': '{{value.lower()}}', 'payload_on': 'on', 'payload_off': 'off', 'rgbw_command_topic': 'shellies/shellyrgbw2-DE3731/color/0/set', 'rgbw_command_template': "{'red':{{red}},'green':{{green}},'blue':{{blue}},'white':{{white}}}", 'rgbw_state_topic': 'shellies/shellyrgbw2-DE3731/color/0/status', 'rgbw_value_template': '{{value_json.red}},{{value_json.green}},{{value_json.blue}},{{value_json.white}}', 'brightness_state_topic': 'shellies/shellyrgbw2-DE3731/color/0/status', 'brightness_value_template': '{{value_json.gain|float|multiply(2.55)|round(0)}}', 'brightness_command_topic': 'shellies/shellyrgbw2-DE3731/color/0/set', 'brightness_command_template': "{'gain':{{value|float|multiply(0.3922)|round(0)}}}", 'effect_command_topic': 'shellies/shellyrgbw2-DE3731/color/0/set', 'effect_command_template': "{ {%if value=='Off'%}'effect':0{%elif value=='Meteor Shower'%}'effect':1{%elif value=='Gradual Change'%}'effect':2{%elif value=='Flash'%}'effect':3{%endif%} }", 'effect_list': ['Off', 'Meteor Shower', 'Gradual Change', 'Flash'], 'effect_state_topic': 'shellies/shellyrgbw2-DE3731/color/0/status', 'effect_value_template': '{%if value_json.effect==1%}Meteor Shower{%elif value_json.effect==2%}Gradual Change{%elif value_json.effect==3%}Flash{%else%}Off{%endif%}', 'unique_id': 'shellyrgbw2-de3731-light-0', 'qos': 0, 'device': {'connections': [['mac', 'e8:db:84:de:37:31']], 'name': 'Shelly RGBW2 DE3731', 'model': 'Shelly RGBW2', 'sw_version': '20221027-095909/v1.12.1-ga9117d3', 'hw_version': 'gen1 (SHRGBW2)', 'manufacturer': 'Allterco Robotics', 'configuration_url': 'http://192.168.1.173/'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 864, in discovery_callback await self._discovery_update(payload) File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 1057, in discovery_update config: DiscoveryInfoType = self.config_schema()(discovery_payload) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 232, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 355, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.10/site-packages/voluptuous/validators.py", line 351, in _exec v = func(v) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 818, in validate_callable return schema(data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: required key not provided @ data['command_on_template']
I'm trying to see if maybe the issue is that it doesn't set any "supported_color_modes". Not having a lot of luck with it though.
Describe the bug The white control in RGBW2 entities is gone, which means you can no longer control it from HA.
I've read this may be related to a change in 2022.9. https://www.reddit.com/r/homeassistant/comments/x8o96u/shelly_rgbw2_over_mqtt_broken_on_20229/
Expected behavior
The White of the RGBW2 should be controllable.
Versions:
Shellies Discovery automation:
Debug log: