home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
72.65k stars 30.41k forks source link

Exception in async_discover #128802

Open yolkhovyy opened 4 hours ago

yolkhovyy commented 4 hours ago

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

mib1185 commented 3 hours ago

Hi @yolkhovyy zigbee2mqtt is a custom component, which is not maintained by the HA core project. Please report your issue to the maintainer or in the source repository of this custom component. Thx 👍

yolkhovyy commented 3 hours ago

This is an exception in home assistant

On Sat, Oct 19, 2024, 22:44 Michael @.***> wrote:

Hi @yolkhovyy https://github.com/yolkhovyy zigbee2mqtt is a custom component, which is not maintained by the HA core project. Please report your issue to the maintainer or in the source repository of this custom component. Thx 👍

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424201806, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5H64OHULQGGJM3K66LZ4LABLAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGIYDCOBQGY . You are receiving this because you were mentioned.Message ID: @.***>

mib1185 commented 3 hours ago

All devices on zigbee2mqtt are gone, see the screenshot.

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

based on this, i've to guess that you did not have updated HA right before the issue happens, therefore it is most likely an issue elsewhere, which causes these issues.

yolkhovyy commented 3 hours ago

It was 2022-something

On Sat, Oct 19, 2024, 23:11 Michael @.***> wrote:

All devices on zigbee2mqtt are gone, see the screenshot.

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

based on this, i've to guess that you did not have updated HA right before the issue happens, therefore it is most likely an issue elsewhere, which causes these issues.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424212619, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5D5HFZ5CPSQEWE2AJDZ4LDHZAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGIYTENRRHE . You are receiving this because you were mentioned.Message ID: @.***>

yolkhovyy commented 3 hours ago

It was 2022-something, then it stopped working, all devices on zigbee2mqtt were gone, then I upgraded to 2024, did not help, observing this exception in HA

If I try 2022 again - the same exception

On Sat, Oct 19, 2024, 23:16 Yuriy Olkhovyy @.***> wrote:

It was 2022-something

On Sat, Oct 19, 2024, 23:11 Michael @.***> wrote:

All devices on zigbee2mqtt are gone, see the screenshot.

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

based on this, i've to guess that you did not have updated HA right before the issue happens, therefore it is most likely an issue elsewhere, which causes these issues.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424212619, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5D5HFZ5CPSQEWE2AJDZ4LDHZAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGIYTENRRHE . You are receiving this because you were mentioned.Message ID: @.***>

mib1185 commented 2 hours ago

It was 2022-something

do you really mean an 2 years older release?

If I try 2022 again - the same exception

so maybe the issue is not home-assistant caused?

yolkhovyy commented 2 hours ago

It's an exception in home assistant, what do you mean with somewhere else?

On Sat, Oct 19, 2024, 23:56 Michael @.***> wrote:

It was 2022-something

do you really mean an 2 years older release?

If I try 2022 again - the same exception

so maybe the issue is not home-assistant caused?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424231135, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5DRKEWAT73SBOI4JMDZ4LIQTAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGIZTCMJTGU . You are receiving this because you were mentioned.Message ID: @.***>

mib1185 commented 2 hours ago

Sure, this is an exception, which is raised by HA, but you are using a custom component zigbee2mqtt which sends data trough the mqtt integration into HA - so if these data has changed or are malformed or what else, it might cause HA to raise this exceptions. Based on the error message string value is None for dictionary value @ data['name'] i strongly guess, these send data are malformed or incomplete. Since we still did not finally clarify, if this behavior is directly related to any HA core update or an update of this custom component, everything here is just guessing, which is not conducive.

yolkhovyy commented 2 hours ago

I tried older versions of zigbee2mqtt, all the way to 1.30.2 - the same exception

If this of any help - things broke when I enabled one of hidden entities in a ZigBee device.

On Sun, Oct 20, 2024, 00:10 Michael @.***> wrote:

Sure, this is an exception, which is raised by HA, but you are using a custom component zigbee2mqtt which sends data trough the mqtt integration into HA - so if these data has changed or are malformed or what else, it might cause HA to raise this exceptions. Based on the error message string value is None for dictionary value @ data['name'] i strongly guess, these send data are malformed or incomplete. Since we still did not finally clarify, if this behavior is directly related to any HA core update or an update of this custom component, everything here is just guessing, which is not conducive.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424235180, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5DPB5U6FN3DIUXZGLTZ4LKENAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGIZTKMJYGA . You are receiving this because you were mentioned.Message ID: @.***>

mib1185 commented 2 hours ago

I tried older versions of zigbee2mqtt, all the way to 1.30.2 - the same exception

ok, so the issue is not related to an HA core update?

hings broke when I enabled one of hidden entities in a ZigBee device.

please elaborate this much more detailed - what device exactly?

yolkhovyy commented 2 hours ago

Sorry, clarification - not 1.30.2, but 1.39.0

On Sun, Oct 20, 2024, 00:19 Yuriy Olkhovyy @.***> wrote:

I tried older versions of zigbee2mqtt, all the way to 1.30.2 - the same exception

If this of any help - things broke when I enabled one of hidden entities in a ZigBee device.

On Sun, Oct 20, 2024, 00:10 Michael @.***> wrote:

Sure, this is an exception, which is raised by HA, but you are using a custom component zigbee2mqtt which sends data trough the mqtt integration into HA - so if these data has changed or are malformed or what else, it might cause HA to raise this exceptions. Based on the error message string value is None for dictionary value @ data['name'] i strongly guess, these send data are malformed or incomplete. Since we still did not finally clarify, if this behavior is directly related to any HA core update or an update of this custom component, everything here is just guessing, which is not conducive.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424235180, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5DPB5U6FN3DIUXZGLTZ4LKENAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGIZTKMJYGA . You are receiving this because you were mentioned.Message ID: @.***>

mib1185 commented 1 hour ago

at the moment, i'm still on the point as already stated in https://github.com/home-assistant/core/issues/128802#issuecomment-2424201806 - you've to report this issue to the maintainers/project/repository of zigbee2mqtt

yolkhovyy commented 1 hour ago

could you please elaborate what issue is supposed to be reported to zigbee2mqtt?

On Sun, Oct 20, 2024, 00:28 Michael @.***> wrote:

at the moment, i'm still on the point as already stated in #128802 (comment) https://github.com/home-assistant/core/issues/128802#issuecomment-2424201806

  • you've to report this issue to the maintainers/project/repository of zigbee2mqtt

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424247788, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5CWOSP62HRT5X5UJ4TZ4LMHBAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGI2DONZYHA . You are receiving this because you were mentioned.Message ID: @.***>

yolkhovyy commented 1 hour ago

If this helps, please see attachment

On Sun, Oct 20, 2024, 00:41 Yuriy Olkhovyy @.***> wrote:

could you please elaborate what issue is supposed to be reported to zigbee2mqtt?

On Sun, Oct 20, 2024, 00:28 Michael @.***> wrote:

at the moment, i'm still on the point as already stated in #128802 (comment) https://github.com/home-assistant/core/issues/128802#issuecomment-2424201806

  • you've to report this issue to the maintainers/project/repository of zigbee2mqtt

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/128802#issuecomment-2424247788, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHUR5CWOSP62HRT5X5UJ4TZ4LMHBAVCNFSM6AAAAABQHYSJTSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRUGI2DONZYHA . You are receiving this because you were mentioned.Message ID: @.***>