Hi all,
I write a package with the following code:
homeassistant:
customize:
sensor.meteonetwork:
friendly_name: Stazione Meteonetwork
icon: mdi:cloud-braces
sensor:
- platform: rest
name: meteonetwork
json_attributes:
- observation_time_local
- station_code
- place
- region_name
- country
- latitude
- longitude
- altitude
- temperature
- smlp
- rh
- wind_speed
- wind_direction
- rain_rate
- dew_point
- current_tmin
- current_tmax
- daily_rain
resource: https://api.meteonetwork.it/v3/data-realtime/laz290
value_template: "{{ value_json[0].area }}"
verify_ssl: false
scan_interval: 300
headers:
Authorization: !secret meteonetwork_token
- platform: template
sensors:
meteonetwork_last_update:
friendly_name: "Ultimo aggiornamento"
value_template: "{{ state_attr('sensor.meteonetwork', 'observation_time_local') }}"
icon_template: mdi:clock-outline
meteonetwork_temp:
friendly_name: "Temperatura"
value_template: "{{ state_attr('sensor.meteonetwork', 'temperature') | float | round(1) }}"
unit_of_measurement: "°C"
meteonetwork_rh:
friendly_name: "Umidita relativa"
value_template: "{{ state_attr('sensor.meteonetwork', 'rh') | int }}"
unit_of_measurement: "%"
icon_template: mdi:water-percent
meteonetwork_press:
friendly_name: "Pressione"
value_template: "{{ state_attr('sensor.meteonetwork', 'smlp') | float | round(1) }}"
unit_of_measurement: "hPa"
icon_template: mdi:gauge
meteonetwork_wind:
friendly_name: "Vento"
value_template: "{{ state_attr('sensor.meteonetwork', 'wind_speed') | int }} ({{state_attr('sensor.meteonetwork', 'wind_direction') }})"
unit_of_measurement: "Km/h"
icon_template: mdi:weather-windy
meteonetwork_rain:
friendly_name: "Pioggia"
value_template: "{{ state_attr('sensor.meteonetwork', 'rain_rate') | int }}"
unit_of_measurement: "mm/h"
icon_template: mdi:weather-pouring
meteonetwork_dew_point:
friendly_name: "Temperatura rugiada"
value_template: "{{ state_attr('sensor.meteonetwork', 'dew_point') | float | round(1) }}"
unit_of_measurement: "°C"
icon_template: mdi:water
automation:
# Notifica su app di pioggia
- alias: "Meteo__Notifica_pioggia"
trigger:
platform: numeric_state
entity_id: sensor.meteonetwork_rain
above: 1
for: '00:10:00'
condition: []
action:
service: notify.mobile_app
data_template:
title: "Meteo"
message: "Pioggia persistente a {{ trigger.to_state.state }} mm/h"
# Notifica su app di vento forte
- alias: "Meteo__Notifica_vento"
trigger:
platform: numeric_state
entity_id: sensor.meteonetwork_wind
above: 1
for: '00:10:00'
condition: []
action:
service: notify.mobile_app_oneplus
data_template:
title: "Meteo"
message: "Vento forte a {{ trigger.to_state.state }} kmh"
All the sensor states have “unknown” state, but if I run the following command:
curl --location --request GET 'https://api.meteonetwork.it/v3/data-realtime/laz290' \
--header 'Authorization: Bearer 1234|questoeilmiotokenunicoperaccedereameteonetworkapigratuitamente'
I get the right information from network station called “laz290” and yet I correctly included the package into configuration.yaml
I don’t know what I miss to get the sensors populated.