Setup failure
Closed this issue · 16 comments
The light bulbs with EchonetLite control suddenly became unresponsive.
So I updated Home Assistant to 2023.09.2 and the Operating System to 10.5. ]
After updating Echonet Lite to the latest version as well, I encountered the following error, resulting in a "Setup failure".
Please help.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 591, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: 'unavailable'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1002, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 593, in state
raise ValueError(
ValueError: Sensor sensor.store_humidity has device class 'humidity', state class 'measurement' unit '%' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unavailable' (<class 'str'>)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/init.py", line 241, in async_setup_entry
await echonetlite.async_update()
File "/config/custom_components/echonetlite/init.py", line 434, in async_update
return await self.async_update_data(kwargs=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/init.py", line 441, in async_update_data
batch_data = await self._instance.update(flags, no_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/EchonetInstance.py", line 122, in update
response = await self._api.echonetMessage(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/echonetapiclient.py", line 202, in echonetMessage
await asyncio.sleep(0.1)
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 639, in sleep
return await future
^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Global task timeout
Thank you for letting us know. It seems that if the value cannot be obtained with the sensor component, it is necessary to return None
instead of the string ”unavailable", so I will correct this.
I committed to the Master branch. The corrections will be reflected by selecting Master in the version selection in Redownload of HACS, re-downloading, and restarting HA. Could you try it?
I committed to the Master branch. The corrections will be reflected by selecting Master in the version selection in Redownload of HACS, re-downloading, and restarting HA. Could you try it?
Thank you for your reply and prompt response.
I have re-downloaded master and restarted HA as you instructed, but I still get the same error. :(
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 591, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: 'unavailable'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1002, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 730, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 830, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 771, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 593, in state
raise ValueError(
ValueError: Sensor sensor.store_humidity has device class 'humidity', state class 'measurement' unit '%' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'unavailable' (<class 'str'>)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/__init__.py", line 241, in async_setup_entry
await echonetlite.async_update()
File "/config/custom_components/echonetlite/__init__.py", line 434, in async_update
return await self.async_update_data(kwargs=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/__init__.py", line 441, in async_update_data
batch_data = await self._instance.update(flags, no_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/EchonetInstance.py", line 122, in update
response = await self._api.echonetMessage(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/echonetapiclient.py", line 202, in echonetMessage
await asyncio.sleep(0.1)
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 639, in sleep
return await future
^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Global task timeout
This error log is an error related to the setup of sensor.store_humidity
. Does that entity belong to the light bulbs in question?
Also, could you please confirm that this fix has been applied to your HA source?
- custom_components/echonetlite/sensor.py
bb0c2a7#diff-e82565bd3ee78c190e10f8e620df9a97630dfb81dc19fd88f2aeefedc785586d
Sorry, it appears that I was looking at the wrong log.
The following is the correct log.
I also checked the sensor.py and it seems that it has been applied correctly.
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 399, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/__init__.py", line 241, in async_setup_entry
await echonetlite.async_update()
File "/config/custom_components/echonetlite/__init__.py", line 434, in async_update
return await self.async_update_data(kwargs=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/__init__.py", line 441, in async_update_data
batch_data = await self._instance.update(flags, no_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/EchonetInstance.py", line 122, in update
response = await self._api.echonetMessage(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/echonetapiclient.py", line 202, in echonetMessage
await asyncio.sleep(0.1)
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 639, in sleep
return await future
^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Global task timeout
It is difficult to determine the cause of the error based on the error message you submitted. Are there any other error messages such as "Unable to configure''?
There is usually some message before "Traceback...".
Could be a Home Assistant wide issue related to error handling of the event loop. Maybe something about asyncio has changed in Python 3.11.
home-assistant/core#99795
home-assistant/core#99421
Im guessing that maybe a better way of handling time outs is needed if there are no packets returned? But it fired on asyncio.sleep which is odd.
https://stackoverflow.com/questions/74718086/how-to-handle-timeout-exception-by-the-asyncio-task-itself-just-before-asyncio-r
[ja]度々すみません。
つたない英語で説明において不明瞭な点があり、お手数をおかけしてしまい申し訳ございませんでした。
正確にお伝えすると、Panasonicのアドバンスシリーズの照明のスイッチを、MKN7531をHAに統合して使っています。
3日程前に、照明スイッチのEntityの操作が突如として使用ができなくなる現象が発生しました。
この問題が解決できないか、HAのアップデートをしましたがそれでも操作が出来ない状態が続いています。
アップデート前からこのEntityは正常に動作していたので、アップデートそのものの不具合によるものではないのかもしれません。[/ja]
Google translate...
Sorry again.
I apologize for any inconvenience caused due to my poor English and some unclear explanations.
To be more precise, I am using Panasonic's Advanced Series lighting switch with MKN7531 integrated into the HA.
Three days ago, a phenomenon occurred where the light switch entity suddenly became unusable.
I tried updating the HA to see if this problem could be resolved, but I am still unable to operate it.
This Entity was working properly before the update, so it may not be a problem with the update itself.
Does your lighting system use a DHCP-assigned IP address? Perhaps that has changed?
照明システムは DHCP によって割り当てられた IP アドレスを使用していますか? おそらくそれは変わったでしょうか?
When I set up MoekadenRoom for testing, intentionally stopped MoekadenRoom, and restarted HA, I was able to get an error similar to this problem.
From this, it is assumed that the device cannot be connected. Please check the LAN connection status of MKN7531 and the link status of the switches.
Also, as scottyphillips says, the IP address of your echonet-lite device may have changed. If the IP address has changed, try removing the device and adding it again.
Currently, this integration does not support changes in the device's IP address, so I recommend setting a static IP for the echonet-lite device on the DHCP server.
Logger: homeassistant.config_entries
Source: custom_components/echonetlite/__init__.py:441
Integration: ECHONETLite ([documentation](https://www.github.com/scottyphillips/echonetlite_homeassistant), [issues](https://github.com/scottyphillips/echonetlite_homeassistant/issues))
First occurred: 23:49:48 (1 occurrences)
Last logged: 23:49:48
Error setting up entry Moekaden for echonetlite
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/__init__.py", line 241, in async_setup_entry
await echonetlite.async_update()
File "/config/custom_components/echonetlite/__init__.py", line 434, in async_update
return await self.async_update_data(kwargs=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/echonetlite/__init__.py", line 441, in async_update_data
batch_data = await self._instance.update(flags, no_request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/EchonetInstance.py", line 122, in update
response = await self._api.echonetMessage(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/pychonet/echonetapiclient.py", line 202, in echonetMessage
await asyncio.sleep(0.1)
File "/usr/local/lib/python3.11/asyncio/tasks.py", line 639, in sleep
return await future
^^^^^^^^^^^^
asyncio.exceptions.CancelledError: Global task timeout
When I set up MoekadenRoom for testing, intentionally stopped MoekadenRoom, and restarted HA, I was able to get an error similar to this problem.
From this, it is assumed that the device cannot be connected. Please check the LAN connection status of MKN7531 and the link status of the switches.
Also, as scottyphillips says, the IP address of your echonet-lite device may have changed. If the IP address has changed, try removing the device and adding it again.
Currently, this integration does not support changes in the device's IP address, so I recommend setting a static IP for the echonet-lite device on the DHCP server.
Logger: homeassistant.config_entries Source: custom_components/echonetlite/__init__.py:441 Integration: ECHONETLite ([documentation](https://www.github.com/scottyphillips/echonetlite_homeassistant), [issues](https://github.com/scottyphillips/echonetlite_homeassistant/issues)) First occurred: 23:49:48 (1 occurrences) Last logged: 23:49:48 Error setting up entry Moekaden for echonetlite Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/echonetlite/__init__.py", line 241, in async_setup_entry await echonetlite.async_update() File "/config/custom_components/echonetlite/__init__.py", line 434, in async_update return await self.async_update_data(kwargs=kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/echonetlite/__init__.py", line 441, in async_update_data batch_data = await self._instance.update(flags, no_request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pychonet/EchonetInstance.py", line 122, in update response = await self._api.echonetMessage( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/pychonet/echonetapiclient.py", line 202, in echonetMessage await asyncio.sleep(0.1) File "/usr/local/lib/python3.11/asyncio/tasks.py", line 639, in sleep return await future ^^^^^^^^^^^^ asyncio.exceptions.CancelledError: Global task timeout
Thank you so much for trying everything.
You are right, it seems that the IP address of the MKN7531 device has changed from the one at the time of integration with HA.
I fixed the IP and re-integrated with HA and now it works fine.
I am ashamed that I neglected to suspect it first, I am very sorry for the trouble.
Once again, thank you for developing such a wonderful module.
P.S. From your name, naopon, I instantly assumed that you are Japanese. Thank you very much for your polite reply in Japanese. :D
@nao-pon we probably should keep this open and come up with a nicer way to handle that exception when a device is unresponsive.
@scottyphillips I agree. First, start by making notes of information that will serve as a reference.
- https://developers.home-assistant.io/docs/integration_setup_failures/#integrations-using-async_setup_entry
- https://developers.home-assistant.io/docs/config_entries_index/
If the component tracks the IP address and detects a change, I think we can migrate as is by rewriting the config_entry and trying the setup again.
@scottyphillips I started implementing automatic reloading when the device is unreachable and automatic tracking of IP address changes.
I done. I will continue testing for a while. Please verify if possible.