Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - platform: rest
- name: szambo
- resource: http://mojdomek.eu/api/api2.php?id=TUTAJ_ID
- method: GET
- value_template: >
- {% set data = value_json.locations[0].measurement %}
- {{ {
- 'percent': data.percent,
- 'batt_level': data.batt_level,
- 'cm': data.cm,
- 'nextfull': data.nextfull,
- 'lastempty': data.lastempty
- } | tojson }}
- json_attributes:
- - percent
- - batt_level
- - cm
- - nextfull
- - lastempty
- scan_interval: 1800
- - platform: template
- sensors:
- szambo_poziom:
- friendly_name: "Poziom szamba"
- value_template: "{{ state_attr('sensor.szambo', 'percent') | float(default=0) }}"
- unit_of_measurement: '%'
- szambo_bateria:
- friendly_name: "Stan baterii"
- value_template: "{{ state_attr('sensor.szambo', 'batt_level') | float(default=0) }}"
- unit_of_measurement: '%'
- szambo_cm:
- friendly_name: "Poziom szamba w cm"
- value_template: "{{ state_attr('sensor.szambo', 'cm') | float(default=0) }}"
- unit_of_measurement: 'cm'
- szambo_nastepne_oproznienie:
- friendly_name: "Następne opróżnienie"
- value_template: "{{ state_attr('sensor.szambo', 'nextfull') }}"
- szambo_ostatnie_oproznienie:
- friendly_name: "Ostatnie opróżnienie"
- value_template: "{{ state_attr('sensor.szambo', 'lastempty') }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement