HazardDede / home-assistant-ferienapidotde

Home assistant binary sensor component to indicate if today is a german vacational day or not
MIT License
5 stars 2 forks source link

ferien-api.de url not available #10

Open StefanW86 opened 11 months ago

StefanW86 commented 11 months ago

Hello,

since today there seems to be an issue with the url ferien-api.de. The url is not reachable anymore.

CoolID2 commented 11 months ago

I've got same problem. All cover automations stopped working.
Help please.

tombrain commented 11 months ago

Perhaps it is possible to change to datasource https://openholidaysapi.org/

stsch83 commented 11 months ago

Perhaps it is possible to change to datasource https://openholidaysapi.org/

i use this for the moment:

sensor:
  - platform: rest
    resource: https://openholidaysapi.org/SchoolHolidays?countryIsoCode=DE&languageIsoCode=DE&validFrom={{ now().strftime('%Y-%m-%d') }}&validTo={{ now().strftime('%Y-%m-%d') }}&subdivisionCode=DE-TH
    method: GET
    name: openholidayapi_ferien_th
    value_template: >
      {% if value_json["name"]  %}
      true 
      {% else %}
      false 
      {% endif %}
    scan_interval: 10

The sensor look for the current day for Thuringia in Germany.

tombrain commented 11 months ago

Perhaps it is possible to change to datasource https://openholidaysapi.org/

i use this for the moment:

sensor:
  - platform: rest
    resource: https://openholidaysapi.org/SchoolHolidays?countryIsoCode=DE&languageIsoCode=DE&validFrom={{ now().strftime('%Y-%m-%d') }}&validTo={{ now().strftime('%Y-%m-%d') }}&subdivisionCode=DE-TH
    method: GET
    name: openholidayapi_ferien_th
    value_template: >
      {% if value_json["name"]  %}
      true 
      {% else %}
      false 
      {% endif %}
    scan_interval: 10

The sensor look for the current day for Thuringia in Germany.

this sensor do not work

here is an working replacement as binary sensor like original


  - platform: rest
    name: openholidayapi_ferien_by_binary # today
    resource_template: >
      https://openholidaysapi.org/SchoolHolidays?countryIsoCode=DE&languageIsoCode=DE&validFrom={{ now().strftime('%Y-%m-%d') }}&validTo={{ now().strftime('%Y-%m-%d') }}&subdivisionCode=DE-BY
    value_template: "{{ not value_json[0].id is none }}"
    scan_interval: 300
  - platform: rest
    name: openholidayapi_ferien_by_morgen_binary #tomorrow
    resource_template: >
      https://openholidaysapi.org/SchoolHolidays?countryIsoCode=DE&languageIsoCode=DE&validFrom={{ (now() + timedelta(days=1) ).strftime('%Y-%m-%d') }}&validTo={{ (now() + timedelta(days=1) ).strftime('%Y-%m-%d') }}&subdivisionCode=DE-BY
    value_template: "{{ not value_json[0].id is none }}"
    scan_interval: 300
phil11c commented 11 months ago

ferien-api.de seems to be back online

ecdlguy commented 7 months ago

@tombrain very nice, could this rest-call be used to create a home assistant (local) calendar "on the fly"?

tombrain commented 7 months ago

@tombrain very nice, could this rest-call be used to create a home assistant (local) calendar "on the fly"?

@ecdlguy can you describe your situation? what do you mean "on the fly"?

ecdlguy commented 7 months ago

what do you mean "on the fly"?

I'm trying to have a "school holiday" calendar in home assistant that automatically keeps up-to-date.

Using the REST platform one can fetch school holidays for an entire year for example. I'm not an expert regarding home assistant templates, but maybe it's possible to create events for e.g. a local calendar from the REST response?

tombrain commented 7 months ago

@ecdlguy You can still use the REST interface to query whether a particular day is a vacation or not.

If you want an annual calendar with all vacations, you may have to go via the Google calendar.