Hi. I am new here. Still learning the automations.
I created simple code for my greenhouse vents timer. I would like to turn the vents at 8.00 AM (or maybe 1-2 hour after sunrise). The vents should be turned on each half hour for 5 minutes if the temperature rises over 20 deg C. I followed the solution of smartynov Simple Automation to Cycle Through Turning a Switch On and Off Regularly.
All runs on PC, Windows 10, VirtualBox, HA with ZHA. Now, the automation works good.
alias: Vklop ventilatorjev Lesenjak
description: Časovni vklop ventilatorjev glede na temperaturo
trigger:
- platform: time_pattern
minutes: /30
condition:
- condition: time
after: "08:00:00"
before: "22:00:00"
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.termometer_lesenjak_th02_temperature
above: 15
- condition: numeric_state
entity_id: sensor.termometer_lesenjak_th02_humidity
above: 80
action:
- service: light.turn_on
metadata: {}
data: {}
target:
entity_id: light.stikalo_lesenjak_minizb_light
- delay:
minutes: 5
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.stikalo_lesenjak_minizb_light
mode: restart
I dont’t know if I need mode:restart.
The automation should run always and be active even the computer and/or HA is rebooted, so I have also to find a solution to start this it over windows.
Now I would like to add temperature condition: if temperature goes over 35 degC. the vents should turn on each 15 minutes for 5 minutes, or better, the bigger temperature, more frequently and longer the vents should run.
Maybe some of you have better solution?