GithubHelp home page GithubHelp logo

hazarddede / home-assistant-ferienapidotde Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 2.0 36 KB

Home assistant binary sensor component to indicate if today is a german vacational day or not

License: MIT License

Python 100.00%
ferien-api vacation german homeassistant-components binary-sensor

home-assistant-ferienapidotde's Introduction

ferien-api.de binary sensor

GitHub Release GitHub Activity License

hacs Project Maintenance

Home assistant binary sensor component to indicate if today is a german vacational day or not

Installation

HACS

  1. Make sure the HACS component is installed and working.
  2. Add this github repository https://github.com/HazardDede/home-assistant-ferienapidotde as custom integration repository in HACS settings.
  3. Install the integration ferienapidotde and update home assistant configuration accordingly. You need to restart home assistant for the changes to take effect.

Manual

  1. Copy the ferienapidotde folder into your custom_components folder that is located under the root of your home assistant config. If it does not exists you can create it (which probably means you never used a custom component before).
  2. Throw down a minimal configuration
binary_sensor:
  - platform: ferienapidotde
    state_code: HH  # Federal state of Hamburg

Configuration

To integrate ferienapidotde to your Home Assistant instance, you need to add the following section to your configuration.yaml:

Minimal example:

binary_sensor:
  - platform: ferienapidotde
    state_code: HH

Full example:

Not so much you can do here but for the sake of completness.

  - platform: ferienapidotde
    name: Vacation (HH)
    state_code: HH
    days_offset: 1  # Offset = 1 -> Is there any vacation tomorrow? Can be negative as well!

A list of all valid abbreviations for the german federal states can be found here: https://www.datenportal.bmbf.de/portal/de/G122.html

If you want to monitor multiple states you have to setup multiple sensors:

binary_sensor:
  - platform: ferienapidotde
    name: Vacation (HH)
    state_code: HH
  - platform: ferienapidotde
    name: Vacation (SH)
    state_code: SH
  - platform: ferienapidotde
    name: Vacation (HH) + 3 days
    days_offset: 3
    state_code: HH

home-assistant-ferienapidotde's People

Contributors

hazarddede avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

home-assistant-ferienapidotde's Issues

not longer working

Seems it is not longer working, i cant get any values form my sensors (running HA 2022.9.4)

main sensor shows only "off" but not anymore "start" and "end" vor next vacation as its was

Date Format and Vacation Name

is it possible to change the Date Formate (used it "next_start" and "next_end" from YYYY-MM-DD to DD.MM.YYYY ?

And modify the "vacation_name" to allways use uppercase letter for the first Letter of an Vacation name?
right now it says "weihnachtsferien" - cleaner would be "Weihnachtsferien"

Current look:

next_start: '2021-12-24'
next_end: '2022-01-08'
vacation_name: weihnachtsferien
friendly_name: Ferien (NRW)
icon: mdi:calendar-remove

wish it would look like this:

next_start: '24.12.2021'
next_end: '08.01.2022'
vacation_name: Weihnachtsferien
friendly_name: Ferien (NRW)
icon: mdi:calendar-remove

Error after 2022.9.6 update

Logger: custom_components.ferienapidotde.binary_sensor
Source: custom_components/ferienapidotde/binary_sensor.py:81
Integration: ferienapidotde (documentation)
First occurred: 02:23:55 (103 occurrences)
Last logged: 07:22:13

Traceback (most recent call last): File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/ferien/model.py", line 59, in _parse_date dt = datetime.strptime(candidate, '%Y-%m-%dT%H:%M') File "/home/homeassistant/.pyenv/versions/3.9.10/lib/python3.9/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/home/homeassistant/.pyenv/versions/3.9.10/lib/python3.9/_strptime.py", line 349, in strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '2021-02-01' does not match format '%Y-%m-%dT%H:%M' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/mnt/dietpi_userdata/homeassistant/custom_components/ferienapidotde/binary_sensor.py", line 77, in async_setup_platform await data_object.async_update() File "/mnt/dietpi_userdata/homeassistant/custom_components/ferienapidotde/binary_sensor.py", line 159, in async_update self.data = await ferien.state_vacations_async(self.state_code) File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/ferien/async.py", line 58, in state_vacations_async return await convert_json(resp) File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/ferien/async.py", line 30, in _convert_json res.append(Vacation.from_dict(entry)) File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/ferien/model.py", line 71, in from_dict start=cls._parse_date(dct['start']), File "/mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/ferien/model.py", line 62, in _parse_date dt = datetime.strptime(candidate, '%Y-%m-%dT%H:%MZ') File "/home/homeassistant/.pyenv/versions/3.9.10/lib/python3.9/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/home/homeassistant/.pyenv/versions/3.9.10/lib/python3.9/_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '2021-02-01' does not match format '%Y-%m-%dT%H:%MZ'

Manifest-Warning 'no version key'

HA shows warning:
No 'version' key in the manifest file for custom integration 'ferienapidotde'. As of Home Assistant 2021.6, this integration will no longer be loaded. Please report this to the maintainer of 'ferienapidotde'
Plaese integrate the version

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.