GithubHelp home page GithubHelp logo

xlcnd / meteoalarmeu Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 3.0 306 KB

A 'custom component' for Home-Assistant for Weather Warnings from meteoalarm.eu

License: GNU General Public License v3.0

Python 100.00%
home-automation home-assistant-component binary-sensor weather-alarms meteoalarmeu eumetnet meteoalarm hacs weather-alerts

meteoalarmeu's Introduction

WARNING: METEOLARM changed the API, so that this component doesn't work anymore!

meteoalarmeu's People

Contributors

dependabot[bot] avatar nepozs avatar xlcnd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

meteoalarmeu's Issues

Multiple sensors

With binary_sensor defined in configuration.yaml, it was possible to add multiple sensors (for multiple regions). With this new way of defining configuration this is not possible anymore because the unique ID generated at initial config is "meteolaram" and this is not changed even if I rename the initial sensor. Do you think it will be possible to generate a complex unique id (like meteoalarm+country+region)? In this way multiple sensors can be added.

Automation to dismiss canceled PNs

- alias: Dismiss canceled PNs about weather warnings
  trigger:
  - platform: numeric_state
    entity_id: binary_sensor.meteoalarmeu
    attribute: alerts
    below: 1
  condition:
  - condition: state
    entity_id: binary_sensor.meteoalarmeu
    state: 'off'
  action:
  - service: persistent_notification.dismiss
    data:
      notification_id: >
        {%- filter trim(",") -%}
        {%- for item in states.persistent_notification if item |regex_search("meteoalarm") -%}
        {{ item.entity_id | replace('persistent_notification.', '') }},
        {%- endfor -%}
        {%- endfilter -%}

Loop through multiple alerts

It is a question actually: in case that there are more alerts at same time, how can I loop though them and make separate notification foe each alert? I see an attribute with number of alerts, but the rest of the attributes are not list, so I am not sure how can I loop through them and make distinct notifications.

alert_id: 2577399750
country: RO
region: Bucuresti
awareness_type: Extreme low temperature
awareness_level: Yellow
from: '2021-02-11 12:00'
until: '2021-02-15 10:00'
message: 'româna: Temperaturi foarte coborâte. english: Very low temperatures.'
message_id: 3195067993
published: '2021-02-11 12:12'
alert_id_1: 2224738174
country_1: RO
region_1: Bucuresti
awareness_type_1: Wind
awareness_level_1: Yellow
from_1: '2021-02-11 12:00'
until_1: '2021-02-12 18:00'
message_1: >-
  româna: Vântul va avea intensificări, cu viteze de 55...65 km/h și temporar
  peste 70...80 km/h english: Wind gusts will reach 55...65 km/h and temporary
  70...80 km/h.
message_id_1: 2166280796
published_1: '2021-02-11 12:12'
alert_id_2: 34520528
country_2: RO
region_2: Bucuresti
awareness_type_2: Snow/Ice
awareness_level_2: Yellow
from_2: '2021-02-11 12:00'
until_2: '2021-02-12 18:00'
message_2: 'româna: Snowfall english: Ninsori'
message_id_2: 2360044196
published_2: '2021-02-11 12:12'
alerts: 3
attribution: Information provided by meteoalarm.eu
friendly_name: meteoalarmeu_bucuresti
device_class: safety

binary sensor not working after latest update (supervisor-2021.02.11)

Hi,

With the latest update (after several restart) this add-on is not working any more. In the logs I can see the following relevant messages:

Logger: homeassistant.components.binary_sensor
Source: helpers/entity_platform.py:126
Integration: Binary sensor (documentation, issues)
First occurred: 1:09:18 PM (1 occurrences)
Last logged: 1:09:18 PM

The meteoalarmeu platform for the binary_sensor integration does not support platform setup. Please remove it from your config.

Once I remove it from the config, I can add it through the UI.

I was wondering if this was done on purpose.. I would prefer keeping it in the config.

Thank you

Automation to add an event to a Google calendar based on a weather alert

