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

Error adding entities for domain sensor with platform flagdays_dk #4

Open
tsvane opened this issue Apr 11, 2023 · 0 comments
Open

Error adding entities for domain sensor with platform flagdays_dk #4

tsvane opened this issue Apr 11, 2023 · 0 comments

Comments

@tsvane
Copy link

tsvane commented Apr 11, 2023

I am trying to add birthdays from Anniversaries integration but i end up with an error when HA is initializing flagdays_dk.

TypeError: can't compare offset-naive and offset-aware datetimes

Am i doing something wrong or is this an unsupported configuration?

configuration.yaml

flagdays_dk:
  flagdays:
    - sensor.birthday_tobias_fodselsdag
  attribute_names:
    - next_date

The sensor data from Anniversaries integration has the following format

attribution: Sensor data calculated by Anniversaries Integration
years_at_anniversary: 37
current_years: 36
date: '1986-07-01T00:00:00+02:00'
next_date: '2023-07-01T00:00:00+02:00'
weeks_remaining: 11
unit_of_measurement: dage
icon: mdi:cake-variant
friendly_name: Tobias

When restarting HA i get the following error from flagdays_dk integration

Logger: homeassistant.components.sensor
Source: custom_components/flagdays_dk/sensor.py:103
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 21:00:21 (2 occurrences)
Last logged: 21:00:21

Error adding entities for domain sensor with platform flagdays_dk
Error while setting up flagdays_dk platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 455, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 731, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 823, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 568, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 632, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 574, in _stringify_state
    if (state := self.state) is None:
  File "/config/custom_components/flagdays_dk/sensor.py", line 103, in state
    and self.nextFlagday.halfMast > dt_now
TypeError: can't compare offset-naive and offset-aware datetimes
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

1 participant