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.17k stars 30.2k forks source link

[ZHA] Integration randomly stops working, sits in 'initialising' state. #105445

Closed thefunkygibbon closed 9 months ago

thefunkygibbon commented 10 months ago

The problem

Every so often since the last week or so, I've been coming to use my zigbee lights and none being accessible. Checking the integration its either sitting in a failed state (failed to setup) or 'initialising'. have to restart HA to get it back up and running (can't restart zha if its initialising). and sometimes even after a reboot it starts up and zha must have restarted because i notice initialising again (after it had restarted properly)

What version of Home Assistant Core has the issue?

core-2023.12.1

What was the last working version of Home Assistant Core?

likely the last few builds ago, I feel its been happening for a little while before decembers release.

What type of installation are you running?

Home Assistant Container

Integration causing the issue

ZHA

Link to integration documentation on our website

No response

Diagnostics information

{ "home_assistant": { "installation_type": "Home Assistant Container", "version": "2023.12.1", "dev": false, "hassio": false, "virtualenv": false, "python_version": "3.11.6", "docker": true, "arch": "x86_64", "timezone": "Europe/London", "os_name": "Linux", "os_version": "6.1.0-0.deb11.11-amd64", "run_as_root": true }, "custom_components": { "webrtc": { "version": "v3.5.0", "requirements": [] }, "google_fit": { "version": "1.0.6", "requirements": [ "google-api-python-client==2.48.0", "oauth2client==4.1.3", "httplib2" ] }, "govee": { "version": "2023.11.1", "requirements": [ "govee-api-laggat==0.2.2", "dacite==1.8.0" ] }, "london_tfl": { "version": "0.1.4", "requirements": [] }, "ui_lovelace_minimalist": { "version": "v1.3.9", "requirements": [ "aiofiles==0.8.0", "aiogithubapi>=22.2.4" ] }, "garbage_collection": { "version": "4.10.2", "requirements": [ "python-dateutil>=2.8.2" ] }, "alarmo": { "version": "v1.9.13", "requirements": [] }, "ttlock": { "version": "v0.5.4", "requirements": [ "pydantic" ] }, "hikvision_next": { "version": "1.0.10", "requirements": [ "xmltodict==0.13.0", "hikvisionapi==0.3.2", "requests-toolbelt==0.10.1" ] }, "dwains_dashboard": { "version": "3.6.0", "requirements": [] }, "hass_agent": { "version": "2022.11.9", "requirements": [] }, "localtuya": { "version": "5.2.1", "requirements": [] }, "fullykiosk": { "version": "1.1.0", "requirements": [ "python-fullykiosk==0.0.11" ] }, "webhook_service": { "version": "0.1.0", "requirements": [] }, "govee_lan": { "version": "1.0.0", "requirements": [ "govee-led-wez>=0.0.15" ] }, "skodaconnect": { "version": "v1.2.6", "requirements": [ "skodaconnect>=1.3.7", "homeassistant>=2023.3.0" ] }, "adax": { "version": "0.4.3", "requirements": [ "adax" ] }, "govee_ble_hci": { "version": "0.10.2", "requirements": [ "bleson==0.1.8" ] }, "config_editor": { "version": "4.3", "requirements": [] }, "mass": { "version": "2023.2.2", "requirements": [] }, "mjpeg_timelapse": { "version": "2021.12.30", "requirements": [] }, "hacs": { "version": "1.33.0", "requirements": [ "aiogithubapi>=22.10.1" ] }, "presence_simulation": { "version": "3.2", "requirements": [] }, "google_geocode": { "version": "0.1.9", "requirements": [] }, "alexa_media": { "version": "4.7.9", "requirements": [ "alexapy==1.27.8", "packaging>=20.3", "wrapt>=1.14.0" ] }, "deebot": { "version": "3.0.0", "requirements": [ "deebot-client==4.0.0", "numpy>=1.23.2" ] }, "watchman": { "version": "0.5.1", "requirements": [ "prettytable==3.0.0" ] }, "omada": { "version": "0.4.0-beta.1", "requirements": [] }, "themeparks": { "version": "1.1.0", "requirements": [] }, "eufy_vacuum": { "version": "1.0.4", "requirements": [ "cryptography" ] }, "adaptive_lighting": { "version": "1.20.0", "requirements": [ "ulid-transform" ] }, "sonoff": { "version": "3.5.2", "requirements": [ "pycryptodome>=3.6.6" ] } }, "integration_manifest": { "domain": "zha", "name": "Zigbee Home Automation", "after_dependencies": [ "onboarding", "usb" ], "codeowners": [ "@dmulcahey", "@adminiuga", "@puddly", "@TheJulianJES" ], "config_flow": true, "dependencies": [ "file_upload" ], "documentation": "https://www.home-assistant.io/integrations/zha", "iot_class": "local_polling", "loggers": [ "aiosqlite", "bellows", "crccheck", "pure_pcapy3", "zhaquirks", "zigpy", "zigpy_deconz", "zigpy_xbee", "zigpy_zigate", "zigpy_znp", "universal_silabs_flasher" ], "requirements": [ "bellows==0.37.1", "pyserial==3.5", "pyserial-asyncio==0.6", "zha-quirks==0.0.107", "zigpy-deconz==0.22.0", "zigpy==0.60.0", "zigpy-xbee==0.20.0", "zigpy-zigate==0.12.0", "zigpy-znp==0.12.0", "universal-silabs-flasher==0.0.15", "pyserial-asyncio-fast==0.11" ], "usb": [ { "vid": "10C4", "pid": "EA60", "description": "2652", "known_devices": [ "slae.sh cc2652rb stick" ] }, { "vid": "1A86", "pid": "55D4", "description": "sonoffplus", "known_devices": [ "sonoff zigbee dongle plus v2" ] }, { "vid": "10C4", "pid": "EA60", "description": "sonoffplus", "known_devices": [ "sonoff zigbee dongle plus" ] }, { "vid": "10C4", "pid": "EA60", "description": "tubeszb", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "tubeszb", "known_devices": [ "TubesZB Coordinator" ] }, { "vid": "1A86", "pid": "7523", "description": "zigstar", "known_devices": [ "ZigStar Coordinators" ] }, { "vid": "1CF1", "pid": "0030", "description": "conbee", "known_devices": [ "Conbee II" ] }, { "vid": "0403", "pid": "6015", "description": "conbee", "known_devices": [ "Conbee III" ] }, { "vid": "10C4", "pid": "8A2A", "description": "zigbee", "known_devices": [ "Nortek HUSBZB-1" ] }, { "vid": "0403", "pid": "6015", "description": "zigate", "known_devices": [ "ZiGate+" ] }, { "vid": "10C4", "pid": "EA60", "description": "zigate", "known_devices": [ "ZiGate" ] }, { "vid": "10C4", "pid": "8B34", "description": "bv 2010/10", "known_devices": [ "Bitron Video AV2010/10" ] } ], "zeroconf": [ { "type": "_esphomelib._tcp.local.", "name": "tube" }, { "type": "_zigate-zigbee-gateway._tcp.local.", "name": "zigate" }, { "type": "_zigstar_gw._tcp.local.", "name": "zigstar" }, { "type": "_uzg-01._tcp.local.", "name": "uzg-01" }, { "type": "_slzb-06._tcp.local.", "name": "slzb-06*" } ], "is_built_in": true }, "data": { "config": { "device_config": { "00:0d:6f:00:10:86:fa:6f-1": { "type": "switch" } }, "enable_quirks": true }, "config_entry": { "entry_id": "5fb366dc2478313fb3cb2b29c52254af", "version": 4, "domain": "zha", "title": "socket://192.168.0.168:8888", "data": { "device": { "path": "socket://192.168.0.168:8888", "baudrate": 115200, "flow_control": "software" }, "radio_type": "ezsp" }, "options": { "custom_configuration": { "zha_options": { "consider_unavailable_mains": 800, "default_light_transition": 0, "enhanced_light_transition": false, "light_transitioning_flag": true, "always_prefer_xy_color_mode": true, "enable_identify_on_join": true, "consider_unavailable_battery": 21600, "group_members_assume_state": true } } }, "pref_disable_new_entities": false, "pref_disable_polling": false, "source": "user", "unique_id": null, "disabled_by": null }, "application_state": { "node_info": { "nwk": 0, "ieee": "REDACTED", "logical_type": 0, "model": null, "manufacturer": null, "version": "6.7.8.0 build 373" }, "network_info": { "extended_pan_id": "REDACTED", "pan_id": 7144, "nwk_update_id": 0, "nwk_manager_id": 0, "channel": 11, "channel_mask": 134215680, "security_level": 5, "network_key": "REDACTED", "tc_link_key": { "key": [ 90, 105, 103, 66, 101, 101, 65, 108, 108, 105, 97, 110, 99, 101, 48, 57 ], "tx_counter": 4464640, "rx_counter": 0, "seq": 0, "partner_ieee": "REDACTED" }, "key_table": [], "children": [], "nwk_addresses": {}, "stack_specific": {}, "metadata": { "ezsp": { "stack_version": 8, "can_burn_userdata_custom_eui64": true, "can_rewrite_custom_eui64": false } }, "source": "bellows@0.37.1" }, "counters": { "controller_app_counters": { "unicast_rx": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='unicast_rx', _raw_value=135, reset_count=0, _last_reset_value=0)" }, "unicast_tx_success": { "__type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='unicast_tx_success', _raw_value=113, reset_count=0, _last_reset_value=0)" }, "broadcast_tx_success_unexpected": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='broadcast_tx_success_unexpected', _raw_value=4, reset_count=0, _last_reset_value=0)" }, "unicast_tx_failure": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='unicast_tx_failure', _raw_value=126, reset_count=0, _last_reset_value=0)" }, "watchdog_reset_requests": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='watchdog_reset_requests', _raw_value=8, reset_count=0, _last_reset_value=0)" }, "broadcast_rx": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='broadcast_rx', _raw_value=4, reset_count=0, _last_reset_value=0)" }, "broadcast_tx_success": { "__type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='broadcast_tx_success', _raw_value=1, reset_count=0, _last_reset_value=0)" }, "unicast_tx_failure_unexpected": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='unicast_tx_failure_unexpected', _raw_value=1, reset_count=0, _last_reset_value=0)" } }, "ezsp_counters": { "MAC_RX_BROADCAST": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='MAC_RX_BROADCAST', _raw_value=1720, reset_count=0, _last_reset_value=0)" }, "MAC_TX_BROADCAST": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='MAC_TX_BROADCAST', _raw_value=277, reset_count=0, _last_reset_value=0)" }, "MAC_RX_UNICAST": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='MAC_RX_UNICAST', _raw_value=526, reset_count=0, _last_reset_value=0)" }, "MAC_TX_UNICAST_SUCCESS": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='MAC_TX_UNICAST_SUCCESS', _raw_value=370, reset_count=0, _last_reset_value=0)" }, "MAC_TX_UNICAST_RETRY": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='MAC_TX_UNICAST_RETRY', _raw_value=79, reset_count=0, _last_reset_value=0)" }, "MAC_TX_UNICAST_FAILED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='MAC_TX_UNICAST_FAILED', _raw_value=2, reset_count=0, _last_reset_value=0)" }, "APS_DATA_RX_BROADCAST": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_DATA_RX_BROADCAST', _raw_value=5, reset_count=0, _last_reset_value=0)" }, "APS_DATA_TX_BROADCAST": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_DATA_TX_BROADCAST', _raw_value=5, reset_count=0, _last_reset_value=0)" }, "APS_DATA_RX_UNICAST": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_DATA_RX_UNICAST', _raw_value=136, reset_count=0, _last_reset_value=0)" }, "APS_DATA_TX_UNICAST_SUCCESS": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_DATA_TX_UNICAST_SUCCESS', _raw_value=112, reset_count=0, _last_reset_value=0)" }, "APS_DATA_TX_UNICAST_RETRY": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_DATA_TX_UNICAST_RETRY', _raw_value=240, reset_count=0, _last_reset_value=0)" }, "APS_DATA_TX_UNICAST_FAILED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_DATA_TX_UNICAST_FAILED', _raw_value=119, reset_count=0, _last_reset_value=0)" }, "ROUTE_DISCOVERY_INITIATED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='ROUTE_DISCOVERY_INITIATED', _raw_value=64, reset_count=0, _last_reset_value=0)" }, "NEIGHBOR_ADDED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='NEIGHBOR_ADDED', _raw_value=16, reset_count=0, _last_reset_value=0)" }, "NEIGHBOR_REMOVED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='NEIGHBOR_REMOVED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "NEIGHBOR_STALE": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='NEIGHBOR_STALE', _raw_value=2, reset_count=0, _last_reset_value=0)" }, "JOIN_INDICATION": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='JOIN_INDICATION', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "CHILD_REMOVED": { "__type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='CHILD_REMOVED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "ASH_OVERFLOW_ERROR": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='ASH_OVERFLOW_ERROR', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "ASH_FRAMING_ERROR": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='ASH_FRAMING_ERROR', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "ASH_OVERRUN_ERROR": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='ASH_OVERRUN_ERROR', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "NWK_FRAME_COUNTER_FAILURE": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='NWK_FRAME_COUNTER_FAILURE', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "APS_FRAME_COUNTER_FAILURE": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_FRAME_COUNTER_FAILURE', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "UTILITY": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='UTILITY', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "APS_LINK_KEY_NOT_AUTHORIZED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_LINK_KEY_NOT_AUTHORIZED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "NWK_DECRYPTION_FAILURE": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='NWK_DECRYPTION_FAILURE', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "APS_DECRYPTION_FAILURE": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='APS_DECRYPTION_FAILURE', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "ALLOCATE_PACKET_BUFFER_FAILURE": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='ALLOCATE_PACKET_BUFFER_FAILURE', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "RELAYED_UNICAST": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='RELAYED_UNICAST', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PHY_TO_MAC_QUEUE_LIMIT_REACHED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PHY_TO_MAC_QUEUE_LIMIT_REACHED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PACKET_VALIDATE_LIBRARY_DROPPED_COUNT": { "__type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PACKET_VALIDATE_LIBRARY_DROPPED_COUNT', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "TYPE_NWK_RETRY_OVERFLOW": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='TYPE_NWK_RETRY_OVERFLOW', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PHY_CCA_FAIL_COUNT": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PHY_CCA_FAIL_COUNT', _raw_value=7, reset_count=0, _last_reset_value=0)" }, "BROADCAST_TABLE_FULL": { "__type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='BROADCAST_TABLE_FULL', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PTA_LO_PRI_REQUESTED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PTA_LO_PRI_REQUESTED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PTA_HI_PRI_REQUESTED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PTA_HI_PRI_REQUESTED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PTA_LO_PRI_DENIED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PTA_LO_PRI_DENIED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PTA_HI_PRI_DENIED": { "__type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PTA_HI_PRI_DENIED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PTA_LO_PRI_TX_ABORTED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PTA_LO_PRI_TX_ABORTED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "PTA_HI_PRI_TX_ABORTED": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='PTA_HI_PRI_TX_ABORTED', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "ADDRESS_CONFLICT_SENT": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='ADDRESS_CONFLICT_SENT', _raw_value=0, reset_count=0, _last_reset_value=0)" }, "EZSP_FREE_BUFFERS": { "type": "<class 'zigpy.state.Counter'>", "repr": "Counter(name='EZSP_FREE_BUFFERS', _raw_value=224, reset_count=0, _last_reset_value=0)" } } }, "broadcast_counters": {}, "device_counters": {}, "group_counters": {} }, "energy_scan": { "11": 65.26028270288712, "12": 46.26944564832987, "13": 55.9836862725909, "14": 68.14622793558128, "15": 65.26028270288712, "16": 73.50699819621309, "17": 92.0598007161209, "18": 94.48255331375627, "19": 89.93931580241996, "20": 98.43344238842926, "21": 99.92977369505088, "22": 99.93832932292418, "23": 99.94584318876281, "24": 99.88193396258131, "25": 98.21983128611214, "26": 75.96022321405563 }, "versions": { "bellows": "0.37.1", "zigpy": "0.60.0", "zigpy_deconz": "0.22.0", "zigpy_xbee": "0.20.0", "zigpy_znp": "0.12.0", "zigpy_zigate": "0.12.0", "zhaquirks": "0.0.107" } } }

Example YAML snippet

No response

Anything in the logs that might be useful for us?

from normal logs - 
Logger: homeassistant.components.zha.core.cluster_handlers
Source: components/zha/core/cluster_handlers/__init__.py:389
Integration: Zigbee Home Automation (documentation, issues)
First occurred: 13:16:25 (28 occurrences)
Last logged: 13:16:25

[0x4D7F:11:0x0006]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'sendUnicast'
[0x4D7F:11:0x0008]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'sendUnicast'
[0x4D7F:11:0x0300]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'sendUnicast'
[0x26FA:11:0x0006]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'sendUnicast'
[0x26FA:11:0x0008]: 'async_initialize' stage failed: 'NoneType' object has no attribute 'sendUnicast'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/zha/core/helpers.py", line 338, in wrapper
    return await func(cluster_handler, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 389, in async_initialize
    await self._get_attributes(
  File "/usr/src/homeassistant/homeassistant/components/zha/core/cluster_handlers/__init__.py", line 491, in _get_attributes
    read, _ = await self.cluster.read_attributes(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/zcl/__init__.py", line 524, in read_attributes
    result = await self.read_attributes_raw(to_read, manufacturer=manufacturer)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/zcl/__init__.py", line 377, in request
    return await self._endpoint.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/endpoint.py", line 253, in request
    return await self.device.request(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/zigpy/device.py", line 299, in request
    await self._application.request(
  File "/usr/local/lib/python3.11/site-packages/zigpy/application.py", line 824, in request
    await self.send_packet(
  File "/usr/local/lib/python3.11/site-packages/bellows/zigbee/application.py", line 767, in send_packet
    status, _ = await self._ezsp.sendUnicast(
                      ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'sendUnicast'

from debug logs:

2023-12-10 12:14:03.180 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback None()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 616, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 619, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: ''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1215, in _refresh
    self.hass.async_run_hass_job(self._job, event, updates)
  File "/usr/src/homeassistant/homeassistant/core.py", line 671, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 429, in _handle_results
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 751, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 623, in state
    raise ValueError(
ValueError: Sensor sensor.unavailable_entities has device class 'None', state class 'None' unit 'entities' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '' (<class 'str'>)
2023-12-10 12:18:25.399 DEBUG (MainThread) [pysmartapp.smartapp] e99b2505-68bb-f992-5fba-bac5fc402ae5: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:18:25.400 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': '1f2d6bcc-2cd2-8f95-9872-f2ac239b3189', 'component_id': 'main', 'capability': 'powerConsumptionReport', 'attribute': 'powerConsumption', 'value': {'energy': 953, 'deltaEnergy': 0, 'power': 2, 'powerEnergy': 0.22473916669686636, 'persistedEnergy': 0, 'energySaved': 0, 'persistedSavedEnergy': 0, 'start': '2023-12-10T12:04:56Z', 'end': '2023-12-10T12:18:25Z'}, 'data': {}}
2023-12-10 12:25:47.575 DEBUG (MainThread) [pysmartapp.smartapp] b0e3558a-da4c-395e-3900-797db35f3971: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:25:47.576 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': '70e415cd-c997-805a-cafe-6c93b6d1a668', 'component_id': 'main', 'capability': 'powerConsumptionReport', 'attribute': 'powerConsumption', 'value': {'energy': 0, 'deltaEnergy': 0.077778, 'power': 0, 'powerEnergy': 0, 'persistedEnergy': 0, 'energySaved': 0.0, 'persistedSavedEnergy': 0, 'start': '2023-12-10T12:11:03Z', 'end': '2023-12-10T12:25:47Z'}, 'data': {}}
2023-12-10 12:29:32.101 DEBUG (MainThread) [pysmartapp.smartapp] 7b02e8aa-4112-f028-3d02-68442a3fcbed: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:29:32.102 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': '1f2d6bcc-2cd2-8f95-9872-f2ac239b3189', 'component_id': 'main', 'capability': 'powerConsumptionReport', 'attribute': 'powerConsumption', 'value': {'energy': 956, 'deltaEnergy': 3, 'power': 75, 'powerEnergy': 0.3704450000656976, 'persistedEnergy': 0, 'energySaved': 0, 'persistedSavedEnergy': 0, 'start': '2023-12-10T12:18:25Z', 'end': '2023-12-10T12:29:31Z'}, 'data': {}}
2023-12-10 12:31:31.882 WARNING (MainThread) [homeassistant.helpers.service] Referenced entities alarm_control_panel.blink_blink_home are missing or not currently available
2023-12-10 12:33:19.923 DEBUG (MainThread) [pysmartapp.smartapp] f98bfa8b-18a3-41ef-9a9e-9b0c0b2f9502: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:33:19.925 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': 'c089e685-1815-420c-b11a-17a8038aa7d9', 'component_id': 'main', 'capability': 'motionSensor', 'attribute': 'motion', 'value': 'active', 'data': {}}
2023-12-10 12:33:50.128 DEBUG (MainThread) [pysmartapp.smartapp] f98bfa8b-18a3-41ef-9a9e-9b0c0b2f9502: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:33:50.129 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': 'c089e685-1815-420c-b11a-17a8038aa7d9', 'component_id': 'main', 'capability': 'motionSensor', 'attribute': 'motion', 'value': 'inactive', 'data': {}}
2023-12-10 12:35:03.216 ERROR (MainThread) [homeassistant] Error doing job: Exception in callback None()
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 616, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 619, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: ''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/event.py", line 1215, in _refresh
    self.hass.async_run_hass_job(self._job, event, updates)
  File "/usr/src/homeassistant/homeassistant/core.py", line 671, in async_run_hass_job
    hassjob.target(*args)
  File "/usr/src/homeassistant/homeassistant/components/template/template_entity.py", line 429, in _handle_results
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 745, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 845, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 786, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 751, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 623, in state
    raise ValueError(
ValueError: Sensor sensor.unavailable_entities has device class 'None', state class 'None' unit 'entities' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '' (<class 'str'>)
2023-12-10 12:42:08.807 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 350, in data_received
    messages, upgraded, tail = self._request_parser.feed_data(data)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "aiohttp/_http_parser.pyx", line 557, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message:
  Invalid method encountered:

    b'\x16\x03\x01'
      ^
2023-12-10 12:42:17.518 DEBUG (MainThread) [pysmartapp.smartapp] b3669740-6be0-0e11-9c37-65f56c4d9b90: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:42:17.519 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': '1f2d6bcc-2cd2-8f95-9872-f2ac239b3189', 'component_id': 'main', 'capability': 'contactSensor', 'attribute': 'contact', 'value': 'open', 'data': {}}
2023-12-10 12:42:17.614 DEBUG (MainThread) [pysmartapp.smartapp] b3669740-6be0-0e11-9c37-65f56c4d9b90: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:42:17.616 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': '1f2d6bcc-2cd2-8f95-9872-f2ac239b3189', 'component_id': 'onedoor', 'capability': 'contactSensor', 'attribute': 'contact', 'value': 'open', 'data': {}}
2023-12-10 12:42:19.593 DEBUG (MainThread) [pysmartapp.smartapp] a92925b9-470a-0a42-c71a-2da23ee597d7: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:42:19.594 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': '1f2d6bcc-2cd2-8f95-9872-f2ac239b3189', 'component_id': 'onedoor', 'capability': 'contactSensor', 'attribute': 'contact', 'value': 'closed', 'data': {}}
2023-12-10 12:42:19.693 DEBUG (MainThread) [pysmartapp.smartapp] a92925b9-470a-0a42-c71a-2da23ee597d7: EVENT received for installed app 275fa610-1887-412a-90ce-0abb02af049c.
2023-12-10 12:42:19.694 DEBUG (MainThread) [homeassistant.components.smartthings] Push update received: {'location_id': '6c8cd6ad-7093-4197-9c2f-0c65352f0409', 'device_id': '1f2d6bcc-2cd2-8f95-9872-f2ac239b3189', 'component_id': 'main', 'capability': 'contactSensor', 'attribute': 'contact', 'value': 'closed', 'data': {}}
2023-12-10 12:42:19.838 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140471589073600] Error handling message: Unknown error (unknown_error) Andrew Rossiter from 192.168.0.182 (Mozilla/5.0 (Linux; Android 14; SM-S918B Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/119.0.6045.193 Mobile Safari/537.36 Home Assistant/2023.11.2-11694 (Android 14; SM-S918B))
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/zha/websocket_api.py", line 1047, in websocket_get_configuration
    zha_gateway = get_zha_gateway(hass)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/helpers.py", line 458, in get_zha_gateway
    raise ValueError("No gateway object exists")
ValueError: No gateway object exists
2023-12-10 12:42:19.860 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140471589073600] Error handling message: Unknown error (unknown_error) Andrew Rossiter from 192.168.0.182 (Mozilla/5.0 (Linux; Android 14; SM-S918B Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/119.0.6045.193 Mobile Safari/537.36 Home Assistant/2023.11.2-11694 (Android 14; SM-S918B))
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/zha/websocket_api.py", line 1140, in websocket_get_network_settings
    backup = async_get_active_network_settings(hass)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/api.py", line 43, in async_get_active_network_settings
    app = get_zha_gateway(hass).application_controller
          ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/core/helpers.py", line 458, in get_zha_gateway
    raise ValueError("No gateway object exists")
ValueError: No gateway object exists

Additional information

Using a Sonoff Zigbee Bridge flashed with Tasmota zbbridge firmware. usually relatively up to date. 13.2.0 stable release currently but was running 13.2.0.3 dev build as of last night. Each time i've noticed the HA issue, I've checked the tasmota device and it was always working fine.

home-assistant[bot] commented 10 months ago

Hey there @dmulcahey, @adminiuga, @puddly, @thejulianjes, mind taking a look at this issue as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `zha` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign zha` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zha documentation zha source (message by IssueLinks)

cvermot commented 10 months ago

Hi, Same problem here, with Conbee 2 USB stick.

We can reload the ZHA intergration via Configure option. Zigbee devices works for somes minutes or hours... but the integration seems to lost his configuration after some times.

The problems has appeard some days ago (possibily with the last 2023.11 release ?). No more success after updating HA OS.

Here are my versions : Core 2023.12.1 Supervisor 2023.11.6 Operating System 11.2 Interface utilisateur 20231208.2

Problem seems duplicated here : https://github.com/home-assistant/core/issues/105449

thefunkygibbon commented 10 months ago

Yeah, it does feel like it started happening sometime at the end of the 2023.11 version.
I was errring on the side of getting a different zigbee controller (an ethernet one instead of wireless) but since this seems to be more of a widespread issue experienced by a few people now with differing zigbee controllers, I might as well stay on this until its sorted (although its frustrating that none of my devices work when i need them to. wife and kids are giving me a lot of grief over it!)

thanks for confirming

puddly commented 10 months ago

Can you include a complete debug log (https://www.home-assistant.io/integrations/zha/#debug-logging) of the integration starting up and failing after some time? It would help figure out what the issue is.

thefunkygibbon commented 10 months ago

I have a log which i started last night when i last rebooted because of this issue, and up until this afternoon about 1pm where i had noticed it had all stopped again. its rather large (320mb unzipped, 20mb zipped). any use?

thefunkygibbon commented 10 months ago

https://home.thefunkygibbon.net/log.zip

puddly commented 10 months ago

Done, thanks!

cvermot commented 10 months ago

Hi, Here are my logs. First file is from boot to log stop. Then I reactivate log, then the zigbee integration failed at 21:11:12 I guess (logging disappeared on a zigbee plug at this time) => second file

home-assistant_zha_2023-12-10T20-26-00.259Z.log home-assistant_zha_2023-12-10T19-57-29.793Z.log

puddly commented 10 months ago

@cvermot According to your logs, there is a second integration messing with serial ports:

2023-12-10 20:51:48.390 ERROR (/dev/ttyACM1 teleinfo updater) [serial_teleinfo.updater] Error while updating values : device reports readiness to read but returned no data (device disconnected or multiple access on port?)

ZHA interacting with the Conbee sees the same issue:

2023-12-10 20:51:39.163 DEBUG (MainThread) [zigpy.application] Connection to the radio has been lost: SerialException('device reports readiness to read but returned no data (device disconnected or multiple access on port?)')

Can you disable the integrating using the serial_teleinfo package (talks to Enedis energy meters)? It would be best to configure that integration to communicate to a /dev/serial/by-id/ symlink instead of the unstable /dev/ttyACM1 path. I suspect that /dev/ttyACM1 is actually the Conbee.

thefunkygibbon commented 9 months ago

I assume that serial stuff if not directed at me? is his the same issue as what I'm experiencing ? was anything given away from my logs?

cvermot commented 9 months ago

Thank you @puddly for your analyze. It seems that some are happy after updating to 2023.12.3 (https://github.com/home-assistant/core/issues/105449)... I tryed that.

Thank you for your advices about serial by-id. I will try that if I get any other disruptions and for any new serial device I connect to my HA.

thefunkygibbon commented 9 months ago

noticed the same issue occurred again last night, so it doesn't seem that it is resolved with 2023.12.3 for me :-(

thefunkygibbon commented 9 months ago

I'm not 100% on how to read that whole 'dependencies' thread, but has the issues root cause been determined yet and if so, is there an ETA to when the changes will be pushed to an update? my house has been an absolute nightmare for the family this last few weeks (I appreciate that there is no implied support with using HA, and fully appreciate that people are developing this out of love for home automation, I'm just trying to get an idea as if its going to be much longer, I might as well buy a new zigbee coordinator and migrate over to zigbee2mqtt)

puddly commented 9 months ago

The changes will be in 2023.12.4. When that will be released depends on peoples' schedules and not something I can tell you, it is the holidays after all, but probably in the next couple of days. You can downgrade to 2023.11.3 and upgrade when it's released.

Scharmen commented 9 months ago

Iam using the "SONOFF Zigbee 3.0 USB Dongle Plus" for me the issue is still there. No change with 2023.12.4

2023-12-31 12:51:47.850 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x510E:1:0x0006]: initializing cluster handler: from_cache: False
2023-12-31 12:51:47.850 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x510E:1:0x0006]: initializing cached cluster handler attributes: ['start_up_on_off']
2023-12-31 12:51:47.850 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x510E:1:0x0006]: Reading attributes in chunks: ['start_up_on_off']
2023-12-31 12:51:47.851 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x510E:1:0x0006]: initializing uncached cluster handler attributes: ['on_off'] - from cache[False]
2023-12-31 12:51:47.851 DEBUG (MainThread) [homeassistant.components.zha.core.cluster_handlers] [0x510E:1:0x0006]: Reading attributes in chunks: ['on_off']

Is it just an local Problem at my side ?

dmulcahey commented 9 months ago

Please try the current beta if you are having issues

Scharmen commented 9 months ago

2024.1 looks good to me :)

dmulcahey commented 9 months ago

The 2024.1 release had a bunch of fixes in it that should address stability. I am going to close this. If folks still have issues please open a new issue and provide full debug logs and completely fill out the issue template. Also, please don't piggy back other issues that are open unless the issue, error messages if there are any, and the hardware configuration for the coordinator are EXACTLY the same. Thanks!!

thefunkygibbon commented 9 months ago

looks like the issue has returned. not sure it if was relating to an update, but yesterday it started playing up again after a week or so of being fine.

thefunkygibbon commented 9 months ago

home-assistant_2024-01-07T14-16-18.283Z.log

config_entry-zha-5fb366dc2478313fb3cb2b29c52254af.json (1).txt

puddly commented 9 months ago

@thefunkygibbon can you open a new issue with another debug log showing the problem? The log you provided seems to contain only errors, which doesn't provide much context.