Closed tobi-bo closed 3 years ago
Hi @tobi-bo thanks for reporting this issue.
Fan, room and speed are indeed not in the Diffuser data on init, other properties can possibly return wrong/other data (types). It is up to the user of the library to retrieve all data before using these properties. We don't do this by default because not everyone will need this.
Docs: https://github.com/milanmeu/pyrituals/blob/main/README.md#diffuser-data
The docs don't provide more information about which properties are affected because this has changed in the past and can easily be change again (without affecting the official app).
I have seen similar errors in my test environment and located the issue but I haven't implemented a solution yet.
@tobi-bo, please open a new issue in home-assistant/core as the issue is not in the package and so other Home Assistant users can easily find it. Please mention this issue in the new core issue.
I will try to implement a solution for this before 30 Juli (I don't have my diffuser with me on vacation).
Thanks for the detailed issue description @tobi-bo.
I am closing this issue here as it is in the Home Assistant integration not in the pyrituals package. If you are experiencing this or the related ValueError: 'fanc'
exception please report it to the downstream software and mention this issue.
Hi @milanmeu thanks for your quick response.
@tobi-bo, please open a new issue in home-assistant/core as the issue is not in the package and so other Home Assistant users can easily find it. Please mention this issue in the new core issue.
Please let me know if you want me to create a new issue.
This original issue seems to be the right place to inform you that this issue is still around in HA 2021.12.7. Pollutes my HA error log with a stacktrace each few minutes.
I have no way to suppress this specific error, because it is not catched and handled by homeassistant main code.
2021-12-31 13:35:03 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 134, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 265, in _async_refresh
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 325, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 505, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _async_write_ha_state
state = self._stringify_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 511, in _stringify_state
if (state := self.state) is None:
File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 147, in state
return self.value
File "/usr/src/homeassistant/homeassistant/components/rituals_perfume_genie/number.py", line 53, in value
return self._diffuser.perfume_amount
File "/usr/local/lib/python3.9/site-packages/pyrituals/__init__.py", line 91, in perfume_amount
return int(self.hub_data["attributes"]["speedc"])
ValueError: invalid literal for int() with base 10: ''
In HomeAssistant integration, which uses this library, I get the following error:
Versions: Home Assistant: 2021.7.2 pyrituals: 0.0.4
My guess: Either the speedc attribute is incorrect or it is not filled in all cases.