I have a camera, which it’s controlled by a RF switch. So, I want to turn on that switch when I’m not home, and turn it off when I’m home.
This is what I have so far:
- alias: Security CAM on when not home
trigger:
platform: state
entity_id: device_tracker.weehente_phone
from: 'home'
to: 'not_home'
for:
hours: '0'
minutes: '5'
action:
service: switch.turn_on
entity_id: switch.cam
What I don’t know is how to add another trigger when changing from “not_home” to “home” and another action: switch_turn.off
I know I can create another automation, but I’d rather have it all under the same one.
Example script with multiple actions. Believe you can simply just write multiple actions in this way in your automation. If not then just create a script with all the actions and call it from the automation.
Thought about that approach to, but with a single trigger you can get the “for x minutes” option, so you run the risk of toggling your switch rather rapidly.
With two triggers, each can have the “for x minutes” option.