Advertisement
yurghie

Untitled

Jun 1st, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.76 KB | None | 0 0
  1. sensor:
  2. - platform: rest
  3.   name: tazerface_weather
  4.   device_class: temperature
  5.   state_class: measurement
  6.   unit_of_measurement: '°C'
  7.   headers:
  8.     Accept: 'application/json'
  9.   scan_interval: 900
  10.   resource_template: >
  11.    {% set lat = state_attr('person.tazerface', 'latitude') | float(0) %}
  12.     {% set lon = state_attr('person.tazerface', 'longitude') | float(0) %}
  13.     {{ 'https://api.met.no/weatherapi/locationforecast/2.0/compact?lat={}&lon={}'.format(lat, lon) }}
  14.   value_template: "{{ value_json.properties.timeseries[0].data.instant.details.air_temperature }}"
  15.   json_attributes_path: "$.properties.timeseries[0].data.instant.details"
  16.   json_attributes:
  17.    - relative_humidity
  18.     - air_pressure_at_sea_level
  19.     - wind_from_direction
  20.     - wind_speed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement