core icon indicating copy to clipboard operation
core copied to clipboard

Exception in async_discover

Open yolkhovyy opened this issue 1 year ago • 16 comments

Screenshot_2024-10-19-22-01-53-512_io homeassistant companion android-edit

The problem

All devices on zigbee2mqtt are gone, see the screenshot.

Log, when renaming a device in zigbee2mqtt (1.40.2):

2024-10-19 19:37:58.251 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.power_on_behavior }}'
2024-10-19 19:37:58.263 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: , template: {{ value_json.power_on_behavior }})
2024-10-19 19:37:58.267 ERROR (MainThread) [homeassistant.components.mqtt.select] Invalid option for select.bedroom_ceiling_lamp_power_on_behavior: '' (valid options: ['off', 'on', 'toggle', 'previous'])
2024-10-19 19:37:58.602 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'value_json' is undefined when rendering '{{ value_json.state }}'
2024-10-19 19:37:58.606 ERROR (MainThread) [homeassistant.helpers.template] Error parsing value: 'value_json' is undefined (value: , template: {{ value_json.state }})
2024-10-19 19:38:00.656 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_light_mqtt': ({'availability': [{'topic': 'zigbee2mqtt/bridge/state', 'value_template': '{{ value_json.state }}'}, {'topic': 'zigbee2mqtt/bedroom_ceiling/availability', 'value_template': '{{ value_json.state }}'}], 'availability_mode': 'all', 'brightness': True, 'brightness_scale': 254, 'command_topic': 'zigbee2mqtt/bedroom_ceiling/set', 'device': {'identifiers': ['zigbee2mqtt_0x*************'], 'manufacturer': 'Philips', 'model': 'Hue white A60 bulb E27 bluetooth (**********)', 'name': 'bedroom_ceiling', 'sw_version': '1.116.5', 'via_device': 'zigbee2mqtt_bridge_0x***************'}, 'effect': True, 'effect_list': ['blink', 'breathe', 'okay', 'channel_change', 'candle', 'finish_effect', 'stop_effect', 'stop_hue_effect'], 'name': None, 'object_id': 'bedroom_ceiling', 'origin': {'name': 'Zigbee2MQTT', 'sw': '1.40.2', 'url': 'https://www.zigbee2mqtt.io'}, 'schema': 'json', 'state_topic': 'zigbee2mqtt/bedroom_ceiling', 'unique_id': '0x************_light_zigbee2mqtt', 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 328, in async_discover
    config: DiscoveryInfoType = discovery_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/src/homeassistant/homeassistant/components/mqtt/light/__init__.py", line 44, in validate_mqtt_light_discovery
    config: ConfigType = schemas[config_value[CONF_SCHEMA]](config_value)
  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: string value is None for dictionary value @ data['name']

2024-10-19 19:38:00.724 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_binary_sensor_mqtt': ({'availability': [{'topic': 'zigbee2mqtt/bridge/state', 'value_template': '{{ value_json.state }}'}, {'topic': 'zigbee2mqtt/bedroom_ceiling/availability', 'value_template': '{{ value_json.state }}'}], 'availability_mode': 'all', 'device': {'identifiers': ['zigbee2mqtt_0x***********'], 'manufacturer': 'Philips', 'model': 'Hue white A60 bulb E27 bluetooth (****************)', 'name': 'bedroom_ceiling', 'sw_version': '1.116.5', 'via_device': 'zigbee2mqtt_bridge_0x*************'}, 'device_class': 'update', 'enabled_by_default': False, 'entity_category': 'diagnostic', 'name': None, 'object_id': 'bedroom_ceiling_update_available', 'origin': {'name': 'Zigbee2MQTT', 'sw': '1.40.2', 'url': 'https://www.zigbee2mqtt.io'}, 'payload_off': False, 'payload_on': True, 'state_topic': 'zigbee2mqtt/bedroom_ceiling', 'unique_id': '0x************_update_available_zigbee2mqtt', 'value_template': '{{ value_json[\'update\'][\'state\'] == "available" }}', 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 328, in async_discover
    config: DiscoveryInfoType = discovery_schema(discovery_payload)
  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: string value is None for dictionary value @ data['name']

2024-10-19 19:38:00.753 ERROR (MainThread) [homeassistant.util.logging] Exception in async_discover when dispatching 'mqtt_discovery_new_update_mqtt': ({'availability': [{'topic': 'zigbee2mqtt/bridge/state', 'value_template': '{{ value_json.state }}'}, {'topic': 'zigbee2mqtt/bedroom_ceiling/availability', 'value_template': '{{ value_json.state }}'}], 'availability_mode': 'all', 'command_topic': 'zigbee2mqtt/bridge/request/device/ota_update/update', 'device': {'identifiers': ['zigbee2mqtt_0x************'], 'manufacturer': 'Philips', 'model': 'Hue white A60 bulb E27 bluetooth (***********)', 'name': 'bedroom_ceiling', 'sw_version': '1.116.5', 'via_device': 'zigbee2mqtt_bridge_0x************'}, 'device_class': 'firmware', 'entity_category': 'config', 'entity_picture': 'https://github.com/Koenkk/zigbee2mqtt/raw/master/images/logo.png', 'json_attributes_template': '{"in_progress": {{ iif(value_json[\'update\'][\'state\'] == \'updating\', \'true\', \'false\') }} }', 'json_attributes_topic': 'zigbee2mqtt/bedroom_ceiling', 'latest_version_template': "{{ value_json['update']['latest_version'] }}", 'latest_version_topic': 'zigbee2mqtt/bedroom_ceiling', 'name': None, 'object_id': 'bedroom_ceiling', 'origin': {'name': 'Zigbee2MQTT', 'sw': '1.40.2', 'url': 'https://www.zigbee2mqtt.io'}, 'payload_install': '{"id": "0x**************"}', 'state_topic': 'zigbee2mqtt/bedroom_ceiling', 'unique_id': '0x**************_update_zigbee2mqtt', 'value_template': "{{ value_json['update']['installed_version'] }}", 'platform': 'mqtt'},)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/mqtt/mixins.py", line 328, in async_discover
    config: DiscoveryInfoType = discovery_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: string value is None for dictionary value @ data['name']

What version of Home Assistant Core has the issue?

core-2024.10.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

MQTT

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

All devices on zigbee2mqtt are gone, reinstalling MQTT integration did not help

yolkhovyy avatar Oct 19 '24 19:10 yolkhovyy