Skip to content

Instantly share code, notes, and snippets.

@mattsches
Created May 8, 2017 21:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattsches/34c33673d9b1b69b8969fa777f1cd8ca to your computer and use it in GitHub Desktop.
Save mattsches/34c33673d9b1b69b8969fa777f1cd8ca to your computer and use it in GitHub Desktop.
Beispiel für RESTful Sensor in Home Assistant zur Abfrage des luftdaten.info API
sensor:
- platform: rest
resource: http://api.luftdaten.info/v1/sensor/1777
value_template: >
{% if value_json is sequence %}
{% set sensor = value_json | last %}
{% else %}
{% set sensor = value_json %}
{% endif %}
{% for sdv in sensor.sensordatavalues %}
{% if sdv.value_type == "P1" %}
{{ sdv.value | int }}
{% endif %}
{% endfor %}
unit_of_measurement: "µg/m³"
name: "PM10"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment