|
fan: |
|
- platform: template |
|
fans: |
|
mechanische_ventilatie: |
|
friendly_name: Mechanische ventilatie |
|
value_template: > |
|
{{ states('sensor.mechanische_ventilatie_status') }} |
|
availability_template: > |
|
{{ states('sensor.mechanische_ventilatie_status') }} |
|
percentage_template: > |
|
{{ state_attr('sensor.mechanische_ventilatie_status', 'percentage') }} |
|
preset_mode_template: > |
|
{{ state_attr('sensor.mechanische_ventilatie_status', 'speed') }} |
|
turn_on: |
|
service: script.ventilation_turn_on_off_dummy |
|
turn_off: |
|
service: script.ventilation_turn_on_off_dummy |
|
set_percentage: |
|
service: script.ventilation_set_voltage |
|
data: |
|
voltage: '{{ percentage / 10 }}' |
|
set_preset_mode: |
|
service: script.ventilation_set_preset_mode |
|
data: |
|
preset_mode: '{{ preset_mode }}' |
|
preset_modes: |
|
- low |
|
- medium |
|
- high |
|
- max |
|
|
|
sensor: |
|
- platform: rest |
|
name: Mechanische ventilatie status |
|
resource: !secret nrf905_status_url |
|
username: !secret nrf905_username |
|
password: !secret nrf905_password |
|
value_template: > |
|
{% if value_json['result'] == 'ok' %} |
|
on |
|
{% else %} |
|
off |
|
{% endif %} |
|
json_attributes_path: $.devices.C0 # This will be different for each fan. |
|
json_attributes: |
|
- voltage |
|
- percentage |
|
- speed |
|
- timer |
|
|
|
script: |
|
ventilation_turn_on_off_dummy: |
|
mode: single |
|
sequence: |
|
- delay: 1 |
|
ventilation_set_preset_mode: |
|
mode: single |
|
fields: |
|
host: |
|
description: Hostname or ip |
|
preset_mode: |
|
description: Set the fan preset mode (low/medium/high/max) |
|
sequence: |
|
- service: rest_command.ventilation_preset_mode |
|
data: |
|
host: !secret nrf905_host |
|
preset_mode: '{{ preset_mode }}' |
|
- delay: 1 |
|
- service: homeassistant.update_entity |
|
data: |
|
entity_id: sensor.mechanische_ventilatie_status |
|
ventilation_set_speed_timer: |
|
mode: single |
|
fields: |
|
host: |
|
description: Hostname or ip |
|
speed: |
|
description: Set the fan speed (low/medium/high/max) |
|
timer: |
|
description: Set the fan timer (number of minutes) |
|
sequence: |
|
- service: rest_command.ventilation_set_speed_timer |
|
data: |
|
host: !secret nrf905_host |
|
speed: '{{ speed }}' |
|
timer: '{{ timer }}' |
|
- delay: 1 |
|
- service: homeassistant.update_entity |
|
data: |
|
entity_id: sensor.mechanische_ventilatie_status |
|
ventilation_set_voltage: |
|
mode: single |
|
fields: |
|
host: |
|
description: Hostname or ip |
|
voltage: |
|
description: Set the fan voltage, between 0.0 and 10.0 |
|
sequence: |
|
- service: rest_command.ventilation_set_voltage |
|
data: |
|
host: !secret nrf905_host |
|
voltage: '{{ voltage }}' |
|
- delay: 1 |
|
- service: homeassistant.update_entity |
|
data: |
|
entity_id: sensor.mechanische_ventilatie_status |
|
|
|
rest_command: |
|
ventilation_preset_mode: |
|
url: http://{{ host }}/api/v2/fan/setspeed.json?speed={{ preset_mode }} |
|
username: !secret nrf905_username |
|
password: !secret nrf905_password |
|
ventilation_set_speed_timer: |
|
url: http://{{ host }}/api/v2/fan/setspeed.json?speed={{ speed }}&timer={{ timer }} |
|
username: !secret nrf905_username |
|
password: !secret nrf905_password |
|
ventilation_set_voltage: |
|
url: http://{{ host }}/api/v2/fan/setvoltage.json?voltage={{ voltage }} |
|
username: !secret nrf905_username |
|
password: !secret nrf905_password |
Thanks! Ik gebruik dit voor json_attributes_path:
Dat zou voor de meeste mensen moeten werken. Werkt het niet dan kan je het ID achterhalen met curl en jq:
Of alleen het ID: