Hi There, I have some issues to create an automation like this:
My humidifier have to turn on (and turn off after 15 min) every 30 min, if one of my presence sensors are occupied.
I think, need to create a 30 min timer starts when one of the presence sensor turns to occupied, but I haven’t skills to create it.
Can someone help me?
Create a 15 minute timer in Helpers. Then, use the time_pattern trigger (set at 30 minutes). Then, add a condition with your presence sensor. Finally, do your action blocks.
mode: single
trigger:
- platform: time_pattern
minutes: /30
id: time
- platform: state
entity_id:
- timer.[your timer] # Set your timer entity here
id: timer_finish
from: active
to: idle
condition:
- condition: state
entity_id: binary_sensor.[your presence sensor] #set your presence sensor here
state: "on"
action:
- if:
- condition: trigger
id:
- time
then:
- service: timer.start
target:
entity_id: timer.[your timer] #set your timer here
- service: switch.turn_on
target:
entity_id: switch.[your humidifier] #set your humidifier here
else:
- service: switch.turn_off
target:
entity_id:
- switch.[your humidifier] #set your humidifier here
alias: "INGRESSO: PROFUMATORE AUTO ON_PROVA"
description: ""
mode: single
trigger:
- platform: time_pattern
minutes: /45
id: time
- platform: state
entity_id: timer.profumatore_ingresso #entity id it's ok
id: timer_finish
from: active
to: idle
condition:
- condition: or
conditions: #there are 4 presence sensor on conditions, it works
- type: is_occupied
condition: device
device_id: 90f9bf4a8151618d1ec93137a1ad09c1
entity_id: 9089c1adc22429cfa1c1e42bcf114bb5
domain: binary_sensor
- type: is_occupied
condition: device
device_id: 41da0ff5f27de974349e1f216ca24258
entity_id: 12244c8f323109c185d6cda9f27ed3ea
domain: binary_sensor
- type: is_occupied
condition: device
device_id: aeafd41ed8bdcef95c1f2c68293e6d3c
entity_id: 7487ed8d9fcd4373ab18d2973d7a607d
domain: binary_sensor
- type: is_occupied
condition: device
device_id: 408c2f848c057fbd4be94a4a5bbcfdbd
entity_id: 8dd2545f75c84db1cba5a50ea83c64a6
domain: binary_sensor
- condition: time #time condition works
after: "10:30:00"
before: "20:00:00"
weekday:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
action:
- if:
- condition: trigger
id:
- time
then:
- service: timer.start
target:
entity_id: timer.profumatore_ingresso
data: {}
- service: switch.turn_on
target:
entity_id: switch.profumatore_spray_eco #it starts in eco mode
data: {}
else:
- service: switch.turn_off
target:
entity_id:
- switch.profumatore_spray_off #it stops
data: {}
there is an errore, the humidifier doesn’t turn on every 45 from last turn off, but every 45 of every hour, ex: if the humidifier starts at 17:00 it works until 17:15, so if it’s all ok it turns to on at 18:00, but it starts at 17:45…