Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datetime without timezone exceptions with HA 12.0 #35

Closed
realthk opened this issue Dec 12, 2021 · 5 comments
Closed

Datetime without timezone exceptions with HA 12.0 #35

realthk opened this issue Dec 12, 2021 · 5 comments

Comments

@realthk
Copy link

realthk commented Dec 12, 2021

Workaround

Add report_meta time:iso:tz:local to each configuration file as suggested at merbanan/rtl_433#1904 (comment)

Original Issue

Few minutes after upgrading to Home Assistant Core 12.0, the log is full with (hundreds) of exceptions because timestamps from RTL 433 sensors do not include timezone.
I guess this could something to do with this change in HA

2021-12-11 23:49:43 ERROR (MainThread) [homeassistant.components.sensor] Error adding entities for domain sensor with platform mqtt
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 613, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in add_to_platform_finish
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/sensor/__init__.py", line 411, in state
raise ValueError(
ValueError: Invalid datetime: sensor.auriol_hg02832_1_89_utc provides state '2021-12-11 23:49:23', which is missing timezone information

2021-12-11 23:49:43 ERROR (MainThread) [homeassistant.util.logging] Exception in message_received when handling msg on 'rtl_433/9b13b3f4-rtl433/devices/Fineoffset-WH0530/36/time': '2021-12-11 23:49:20'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/mqtt/debug_info.py", line 37, in wrapper
msg_callback(msg)
File "/usr/src/homeassistant/homeassistant/components/mqtt/sensor.py", line 249, in message_received
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/sensor/__init__.py", line 411, in state
raise ValueError(
ValueError: Invalid datetime: sensor.fineoffset_wh0530_36_utc provides state '2021-12-11 23:49:20', which is missing timezone information
@deviantintegral
Copy link
Collaborator

I see this as well. I don't see an existing issue at https://github.com/merbanan/rtl_433/issues, but we should at least get a PR up fixing this and then we can patch it in the addon until a new release is made.

I'm going to file an issue now.

@deviantintegral
Copy link
Collaborator

Filed merbanan/rtl_433#1904

@deviantintegral deviantintegral pinned this issue Dec 12, 2021
@realthk
Copy link
Author

realthk commented Dec 13, 2021

Thanks, that workaround you've inserted above solves the problem indeed!

@realthk realthk closed this as completed Dec 13, 2021
@deviantintegral
Copy link
Collaborator

I appreciate you closing this, but I'm going to re-open because I'd like to get this improved upstream and then update the copy we include in the container. Spamming logs out of the box isn't a great experience for new users!

I've got some time off coming up and will hopefully get an hour or two to work on this. If anyone wants to work ahead and file a PR for merbanan/rtl_433#1904 please feel free to mention me for reviews and testing.

@deviantintegral
Copy link
Collaborator

This is merged and will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants