GithubHelp home page GithubHelp logo

caiosweet / home-assistant-custom-components-ingv Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 7.0 1.04 MB

INGV - National Institute of Geophysics and Volcanology [Istituto Nazionale di Geofisica e Vulcanologia] Terremoti Italia.

Home Page: http://www.ingv.it/it/

License: MIT License

Python 100.00%
home assistant homeassistant ingv terremoti geofisica vulcanologia

home-assistant-custom-components-ingv's Introduction

INGV Earthquakes

hacs Validate

GitHub latest release GitHub Release Date Maintenancebadge GitHub issuesbadge

Websitebadge Forum telegrambadge facebookbadge

Don't buy me a coffee

Instructions on how to integrate the INGV Earthquakes feed into Home Assistant.

All credit goes to Malte Franken @exxamalte.

The ingv_centro_nazionale_terremoti integration lets you use a QuakeML feeds provided by the Italian Istituto Nazionale di Geofisica e Vulcanologia with information about seismic events like earthquakes on the Italian Peninsula. It retrieves incidents from a feed and shows information of those incidents filtered by distance to Home Assistant's location.

Entities are generated, updated and removed automatically with each update from the feed. Each entity defines latitude and longitude and will be shown on the default map automatically, or on a map card by defining the source ingv_centro_nazionale_terremoti. The distance in kilometers is available as the state of each entity.

The data is updated every 5 minutes and retrieve all events from the last 24 hours by default.

The material used by this integration is provided under the Creative Commons Attribution 4.0 International. It has only been modified for the purpose of presenting the material in Home Assistant. Please refer to the creator's disclaimer notice and Terms of service for more information.

We acknowledge the INGV and ISIDe Working Group at National Earthquake Observatory project and its sponsors by the Italian Presidenza del Consiglio dei Ministri, Dipartimento della Protezione Civile, for providing data/images used in this integration.

How to install

  1. Install via HACS or you can copy the entire ingv_centro_nazionale_terremoti folder into custom_components folder in your root directory. You will need to create the dir custom_components if this is your first custom component.
  2. Restart Home Assistant.

Configuration

Config flow user interface

To configure this integration go to: Configurations -> Integrations -> ADD INTEGRATIONS button, search for INGV and configure the component.

You can also use following My Home Assistant link

Open your Home Assistant instance and start setting up a new integration.

Config yaml

  1. Add the following lines to your configuration.yaml:

     # Example configuration.yaml entry
     ingv_centro_nazionale_terremoti:
         location: "Home"
  2. Save it.

  3. Restart Home Assistant.

NOTE: In an environment other than HassOS, you will probably need to install the dependencies manually. Activate Python environment Home Assistant is running in and use following command:

python3 -m pip install aio_quakeml_ingv_centro_nazionale_terremoti_client

CONFIGURATION VARIABLES

Variables Type Requirement Default Description
location string optional Location name defined in your configuration.yaml Location name.
latitude string optional Latitude defined in your configuration.yaml Latitude of the coordinates around which events are considered.
longitude string optional Longitude defined in your configuration. yaml Longitude of the coordinates around which events are considered.
radius float optional 50.0 The distance in kilometers around Home Assistant's coordinates in which seismic events are included.
minimum_magnitude float optional 3.0 The minimum magnitude of an earthquake to be included.
scan_interval int optional 300 The time in seconds for each update.
start_time int optional 24 The start-time delta in hours. (e.g., last 18 hours)

State Attributes

The following state attributes are available for each entity in addition to the standard ones:

Attribute Description
latitude Latitude of the earthquake.
longitude Longitude of the earthquake.
source ingv_centro_nazionale_terremoti to be used in conjunction with geo_location automation trigger.
region Textual description of named geographic region near to the event.
magnitude Reported magnitude of the earthquake.
depth The depth of the quake in km.
status The Evaluation Status of the quake (preliminary, confirmed, reviewed, final, rejected).
mode The Evaluation Mode of the quake (manual or automatic).
publication_date Date and time when this event occurred.
event_id Return the short id used in the feed to identify the earthquake in the feed.
image_url URL for a map not provided in the feed that marks the location of the event. This could for example be used in notifications. Images are only available for magnitude >= 3.

geo_location

Sensor

This integration automatically creates a sensor that shows how many entities are currently managed by this integration. In addition to that the sensor has some useful attributes that indicate the currentness of the data retrieved from the feed.

Attribute Description
status Status of last update from the feed ("OK" or "ERROR").
last update Timestamp of the last update from the feed.
last update successful Timestamp of the last successful update from the feed.
last timestamp Timestamp of the latest entry from the feed.
created Number of entities that were created during last update (optional).
updated Number of entities that were updated during last update (optional).
removed Number of entities that were removed during last update (optional).

sensor

Full Configuration

# Example configuration.yaml entry
ingv_centro_nazionale_terremoti:
  location: "Home"
  latitude: 41.89
  longitude: 12.51
  radius: 100
  minimum_magnitude: 2.0
  scan_interval: 300
  start_time: 24

Example Zone

zone:
  - name: geoalert
    latitude: !secret latitude_home
    longitude: !secret longitude_home
    radius: 100000 #The radius of the zone in meters
    passive: true

Example Automation

automation:
  alias: INGV Quakes Notification Send
  description: ''
  trigger:
    - platform: geo_location
      source: ingv_centro_nazionale_terremoti
      zone: zone.geoalert
      event: enter
  condition: []
  action:
    - service: notify.discord
      data:
        title: New INGV Quakes
        message: |
          Rilevato terremoto a una distanza di {{trigger.to_state.state}} Km da
          casa. Magnitudo: {{trigger.to_state.attributes.magnitude}}  Epicentro:
          {{trigger.to_state.attributes.region}} Profondità:
          {{trigger.to_state.attributes.depth}} km. {% set data_utc =
          trigger.to_state.attributes.publication_date %}
          {{as_timestamp(data_utc)|timestamp_custom('%H:%M:%S - %d/%m/%Y')}}
  mode: queued

Example Lovelace Map Card

type: map
entities:
  - entity: person.YUOR_PERSON
geo_location_sources:
  - ingv_centro_nazionale_terremoti
dark_mode: true
default_zoom: 8
aspect_ratio: '16:9'
hours_to_show: 72

type: markdown
title: ''
content: >-
  {% set ingv_entities = integration_entities("ingv_centro_nazionale_terremoti") %}
  {% set entityid = ingv_entities | select('match','geo_location') | max | default(false) %}

  {# START ->> if geo_location entities exsist #}
  {% if entityid %} 
  {% set alert_type = {0:'info', 1:'success', 2:'warning', 3:'warning', 4:'error'} %}
  {% set code = {0:'White', 1:'Green', 2:'Gold', 3:'Orange', 4:'Red'} %} 
  {% set url = "http://shakemap.rm.ingv.it/shake4/data/{}/current/products/{}.jpg" %}
  {% set url2 = "http://shakemap.ingv.it/shake4/data/{}/current/products/{}.jpg" %} 
  {% set openmap = "https://www.openstreetmap.org/?mlat={}&mlon={}#map=12/{}/{}" %}
  {% set id = state_attr(entityid, 'event_id') %} 
  {% set magnitudo = state_attr(entityid, 'magnitude')|float(default=0) %} 
  {% set lat = state_attr(entityid, 'latitude') %} 
  {% set long = state_attr(entityid, 'longitude') %} 
  {% set utc = as_timestamp(state_attr(entityid, 'publication_date'),0) %} 
  {% set depth = state_attr(entityid, 'depth')|default(none) %}
  {# MACRO MAGNITUDE LEVEL #}
  {% macro mag(m) -%}
    {% if 0 <= m < 2 %}0{% elif 2 <= m < 3 %}1{% elif 3 <= m < 4 %}2
    {% elif 4 <= m < 6 %}3{% else %}4{% endif %}
  {% endmacro %}
  {% set level = mag(magnitudo)|int(0) %}
  {% set alert = alert_type[level] %}
  {% set color = code[level] %}
  {# MACRO BOLD TEXT FORMAT and COLOR according to the warning LEVEL #}
  {%- macro form(data) -%}
    <font color="{{color}}">**{{data}}**</font>
  {%- endmacro -%}
  ___

  <ha-alert title="TERREMOTO 
  {{ utc|timestamp_custom('%H:%M:%S del %d-%m-%Y') 
  if utc is not none else 0 }}" alert-type={{alert}}>


  Un terremoto di magnitudo {{ form(magnitudo) }}
  è avvenuto nella zona: 
  [{{ state_attr(entityid, 'region') }}]({{ openmap.format(lat,long,lat,long) }})
  a {{ form(states(entityid)) }} km da casa,
  con coordinate epicentrali {{ lat }}, {{ long }},
  ad una profondità di {{ form(depth) }} Km.


  {# PERSON #}
  {% set state_dict = {'home': 'casa', 'not_home': 'fuori casa', 'unknown': '❓'} %} 
  {% for person in expand(states.person) %} 
  {% if 'latitude' in person.attributes and person.attributes.latitude is not none %} 
  {% set distanza = distance(lat|default(0), long|default(0), person.entity_id|default(0)) %}
  {{ "📍 {} ({}) a circa {} km dall'epicentro.".format(
    person.name|upper, state_dict.get(person.state, person.state), distanza|round(1, default=0)
    ) }} 
  {% else %}
  {{ "📍 {} ({})".format(person.name|upper, state_dict.get(person.state, person.state)) }} 
  {% endif %} 
  {% endfor %}

  [INGV](http://terremoti.ingv.it/) [Hai Sentito Il Terremoto?](http://www.haisentitoilterremoto.it/) 


  </ha-alert>

  {# IMAGE AND LINK #}
  {% if magnitudo >= 3 %}

  [Intensity]({{url.format(id,'intensity')}}) ~ 
  [PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ 
  [PSA0]({{url.format(id,'psa0p3')}}) ~ [PSA1]({{url.format(id,'psa1p0')}}) ~ 
  [HSIT](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)


  {% if is_state('binary_sensor.download_file', 'on') %}

  <a href="http://shakemap.rm.ingv.it/shake4/view.html?eventid={{id}}"><img
  src="/local/hassiohelp/downloads/lastquake.jpg?t='{{now().timestamp()}}'"></a>
  {% else %} 
  <a  href="http://shakemap.rm.ingv.it/shake4/view.html?eventid={{id}}"><img
  src="http://shakemap.rm.ingv.it/shake4/data/{{id}}/current/products/pga.jpg"></a>
  {% endif %} {% endif %}


  {# SENSOR STATUS #}
  {% else %}
  
  {% for entity in ingv_entities %}
  <ha-alert title="{{ state_attr(entity, 'friendly_name') }}" alert-type="info">
  {{ state_attr(entity, 'status')|slugify(separator=" ") }} - {{ states(entity) }}
  </ha-alert>
  {% endfor %}
  {% endif %}

Markdown Card

Trademark Legal Notices

All product names, trademarks and registered trademarks in the images in this repository, are property of their respective owners. All images in this repository are used by the author for identification purposes only. The use of these names, trademarks and brands appearing in these image files, do not imply endorsement.

home-assistant-custom-components-ingv's People

Contributors

caiosweet avatar dependabot[bot] avatar ktibow avatar mrai64 avatar viper5000 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  avatar  avatar

home-assistant-custom-components-ingv's Issues

Warning about a deprecated signature

There is a warning in the log about a signature deprecated:

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for ingv_centro_nazionale_terremoti using this method at custom_components/ingv_centro_nazionale_terremoti/__init__.py, line 90: hass.config_entries.async_setup_platforms(entry, PLATFORMS)
  • Home Assistant 2023.2.2
  • Supervisor 2023.01.1
  • Frontend 20230202.0 - latest

Errors after HAOS 2023.10.1

I always get these errors when HA start, just after upgrading to HAOS 2023.10.1

2023-10-10 12:18:31.997 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=(#### TERREMOTI - ULTIME 24h  [<img src="https://www.hsit.it/images/favicon.png"/> Hai Sentito Il Terremoto](http://www.haisentitoilterremoto.it/)
<!-- Setting -->
  {%- set person = 'person.maurizio' -%}
  {%- set url = "https://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" -%}
  {%- set entityid = 'binary_sensor.lastquake' -%}
  {%- set id = state_attr(entityid, 'event_id') -%}
  {%- set data_utc = state_attr(entityid, 'publication_date') -%}
  {%- set magnitudo = (state_attr(entityid, 'magnitude')|float) if not none else '0' -%}
  {%- set code = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} -%}
  {%- set color = code[state_attr('binary_sensor.lastquake', 'level')|int] -%}
  {%- set lat = state_attr(entityid, 'lat') -%}
  {%- set long = state_attr(entityid, 'long') -%}
<font>
**<font color="{{color}}">{{as_timestamp(data_utc)|timestamp_custom ('%H:%M:%S del %d/%m/%Y')}}</font>**<br><br> Un terremoto di magnitudo **<font color="{{color}}">{{magnitudo}}</font>**<br> è avvenuto nella zona: [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=12/{{lat}}/{{long}})<br> a <font color="{{color}}">**{{state_attr(entityid, 'distance')}}**</font> km da casa,<br> con coordinate geografiche (lat, long) {{lat}},{{long}}.<br> {{("Tu ti trovi a " ~ distance(lat, long, person)) ~ " km dall'epicentro." if is_state(person, 'not_home') else ''}} </font> {% if magnitudo >= 3 %}<br> [Shakemap]({{url.format(id,'intensity')}}) ~  [PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ [TvMap]({{url.format(id,'tvmap')}}) ~ [TvMap2]({{url.format(id,'tvmap_bare')}}) ~  [HaiSentitoIlTerremoto](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)
<!-- Scegli il tipo di immagine da visualizzare [intensity,pga,pgv,tvmap,tvmap_bare] -->
  <img src="{{url.format(id,'intensity')}}"/>
  <!-- <img src="{{url.format(id,'pga')}}"/> -->
{% endif %}
<!-- 
  Map Google
  [{{state_attr(entityid, 'region')}}](http://maps.google.com/maps?z=8&q=loc:{{lat}}+{{long}})
  Map Open Streat Map
  [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
-->) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1925, in forgiving_float_filter
    return float(value)
           ^^^^^^^^^^^^
ValueError: could not convert string to float: ''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 568, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2196, in _render_with_context
    return template.render(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 8, in top-level template code
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1928, in forgiving_float_filter
    raise_no_default("float", value)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1626, in raise_no_default
    raise ValueError(
ValueError: Template error: float got invalid input '' when rendering template '#### TERREMOTI - ULTIME 24h  [<img src="https://www.hsit.it/images/favicon.png"/> Hai Sentito Il Terremoto](http://www.haisentitoilterremoto.it/)
<!-- Setting -->
  {%- set person = 'person.maurizio' -%}
  {%- set url = "https://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" -%}
  {%- set entityid = 'binary_sensor.lastquake' -%}
  {%- set id = state_attr(entityid, 'event_id') -%}
  {%- set data_utc = state_attr(entityid, 'publication_date') -%}
  {%- set magnitudo = (state_attr(entityid, 'magnitude')|float) if not none else '0' -%}
  {%- set code = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} -%}
  {%- set color = code[state_attr('binary_sensor.lastquake', 'level')|int] -%}
  {%- set lat = state_attr(entityid, 'lat') -%}
  {%- set long = state_attr(entityid, 'long') -%}
<font>
**<font color="{{color}}">{{as_timestamp(data_utc)|timestamp_custom ('%H:%M:%S del %d/%m/%Y')}}</font>**<br><br> Un terremoto di magnitudo **<font color="{{color}}">{{magnitudo}}</font>**<br> è avvenuto nella zona: [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=12/{{lat}}/{{long}})<br> a <font color="{{color}}">**{{state_attr(entityid, 'distance')}}**</font> km da casa,<br> con coordinate geografiche (lat, long) {{lat}},{{long}}.<br> {{("Tu ti trovi a " ~ distance(lat, long, person)) ~ " km dall'epicentro." if is_state(person, 'not_home') else ''}} </font> {% if magnitudo >= 3 %}<br> [Shakemap]({{url.format(id,'intensity')}}) ~  [PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ [TvMap]({{url.format(id,'tvmap')}}) ~ [TvMap2]({{url.format(id,'tvmap_bare')}}) ~  [HaiSentitoIlTerremoto](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)
<!-- Scegli il tipo di immagine da visualizzare [intensity,pga,pgv,tvmap,tvmap_bare] -->
  <img src="{{url.format(id,'intensity')}}"/>
  <!-- <img src="{{url.format(id,'pga')}}"/> -->
{% endif %}
<!-- 
  Map Google
  [{{state_attr(entityid, 'region')}}](http://maps.google.com/maps?z=8&q=loc:{{lat}}+{{long}})
  Map Open Streat Map
  [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
-->' but no default was specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 694, in async_render_to_info
    render_info._result = self.async_render(
                          ^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 570, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: ValueError: Template error: float got invalid input '' when rendering template '#### TERREMOTI - ULTIME 24h  [<img src="https://www.hsit.it/images/favicon.png"/> Hai Sentito Il Terremoto](http://www.haisentitoilterremoto.it/)
<!-- Setting -->
  {%- set person = 'person.maurizio' -%}
  {%- set url = "https://shakemap.rm.ingv.it/shake/{}/download/{}.jpg" -%}
  {%- set entityid = 'binary_sensor.lastquake' -%}
  {%- set id = state_attr(entityid, 'event_id') -%}
  {%- set data_utc = state_attr(entityid, 'publication_date') -%}
  {%- set magnitudo = (state_attr(entityid, 'magnitude')|float) if not none else '0' -%}
  {%- set code = {0:'White', 1:'Green', 2:'Yellow', 3:'Orange', 4:'Red'} -%}
  {%- set color = code[state_attr('binary_sensor.lastquake', 'level')|int] -%}
  {%- set lat = state_attr(entityid, 'lat') -%}
  {%- set long = state_attr(entityid, 'long') -%}
<font>
**<font color="{{color}}">{{as_timestamp(data_utc)|timestamp_custom ('%H:%M:%S del %d/%m/%Y')}}</font>**<br><br> Un terremoto di magnitudo **<font color="{{color}}">{{magnitudo}}</font>**<br> è avvenuto nella zona: [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=12/{{lat}}/{{long}})<br> a <font color="{{color}}">**{{state_attr(entityid, 'distance')}}**</font> km da casa,<br> con coordinate geografiche (lat, long) {{lat}},{{long}}.<br> {{("Tu ti trovi a " ~ distance(lat, long, person)) ~ " km dall'epicentro." if is_state(person, 'not_home') else ''}} </font> {% if magnitudo >= 3 %}<br> [Shakemap]({{url.format(id,'intensity')}}) ~  [PGA]({{url.format(id,'pga')}}) ~ [PGV]({{url.format(id,'pgv')}}) ~ [TvMap]({{url.format(id,'tvmap')}}) ~ [TvMap2]({{url.format(id,'tvmap_bare')}}) ~  [HaiSentitoIlTerremoto](http://eventi.haisentitoilterremoto.it/{{id}}/{{id}}_mcs.jpg)
<!-- Scegli il tipo di immagine da visualizzare [intensity,pga,pgv,tvmap,tvmap_bare] -->
  <img src="{{url.format(id,'intensity')}}"/>
  <!-- <img src="{{url.format(id,'pga')}}"/> -->
{% endif %}
<!-- 
  Map Google
  [{{state_attr(entityid, 'region')}}](http://maps.google.com/maps?z=8&q=loc:{{lat}}+{{long}})
  Map Open Streat Map
  [{{state_attr(entityid, 'region')}}](https://www.openstreetmap.org/?mlat={{lat}}&mlon={{long}}#map=8/{{lat}}/{{long}})
-->' but no default was specified

Never seen before....

Add unit of measurement localization

the sensor is great in English but in the other languages (currently it/pt) it is inconsistent, I wanted to open a PR but I didn't understand how to do it, I only found the translation files

The name property of the Unit System is deprecated

As per home-assistant/core#80257

The name of a unit system should never be used for checking its type. Instance checks should be used instead:

Correct:

if hass.config.units is IMPERIAL_SYSTEM:
    pass

if hass.config.units is METRIC_SYSTEM:
    pass

Incorrect:

if hass.config.units.name == CONF_UNIT_SYSTEM_IMPERIAL:
    pass

if hass.config.units.name == CONF_UNIT_SYSTEM_METRIC:
    pass

integration not found in automation trigger

hi, I was trying your example automation but there is something wrong with the code:
trigger: - platform: geo_location source: "ingv_centro_nazionale_terremoti"
the trigger is not recognized... source "ingv..." says INTEGRATION NOT FOUND.
Did you have some suggestion?
card and all other things works perfectly!

help to edit binary_sensor template to remove warning in log of homeassistant 2021.4.X

Describe the bug

After update home assistant 2021.4.0 in the log there are warning when a tamplate is empty.
https://www.home-assistant.io/blog/2021/04/07/release-20214/#warnings-for-undefined-variables-in-templates
To Reproduce
Steps to reproduce the behavior:

  1. Update home assistant to 2021.4.1
  2. See the log file

Expected behavior
I hope to edit the template of all the binary sensor and other templates to don't show the warning.
For example, someone fix easier template in this way: https://community.home-assistant.io/t/template-sensor-template-variable-warning-with-ha-2021-4/297237

Screenshots

2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='state')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.latitude')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.longitude')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.title')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.region')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.magnitude')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.publication_date')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.event_id')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.image_url')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.attribution')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti') |sort(attribute='attributes.publication_date')|map(attribute='attributes.external_id')|list|last|replace('smi:','')}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{% set last_date = states.geo_location
  | selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  | sort(attribute='attributes.publication_date')
  | map(attribute='attributes.publication_date') |list|last %}
{{ ((as_timestamp(utcnow())-as_timestamp(last_date))/3600) <= 24 if last_date else False }}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='state')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.latitude')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.longitude')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.title')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.region')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.magnitude')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.publication_date')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.event_id')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.image_url')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti')
  |sort(attribute='attributes.publication_date')|map(attribute='attributes.attribution')|list|last}}'
2021-04-09 18:52:12 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: No last item, sequence was empty. when rendering '{{states.geo_location|selectattr('attributes.source','eq','ingv_centro_nazionale_terremoti') |sort(attribute='attributes.publication_date')|map(attribute='attributes.external_id')|list|last|replace('smi:','')}}'

Desktop (please complete the following information):
System Health

version: core-2021.4.1
installation_type: Home Assistant Core
dev: false
hassio: false
docker: false
virtualenv: true
python_version: 3.8.7
os_name: Linux
os_version: 5.10.17-v7l+
arch: armv7l
timezone: Europe/Rome

Smartphone (please complete the following information):

Additional context

Example of lovelace card?

Can you show us an example about how to configure a lovelace card with this component?
I see many new sensors created so i think i need only an entities card or not? And how to show a map?

Il componente non rimuove le entità precedenti

Chiedo scusa per l'uso dell'italiano ma non ho troppa dimestichezza con l'inglese.
Ho correttamente installato tramite HACS il componente, le entità vengono generate ma non vengono mai rimosse. Al momento ne ho 4 e se dovessero arrivare altri eventi credo aumenteranno.

Il mio sistema è HassOS Supervised, Core 2022.2.9, Python 3.9.7 su Raspberry 4

Non saprei come riprodurre l'errore e non ho visto nulla nei log che possa aiutarmi nella comprensione.

Grazie per l'ottimo lavoro
Paolo

deprecated constant which will be removed in HA Core 2025.1

LENGTH_MILES was used from ingv_centro_nazionale_terremoti, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfLength.MILES instead, please create a bug report at https://github.com/caiosweet/Home-Assistant-custom-components-INGV/issues

LENGTH_KILOMETERS was used from ingv_centro_nazionale_terremoti, this is a deprecated constant which will be removed in HA Core 2025.1.
Use UnitOfLength.KILOMETERS instead, please create a bug report at https://github.com/caiosweet/Home-Assistant-custom-components-INGV/issues

Alarms are repeating for the same events

I've been using the automation feature to document more efficiently. It was functioning properly until recently. However, since yesterday, there has been a eartquake, and now it occasionally triggers for the same event repeatedly.
The aqutomation is this:

alias: INFO INGV terremoti
description: ""
trigger:

  • platform: geo_location
    source: ingv_centro_nazionale_terremoti
    zone: zone.geoalert
    event: enter
    condition: []
    action:

  • service: notify.joins21
    data:
    title: TERREMOTO
    message: >-
    Rilevato terremoto a una distanza di {{trigger.to_state.state}} Km
    da casa. Magnitudo: {{trigger.to_state.attributes.magnitude}}
    Epicentro: {{trigger.to_state.attributes.region}} Profondità:
    {{trigger.to_state.attributes.depth}} km. Il terremoto è avvenuto alle
    {% set data_utc = trigger.to_state.attributes.publication_date
    %} {{as_timestamp(data_utc)|timestamp_custom('%H:%M:%S -
    %d/%m/%Y')}}

  • service: notify.joins24
    data:
    title: TERREMOTO
    message: >-
    Rilevato terremoto a una distanza di {{trigger.to_state.state}} Km
    da casa. Magnitudo: {{trigger.to_state.attributes.magnitude}}
    Epicentro: {{trigger.to_state.attributes.region}} Profondità:
    {{trigger.to_state.attributes.depth}} km. Il terremoto è avvenuto alle
    {% set data_utc = trigger.to_state.attributes.publication_date
    %} {{as_timestamp(data_utc)|timestamp_custom('%H:%M:%S -
    %d/%m/%Y')}}

  • condition: time
    after: "07:00:00"
    before: "23:00:00"
    weekday:

    • tue
    • wed
    • thu
    • fri
    • sat
    • sun
    • mon
  • service: tts.google_say
    data:
    entity_id: media_player.google_sala
    message: >
    Rilevato terremoto a una distanza di {{trigger.to_state.state}} Km da

    casa. Magnitudo: {{trigger.to_state.attributes.magnitude}}  Epicentro:
    
    {{trigger.to_state.attributes.region}} Profondità:
    
    {{trigger.to_state.attributes.depth}} km. Il terremoto è avvenuto alle
    {% set data_utc =
    
    trigger.to_state.attributes.publication_date %}
    
    {{as_timestamp(data_utc)|timestamp_custom('%H:%M:%S - %d/%m/%Y')}}
    

mode: queued

In my log I found these errors:
Questo errore ha avuto origine da un'integrazione personalizzata.

Registratore: aio_quakeml_client.feed
Fonte: custom_components/ingv_centro_nazionale_terremoti/init.py:160
integration: INGV Earthquakes (documentazione, problemi)
Prima occorrenza: 7 aprile 2024 alle ore 07:45:38 (121 occorrenze)
Ultima registrazione: 10:29:34

Requesting data from https://webservices.ingv.it/fdsnws/event/1/query?lat=**.*******&lon=12.66378164291382&maxradiuskm=75.0&minmag=3.0&starttime=2024-04-10T06:53:00 failed with timeout error
Requesting data from https://webservices.ingv.it/fdsnws/event/1/query?lat=**.*******&lon=12.66378164291382&maxradiuskm=75.0&minmag=3.0&starttime=2024-04-10T07:33:00 failed with timeout error
Requesting data from https://webservices.ingv.it/fdsnws/event/1/query?lat=**.*******&lon=12.66378164291382&maxradiuskm=75.0&minmag=3.0&starttime=2024-04-10T07:54:00 failed with timeout error
Requesting data from https://webservices.ingv.it/fdsnws/event/1/query?lat=**.*******&lon=12.66378164291382&maxradiuskm=75.0&minmag=3.0&starttime=2024-04-10T08:24:00 failed with timeout error
Requesting data from https://webservices.ingv.it/fdsnws/event/1/query?lat=**.********&lon=12.66378164291382&maxradiuskm=75.0&minmag=3.0&starttime=2024-04-10T08:29:00 failed with timeout error

and these:

Questo errore ha avuto origine da un'integrazione personalizzata.

Registratore: aio_quakeml_client.feed_manager
Fonte: custom_components/ingv_centro_nazionale_terremoti/init.py:160
integration: INGV Earthquakes (documentazione, problemi)
Prima occorrenza: 7 aprile 2024 alle ore 07:45:38 (121 occorrenze)
Ultima registrazione: 10:29:34

Update not successful, no data received from <IngvCentroNazionaleTerremotiQuakeMLFeed(home=(.************, 12.66378164291382), url=https://webservices.ingv.it/fdsnws/event/1/query, radius=75.0, magnitude=3.0)>

HOME ASSISTANT:
Core
2024.3.3
Supervisor
2024.04.0
Operating System
12.1
Frontend
20240307.0

Probably the immage I attached can explain the error:
Screenshot_11-4-2024_10549_carhome duckdns org

INSTALLATION ERROR ON HOME ASSISTANT CORE ON SYNOLOGY NAS DSM 7

Hi, the custom component "Home-Assistant-custom-components-INGV" is very interesting. I tried to install it via HACS and I cofigured the configuration.yalm file as per your instructions. But I get this error: "Platform error geo_location.ingv_centro_nazionale_terquoti - Requirements for ingv_centro_nazionale_terquoti not found: ['georss-ingv-centro-Nazionale-earthquakes-client == 0.5']."
I tried to install georss-ingv-national-center-earthquakes-client == 0.5 via: pip install georss-ingv-national-center-earthquakes-client == 0.5 but I get an error also in this case.
How can I proceed?
I use Home Assistant Core on Synology Nas DSM 7.
Thank you

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.