- alias: Add an event to a Google calendar based on a weather alert
  trigger:
  - platform: state
    entity_id: binary_sensor.meteoalarmeu
    attribute: message_id
  action:
  - service: google.add_event
    data:
      calendar_id: [email protected]
      summary: >
        METEOALARM-{{ state_attr('binary_sensor.meteoalarmeu', 'awareness_type') }}-{{ state_attr('binary_sensor.meteoalarmeu', 'awareness_level') }}-{{ state_attr('binary_sensor.meteoalarmeu', 'alert_id') }}
      description: >
        {{ state_attr('binary_sensor.meteoalarmeu', 'message') }}
      start_date_time: >
              {{ state_attr('binary_sensor.meteoalarmeu', 'from') }}:00
      end_date_time: >
              {{ state_attr('binary_sensor.meteoalarmeu', 'until') }}:00

Some important information that you should be aware of

meteoalarm.eu (the site) is SLOW

During a normal day has periods when it doesn't respond, periods when it is very slow and periods when it 'breaks the connection'. These cause a lot of problems to an integration in HA: polluted logs, sensors reporting bogus messages, ... unreliability. (A case of lack of resources?)

meteoalarm.eu has no API

There is no way of getting the relevant information from meteoalarm.eu in a systematic, controlled and efficient way. So the underlying 'driver' library that supports the integration, must do a miracle to present the information to HA in an ordered way. When the server doesn't respond the miracle cannot happen and so the logs report timeouts, exceptions, and other unpleasant things. C'est la vie!

meteoalarm.eu provides an IMPORTANT service

Despite all the shortcomings, it provides an important and very useful service. Paciency is needed, but most of the times it works.

There are other providers of this kind of information, however all take the information from meteoalarm.eu! So they 'are not better', they only get silent about the problems.

What you can do to help meteoalarm.eu?

First: Write to your European MP to give more funds to this project.

Second: The site was developed for EUMETNET, the Network of European Meteorological Services. The information is provided by the national weather agency of each participant country. There are some problems of meteoalarm.eu that are caused by these agencies lack of discipline, (e.g. is very frequent for one of these agencies to write messages like 'No Special Awareness Required. DANGER keep up to date with the latest weather forecast. BEWARE.' (all in the same message)!!! Other agency has many spelling errors in the name of his regions, ... ). So, if you found examples like these, please contact your agency and ask to correct them.

So, if you cannot cope with these problems, please don't install this component.

awareness_type property seems to be mandatory

when using this integration without specifying awareness_types, I get the following error:

Source: config.py:416
First occurred: 8:20:40 AM (1 occurrences)
Last logged: 8:20:40 AM

Invalid config for [binary_sensor.meteoalarmeu]: value must be one of ['Avalanches', 'Coastal Event', 'Extreme high temperature', 'Extreme low temperature', 'Flood', 'Fog', 'Forestfire', 'Rain', 'Rain-Flood', 'Snow/Ice', 'Thunderstorms', 'Wind'] @ data['awareness_types'][0]. Got None. (See /config/configuration.yaml, line 113). Please check the docs at https://github.com/xlcnd/meteoalarmeu```

