The following automation turns on a pump switch according to a schedule. Create a schedule
helper and set the time periods when the pump should be on.
alias: Scheduled Pump On
trigger:
- platform: state
entity_id: schedule.pump
from: 'off'
to: 'on'
condition: []
action:
- service: switch.turn_on
target:
entity_id: switch.pump
The following automation turns off the pump switch according to the same schedule but only if the state of switch.whatever
is off
.
alias: Scheduled Pump Off
trigger:
- platform: state
entity_id: schedule.pump
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: switch.whatever
state: 'off'
action:
- service: switch.turn_off
target:
entity_id: switch.pump
Depending on your requirements, the entity called switch.whatever
can be replaced by an Input Boolean. In addition, the two separate automations can be consolidated into a single automation.