zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Homeassistant discovery fails on json attribute 'availability'.

Open wb441 opened this issue 3 years ago • 3 comments

What happened?

Hi there! I’m looking for someone who may be able to tell me where my mistake is. I have a docker-based setup managed through balenacloud.

Mosquitto Homeassistant Zigbee2mqtt I can't see the approx 15 devices I have in homeassistant. The issue I’m running into, is that homeassistant tells me that there is something wrong with the json that it receives when it tries to discover devices through MQTT. I paste here some messages from Home Assistant > Developer Tools > Logs

Log Details (ERROR)
Logger: homeassistant.util.logging
Source: util/logging.py:164
First occurred: 5:03:20 PM (64 occurrences)
Last logged: 5:03:21 PM

**Exception in async_discover_sensor when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'availability': [{'**topic': 'z2m/bridge/state'}], 'device': {'identifiers': ['zigbee2mqtt_0xa4c138a1ecd1ba34'], 'manufacturer': 'TuYa', 'model': 'Light controller (TS0502B)', 'name': 'RS7'}, 'enabled_by_default': False, 'entity_category': 'diagnostic', 'icon': 'mdi:signal', 'name': 'RS7 linkquality', 'state_class': 'measurement', 'state_topic': 'z2m/RS7', 'unique_id': '0xa4c138a1ecd1ba34_linkquality_z2m', 'unit_of_measurement': 'lqi', 'value_template': '{{ value_json.linkquality }}', 'platform': 'mqtt'},) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 79, in async_discover_sensor config = PLATFORM_SCHEMA(discovery_payload) 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['availability']**
**Exception in async_discover when dispatching 'mqtt_discovery_new_light_mqtt': ({'availability': [{'topic': 'z2m/bridge/state'}],** 'brightness': True, 'brightness_scale': 254, 'color_mode': True, 'command_topic': 'z2m/RS8/set', 'device': {'identifiers': ['zigbee2mqtt_0xa4c1389ac4f2c2ce'], 'manufacturer': 'TuYa', 'model': 'Light controller (TS0502B)', 'name': 'RS8'}, 'effect': True, 'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'finish_effect', 'stop_effect'], 'max_mireds': 500, 'min_mireds': 153, 'name': 'RS8', 'schema': 'json', 'state_topic': 'z2m/RS8', 'supported_color_modes': ['color_temp'], 'unique_id': '0xa4c1389ac4f2c2ce_light_z2m', '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['availability']**

There are about 60 of these messages. Since homeassistant gets the messages in, it means that broker and the two clients are communicating to some degree. It seems homeassistant takes issue with the ‘availability’ topic that is given by zigbee2mqtt. However, I spent a good few hours researching the problem (it’s not this, nor this), and I don’t know how to solve it.

I disabled the legacy attribute stuff in the zigbee2mqtt configuration, but no dice.

Anyone who knows where I’m going wrong?

What did you expect to happen?

Discovery of the devices in Homeassistant for interacting with them from there.

How to reproduce it (minimal and precise)

Installation of Mosquitto, home assistant and zigbee2mqtt as a docker stack via balena.

Zigbee2MQTT version

1.29.2 commit: bb3e8f6

Adapter firmware version

20220219

Adapter

Electrolama

Debug log

.

wb441 avatar Jan 25 '23 17:01 wb441

I also see this message: image

wb441 avatar Jan 25 '23 17:01 wb441

My first guess is that you are using an outdated Home Assistant versoin.

Koenkk avatar Jan 26 '23 15:01 Koenkk

Absolutely right: Home Assistant 0.110.3

wb441 avatar Jan 26 '23 17:01 wb441