Hi there,
I have decentralized ventilation devices in the house, these can be switched on or off by calling a URL.
The integration looks like this:
- platform: command_line
switches:
luefterwzdg:
command_on: "/usr/bin/curl -X GET http://192.168.178.39/?power=on"
command_off: "/usr/bin/curl -X GET http://192.168.178.39/?power=off"
value_template: '{{ value == "1" }}'
friendly_name: Lüfter WZ-DG
I also attached two window sensors to each window. This enables the to recognize the status between, closed, opened or tilted (Germany: geschlossen, geöffnet or gekippt).
I integrated these as follows:
fensterstatus_schlafzimmer_dg:
friendly_name: Fenster Schlafzimmer-DG
value_template: |
{% set b1 = states('binary_sensor.lumi_lumi_sensor_magnet_aq2_007cf906_on_off') %}
{% set b2 = states('binary_sensor.lumi_lumi_sensor_magnet_aq2_698aff06_on_off') %}
{% if b1 == 'off' and b2 == 'off' %} geschlossen
{% elif b1 == 'on' and b2 == 'off' %} gekippt
{% elif b2 == 'on' %} offen
{% elif b1 == 'unavailable' or b2 == 'unavailable' %} nicht verfügbar
{% else %} ?
{% endif %}
icon_template: |
{% set b1 = states('binary_sensor.lumi_lumi_sensor_magnet_aq2_007cf906_on_off') %}
{% set b2 = states('binary_sensor.lumi_lumi_sensor_magnet_aq2_698aff06_on_off') %}
{% if b1 == 'off' and b2 == 'off' %} mdi:window-closed-variant
{% elif b1 == 'on' and b2 == 'off' %} mdi:angle-acute
{% elif b2 == 'on' %} mdi:window-open-variant
{% elif b1 == 'unavailable' or b2 == 'unavailable' %} mdi:exclamation
{% else %} ?
{% endif %}
Now I want to achieve the following.
If the window is open or tilted for more than a minute, the fan should be switched off.
When the window is closed again for at least 5 minutes, the fan should switch on again.
Since I am a beginner, I would be very happy to receive help.
Greetings Werner