Git Product home page Git Product logo

j-lindvig / flagdays_dk Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 2.0 237 KB

πŸ‡©πŸ‡° Official flagdays in Denmark with a lot of useful logic and attributes. It is possible to add your own anniversaries πŸŽ‚ or special flags πŸ³οΈβ€πŸŒˆ πŸ΄β€β˜ οΈ

License: GNU General Public License v3.0

Python 100.00%
denmark flagdays anniversaries homeassistant hacs hacs-integration hacs-default pride

flagdays_dk's People

Contributors

j-lindvig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hexdk baunan

flagdays_dk's Issues

Problem with attributes for sensor

Hey. Still need help. Finally, I got the integration running - sort of. In other words, the only attributes the sensor picks up, are those listed in flagdays_dk.py. They got sorted, excluded. But all others, whether they are listed in config.yaml, or as sensors are ignored. Anyone whos gotta clue??? I would be very grateful.

Unable to load calendar

Hello,
Recently the integration stopped working, I get the following the system log:

Logger: homeassistant.components.sensor
Source: custom_components/flagdays_dk/sensor.py:70
Integration: Sensor (documentation, issues)
First occurred: 16.24.09 (2 occurrences)
Last logged: 16.24.09

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 428, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 692, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 789, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 545, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 583, in _async_write_ha_state
state = self._stringify_state(available)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 551, in _stringify_state
if (state := self.state) is None:
File "/config/custom_components/flagdays_dk/sensor.py", line 70, in state
return self._nextFlagDay.getDays()
AttributeError: 'NoneType' object has no attribute 'getDays'

I'm on:
Home Assistant 2022.12.8
Supervisor 2022.12.1
Operating System 9.4
Brugerfladeversion: 20221213.1 - latest

I have tried to remove the integration and the re-install with the default settings, but no luck.

Error adding entities for domain sensor with platform flagdays_dk

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

Integration broken in sensor.py

The last couple of days I get an error loading the integration:

Error while setting up flagdays_dk platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/flagdays_dk/sensor.py", line 46, in async_setup_platform
entities.append(FlagDaysSensor(hass, coordinator, flagDays))
File "/config/custom_components/flagdays_dk/sensor.py", line 55, in init
self._state = flagDays._next_event['days_to_event']
KeyError: 'days_to_event'

Using latest 1.6. HA 2022.4.5 (issues was previously observed in version 2022.4.0 but then it has been working just before Easter Day).

Can't get it to work - updated

I have tried several times, installing it from the bottom, but I can't get the sensor up and running. I got following message in the log.
Logdetaljer (FEJL)

Logger: homeassistant.setup
Source: setup.py:288
First occurred: 1. november 2023 kl. 19.57.54 (1 occurrences)
Last logged: 1. november 2023 kl. 19.57.54

Error during setup of component flagdays_dk
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/flagdays_dk/init.py", line 104, in async_setup
customFlagdays.update(flagdayFromSensor(customFlagday))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/flagdays_dk/init.py", line 65, in flagdayFromSensor
attr_date_keys = list(attr_names.intersection(set(flagdayObj.attributes)))
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'attributes'

H. Nymand

Bug in newest version

This error originated from a custom integration.

Logger: homeassistant.setup
Source: custom_components/flagdays_dk/init.py:41
Integration: FlagDays DK (documentation, issues)
First occurred: 12:19:50 (1 occurrences)
Last logged: 12:19:50

Error during setup of component flagdays_dk
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 235, in _async_setup_component
result = await task
File "/config/custom_components/flagdays_dk/init.py", line 41, in async_setup
flags.append(DEFAULT_FLAG)
AttributeError: 'str' object has no attribute 'append'

Shorter names for flagdays

Request: If possible please shorten longer flagday names. E.g. especially royal birthdays where titles as "Hans Kongelige HΓΈjhed" can be shortened to "H.K.H." for better usability in cards.

Thank you for an usefull application btw :-)

Best regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.