I have been working on this one for several days and am stumped at the moment…
What I am trying to do:
Turn on the pond filter for 20 minutes after the weather changes from rain to anything else, if the sun is above the horizon, if it is above 45F, and if the filter’s switch has been off for the last hour. If it rained and stopped multiple times after not having been on over the previous 60 minutes, it should only trigger once. This keeps the filter from running nonstop if popup storms rapidly come and go.
What it currently does:
Turn on the pond filter for 20 minutes after the weather changes from rain to anything else, if the sun is above the horizon, if it is above 45F. It will run multiple times per hour though if there are popup storms. It also seems to turn on once an hour ALL day until the sun goes down. This is happening because there are multiple triggers. If I try to move the 1 hour time trigger to the condition using
- condition: state
entity_id:
- switch.waterfallpump
to: 'off'
for:
hours: 1
HASS will complain saying that the dictionary of null is not valid for the state condition. The current running YAML is below.
##########################################################
# Turn On Pond Filter After Rain Stops
##########################################################
- alias: "Clean pond after rain"
trigger:
- platform: state
entity_id:
- sensor.dark_sky_icon
from: 'rain'
- platform: state
entity_id:
- switch.waterfallpump
to: 'off'
for:
hours: 1
condition:
condition: and
conditions:
- condition: state
entity_id: sun.sun
state: 'above_horizon'
- condition: numeric_state
entity_id: sensor.dark_sky_temperature
above: 45
action:
- service: homeassistant.turn_on
entity_id:
- input_boolean.automation_triggered_pump
- switch.waterfallpump
##########################################################
# Turn Off Pond Filter After Cleaning Cycle
##########################################################
- alias: 'Pond cleaning complete'
trigger:
- platform: state
entity_id:
- input_boolean.automation_triggered_pump
to: 'on'
for:
minutes: 20
action:
- service: homeassistant.turn_off
entity_id:
- input_boolean.automation_triggered_pump
- switch.waterfallpump
I have also been trying to figure out how to get automations to not run if something was triggered by a user and not by an automation. IE: If I turn on the pond filter by hand so I can enjoy the waterfall and it begins raining, it will automatically turn off 20 minutes after rain stops. I would like the automation to “pause” until the state returns to the default state, if that is even possible. This is relevant for living room lamps too as they kick on during storms and off after the fact. If I want it on though that environment triggered automation is a pain.