I have one automation monitoring smart AC socket for switch.turn_on event. If I see power consumption rising, everything is good and the switch stays on. But if no power is flowing, user receives immediate notification to plug in the AC cord (immediate is the important part here…), and switch.turn_off is called for the smart AC socket. This is for controlling our car heating in winter months and checking if the AC- power cord is plugged in to our car.
Now I’ve made bunch of other cool automations around the smart switch and car heating. For example I’m checking on weekdays at 10 p.m. that the AC-cable is connected (for tomorrow morning heating). This requires the same switch.turn_on command, but this time if power is flowing, cut the power anyways after few seconds.
Then there’s third automation which is the odd one out. It is monitoring our car arriving home. Logic after detecting the car at ‘home’ is following:
-Turn on smart AC socket
-Wait for the following triggers: 1) power consumption increases from zero or 2) front door opens
IF power consumption increased, everything good. User remembered to plug the cable in
ELSE front door opened. Notify user that the AC cord is unplugged.
-In both cases turn off smart AC socket
Now these three automation have lead me into very complicated solutions where I have to e.g. temporarily disable 2 automations in order to execute one. For example the very first automation which is monitoring the AC power cannot be running while I’m running the sequence for ‘car arriving home’ because the first it would immediately notify user for “AC cord not plugged in” when the smart AC is switched on and there’s no cable yet.
What I would like to see is an option that automation could be triggered without it being able to call other automations. If automation has switch.turn_on service call, all the other automations would neglect that trigger.
This might be a feature request, but someone could maybe already have a solution to this?
Thanks for pointing that out.
Car coming home -automation could be triggered either by me or by my wife. I’d need to follow the home/not_home state for the both of us. That should be doable, although a bit messy solution.
For the 1st and 2nd automation I should be able to tell if the switch.turn_on was directly accessed by user, or if it was executed from other automation that calls it as an action. For that the presence is not helpful.
These are the stripped down versions of my 2 automations. They probably won’t work the way they are presented here because the script would be called twice and the 1st automation is nested inside the 2nd automation. But this example should clarify my idea behind the question on ‘automation not triggering another automation’
automation:
- alias: '1st - Car heating check manual'
trigger:
- platform: state
entity_id: switch.car_heating_switch
to: 'on'
action:
- service: script.check_heating_cable_connected
- alias: '2nd - Car heating check at 22:00'
trigger:
- platform: time
at: "22:00:00"
action:
- service: switch.turn_on #This will trigger the 1st automation
entity_id: switch.car_heating_switch
- service: script.check_heating_cable_connected
- service: switch.turn_off #This service I only need for the 2nd automation
entity_id: switch.car_heating_switch
script:
check_heating_cable_connected:
sequence:
- wait_for_trigger:
- platform: template
value_template: "{{states('sensor.car_heating_power')| int > 100 }}"
timeout:
seconds: 7
continue_on_timeout: true
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.car_heating_power
below: 100
sequence:
- service: switch.turn_off
entity_id: switch.car_heating_switch
- service: notify.mobile_app_iphone
data_template:
message: "Check car heating cable"
default:
- service: script.do_nothing