HA discovery errors
francisp2 opened this issue · comments
Exception in async_discover when dispatching 'mqtt_discovery_new_light_mqtt': ({'icon': 'mdi:light-switch', 'qos': 0, 'name': 'test', 'availability_topic': 'tuya/bff339668eb83f6350kkah/availability', 'payload_available': 'online', 'payload_not_available': 'offline', 'brightness_command_topic': 'tuya/bff339668eb83f6350kkah/1/brightness_command', 'brightness_state_topic': 'tuya/bff339668eb83f6350kkah/1/brightness_state', 'color_temp_command_topic': 'tuya/bff339668eb83f6350kkah/1/color_temp_command', 'color_temp_state_topic': 'tuya/bff339668eb83f6350kkah/1/color_temp_state', 'command_topic': 'tuya/bff339668eb83f6350kkah/1/command', 'payload_off': 'OFF', 'payload_on': 'ON', 'effect_command_topic': 'tuya/bff339668eb83f6350kkah/1/effect_command', 'effect_state_topic': 'tuya/bff339668eb83f6350kkah/1/effect_state', 'hs_command_topic': 'tuya/bff339668eb83f6350kkah/1/hs_command', 'hs_state_topic': 'tuya/bff339668eb83f6350kkah/1/hs_state', 'json_attributes_topic': 'tuya/bff339668eb83f6350kkah/1/attributes', 'rgb_command_topic': 'tuya/bff339668eb83f6350kkah/1/rgb_command', 'rgb_state_topic': 'tuya/bff339668eb83f6350kkah/1/rgb_state', 'state_topic': 'tuya/bff339668eb83f6350kkah/1/state', 'state_off': 'OFF', 'state_on': 'ON', 'white_value_command_topic': 'tuya/bff339668eb83f6350kkah/1/white_value_command', 'white_value_state_topic': 'tuya/bff339668eb83f6350kkah/1/white_value_state', 'xy_command_topic': 'tuya/bff339668eb83f6350kkah/1/xy_command', 'xy_state_topic': 'tuya/bff339668eb83f6350kkah/1/xy_state', 'unique_id': 'bff339668eb83f6350kkah_1', 'device': {'identifiers': ['bff339668eb83f6350kkah'], 'name': 'test', 'model': 'Tuya', 'sw_version': '1.0.0', 'manufacturer': 'GismoCaster', 'via_device': 'test'}, 'platform': 'mqtt'},)
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/light/__init__.py", line 52, in async_discover config = PLATFORM_SCHEMA(discovery_payload) File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 208, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 287, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 283, in _exec v = func(v) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data) File "/usr/src/homeassistant/homeassistant/components/mqtt/light/__init__.py", line 30, in validate_mqtt_light return schemas[value[CONF_SCHEMA]](value) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['icon']
After removing '"ic":"mdi:light-switch","qos":0,' still error :
Exception in async_discover when dispatching 'mqtt_discovery_new_light_mqtt': ({'name': 'test', 'availability_topic': 'tuya/bff339668eb83f6350kkah/availability', 'payload_available': 'online', 'payload_not_available': 'offline', 'brightness_command_topic': 'tuya/bff339668eb83f6350kkah/1/brightness_command', 'brightness_state_topic': 'tuya/bff339668eb83f6350kkah/1/brightness_state', 'color_temp_command_topic': 'tuya/bff339668eb83f6350kkah/1/color_temp_command', 'color_temp_state_topic': 'tuya/bff339668eb83f6350kkah/1/color_temp_state', 'command_topic': 'tuya/bff339668eb83f6350kkah/1/command', 'payload_off': 'OFF', 'payload_on': 'ON', 'effect_command_topic': 'tuya/bff339668eb83f6350kkah/1/effect_command', 'effect_state_topic': 'tuya/bff339668eb83f6350kkah/1/effect_state', 'hs_command_topic': 'tuya/bff339668eb83f6350kkah/1/hs_command', 'hs_state_topic': 'tuya/bff339668eb83f6350kkah/1/hs_state', 'json_attributes_topic': 'tuya/bff339668eb83f6350kkah/1/attributes', 'rgb_command_topic': 'tuya/bff339668eb83f6350kkah/1/rgb_command', 'rgb_state_topic': 'tuya/bff339668eb83f6350kkah/1/rgb_state', 'state_topic': 'tuya/bff339668eb83f6350kkah/1/state', 'state_off': 'OFF', 'state_on': 'ON', 'white_value_command_topic': 'tuya/bff339668eb83f6350kkah/1/white_value_command', 'white_value_state_topic': 'tuya/bff339668eb83f6350kkah/1/white_value_state', 'xy_command_topic': 'tuya/bff339668eb83f6350kkah/1/xy_command', 'xy_state_topic': 'tuya/bff339668eb83f6350kkah/1/xy_state', 'unique_id': 'bff339668eb83f6350kkah_1', 'device': {'identifiers': ['bff339668eb83f6350kkah'], 'name': 'test', 'model': 'Tuya', 'sw_version': '1.0.0', 'manufacturer': 'GismoCaster', 'via_device': 'test'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/light/__init__.py", line 52, in async_discover config = PLATFORM_SCHEMA(discovery_payload) File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 208, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 287, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.7/site-packages/voluptuous/validators.py", line 283, in _exec v = func(v) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data) File "/usr/src/homeassistant/homeassistant/components/mqtt/light/__init__.py", line 30, in validate_mqtt_light return schemas[value[CONF_SCHEMA]](value) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['state_off']
I might have incorrectly mapped the light. And assumed some of the values where in there ( and wouldn't trigger an error. In gismocaster you can go to Home Assistant component and remove (deselect for component light) the state and command topic. As well as removing any items not mentioned on https://www.home-assistant.io/integrations/light.mqtt/
On your gismodevice model you should pair the right component and topic. (in the example I posted, I guessed there was a state topic. I just bought a lsc bulb at Action... so I'll be testing with those as well. When I figure out how to get the key. (it has been a while)
HA triggers errors on extra/unknown values, if it doesn't it's very hard to detect misspellings etc.
@TradeFace are you able to elaborate on how to deduce the changes required in gismocaster?
I'm having the same issue as above where autodiscovery results in pretty much the same error message:
Exception in async_discover when dispatching 'mqtt_discovery_new_light_mqtt': ({'qos': 0, 'name': 'Kelvin', 'availability_topic': 'tuya/<id>/availability', 'payload_available': 'online', 'payload_not_available': 'offline', 'brightness_command_topic': 'tuya/<id>/23/brightness_command', 'brightness_state_topic': 'tuya/<id>/23/brightness_state', 'color_temp_command_topic': 'tuya/<id>/23/color_temp_command', 'color_temp_state_topic': 'tuya/<id>/23/color_temp_state', 'command_topic': 'tuya/<id>/23/command', 'payload_off': 'OFF', 'payload_on': 'ON', 'effect_command_topic': 'tuya/<id>/23/effect_command', 'effect_state_topic': 'tuya/<id>/23/effect_state', 'hs_command_topic': 'tuya/<id>/23/hs_command', 'hs_state_topic': 'tuya/<id>/23/hs_state', 'json_attributes_topic': 'tuya/<id>/23/attributes', 'rgb_command_topic': 'tuya/<id>/23/rgb_command', 'rgb_state_topic': 'tuya/<id>/23/rgb_state', 'state_topic': 'tuya/<id>/23/state', 'state_off': 'OFF', 'state_on': 'ON', 'white_value_command_topic': 'tuya/<id>/23/white_value_command', 'white_value_state_topic': 'tuya/<id>/23/white_value_state', 'xy_command_topic': 'tuya/<id>/23/xy_command', 'xy_state_topic': 'tuya/<id>/23/xy_state', 'unique_id': '<id>', 'device': {'identifiers': ['<id>'], 'name': 'Kelvin', 'model': 'Tuya', 'sw_version': '1.0.0', 'manufacturer': 'GismoCaster', 'via_device': 'Kitchen LED strip'}, 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/light/__init__.py", line 52, in async_discover config = PLATFORM_SCHEMA(discovery_payload) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 208, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 287, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 283, in _exec v = func(v) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data) File "/usr/src/homeassistant/homeassistant/components/mqtt/light/__init__.py", line 30, in validate_mqtt_light return schemas[value[CONF_SCHEMA]](value) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['state_off']
I can control manually via MQTT with tuya/<id>/20/command
ON
/OFF
.
I resolved the same previous error ending in@ data['icon']
by removing 'icon' from the chosen values list for the light component in gismocaster.
As far as I can tell, the rest of the values are valid?
For reference, here is my gismo model:
Which was based on the return from tuya-cli get
for this device:
dps: {
'20': false,
'21': 'white',
'22': 1000,
'23': 241,
'24': '00e103e803e8',
'25': '000e0d0000000000000000c80000',
'26': 0
}
'state_off': 'OFF',
'state_on': 'ON',
are not in spec. https://www.home-assistant.io/integrations/light.mqtt/
Thanks. I did see they weren't in the specs. 'state_off': 'OFF'
& 'state_on': 'ON'
are however part of the default state_topic installed with GismoCaster:
Is this intended? In what case would they be required?
Once I removed the above topic values the device was discovered in Home Assistant:
(This device is not functional - I expect this is due to incorrect config which I have not been able to correct yet.)
Is this intended? In what case would they be required?
Nope, apparently the HA component definition isn't as consistent as I thought. e.g. https://www.home-assistant.io/integrations/switch.mqtt/ could use state_on/off
as fallback from payload_on/off
To fix it the db model in gismocaster has to be changed to handle a m2m relation.
edit: I just noticed I added a "Specialized for" field in the topic definition. So to set it up correctly you should add an other state_topic - specialized for light, without the topic values. Then in the ha-model for light select the state_topic you've created and deselect the other one.