My config:
```binary_sensor:
  - platform: meteoalarmeu
    country: 'GR'
    region: 'Attiki'

If I also specify (all the) awareness_types, it works properly.

Automation to create Persistent Notifications (PN) based on the alerts

- alias: Alert me about weather warnings
  trigger:
  - platform: state
    entity_id: binary_sensor.meteoalarmeu
    attribute: message_id
  condition:
  - condition: state
    entity_id: binary_sensor.meteoalarmeu
    state: 'on'
  action:
  - repeat:
      count: "{{ state_attr('binary_sensor.meteoalarmeu', 'alerts') | int }}"
      sequence:
      - service: persistent_notification.create
        data:
          title: >
            {% set ext = "" if repeat.first else "_" + (repeat.index-1)|string %}
            {{ state_attr('binary_sensor.meteoalarmeu', 'awareness_type' + ext) }} ({{ state_attr('binary_sensor.meteoalarmeu', 'awareness_level' + ext) }})
          message: >
            {% set ext = "" if repeat.first else "_" + (repeat.index-1)|string %}
            {{ state_attr('binary_sensor.meteoalarmeu', 'message' + ext) }}

            Effective from **{{ state_attr('binary_sensor.meteoalarmeu', 'from' + ext) }}** until **{{ state_attr('binary_sensor.meteoalarmeu', 'until' + ext) }}**
          notification_id: >
            {% set ext = "" if repeat.first else "_" + (repeat.index-1)|string %}
            meteoalarm_{{ state_attr('binary_sensor.meteoalarmeu', 'alert_id' + ext) }}


- alias: Update weather warnings (special cases)
  trigger:
  - platform: homeassistant
    event: start
  - platform: state
    entity_id: binary_sensor.meteoalarmeu
    to: unavailable
    for: 00:10:00
  action:
  - service: homeassistant.update_entity
    entity_id: binary_sensor.meteoalarmeu

Missing Language

Hi,

Thanks for wonderful integration. Is there a way to include Bulgarian Language as well? I've used it before last update.

Thank you in advance

The participating countries

EUMETNET, the Network of European Meteorological Services

Austria (AT)
Belgium (BE)
Bosnia-Herzegovina (BA)
Bulgaria (BG)
Croatia (HR)
Cyprus (CY)
Czech Republic (CZ)
Denmark (DK)
Estonia (EE)
Finland (FI)
France (FR)
Germany (DE)
Greece (GR)
Hungary (HU)
Iceland (IS)
Ireland (IE)
Israel (IL)
Italy (IT)
Latvia (LV)
Lithuania (LT)
Luxemburg (LU)
Malta (MT)
Moldova (MD)
Montenegro (ME)
Netherlands (NL)
North Macedonia (MK)
Norway (NO)
Poland (PL)
Portugal (PT)
Romania (RO)
Serbia (RS)
Slovakia (SK)
Slovenia (SI)
Spain (ES)
Sweden (SE)
Switzerland (CH)
United Kingdom (UK)

NOTES:

  1. The UK stopped to send data to meteoalarm.eu!
  2. MK has long periods with status 'information missing' (white areas on the map).
  3. IL has frequent periods of inconsistent information (missing information on rss feeds).

Entity not updating by itself

For some reason, this integration always show that there are no alerts after adding it or restarting HA

Steps to reproduce:

  1. Add integration and set it to any region with a issued alert
  2. Check Entity -> No alert
  3. Update entity via Home Assistant Core Integration: Update entity
  4. Check Entity -> Alert available
  5. Restart Home Asistant
  6. Check Entity -> Alert disappeared again

[Feature Request] Adjustable severity via integration GUI

Hi,

it would be super cool if it would be possible to set only certain severity / awareness_levels via the integration GUI.

For example, I would only be interested in the two warning levels Orange + Red. (Using this Sensor as a Security Device)

Or is there an other option to ignore Yellow state?

Handle regions with "&" in the name

Thanks for developing a useful integration.

My region is "London & South East". At first I could not get this to be recognised. By trial and error I discovered meteoalarmeu would work if I enter the region (previously in YAML, and now in the the configuration dialog) as London & South East as shown below. Many users will not realise this trick, so it would be good if the region string could properly handle "&" and any other special characters. Thanks!

image

Get more than 1 instance

It would be great if more than one integration can be declared.
I.e. monitored 2 locations for instance

Automation to dismiss obsolete PNs

- alias: Dismiss obsolete PNs about weather warnings
  mode: restart
  trigger:
  - platform: event
    event_type: persistent_notifications_updated
  - platform: time_pattern
    minutes: '/31'
  action:
  - delay: '00:00:10'
  - service: persistent_notification.dismiss
    data:
      notification_id: >
        {%- filter trim(",") -%}
        {%- for item in states.persistent_notification if item |regex_search("until \*\*(.*?)\*\*") -%}
        {%- if item | regex_search("meteoalarm") -%}
        {%- if item  | regex_findall_index("until \*\*(.*?)\*\*") | as_timestamp() < as_timestamp(now()) -%}
        {{ item.entity_id | replace('persistent_notification.', '') }},
        {%- endif -%}
        {%- endif -%}
        {%- endfor -%}
        {%- endfilter -%}

As of version 2021.4.1 not working to input configuration

Hello,

Before version 2021.4.1 (2021.4.0) I added my configuration in my configuration.yaml file. all worked fine.
As of 2021.4.1 the procedure changed, delete the entry in the yaml file. and all will go via a flow entry..

Well I deleted my entry and my old version, installed version 2021.4.1 but whatever I do nothing shows up where
I can put in my country, language or whatever... what iam i doing wrong ?

Regards Frank

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.