Scenario: I have an automation called John’s AC. John’s AC has four separate triggers. Max, minimum lower temperature, lower temperature, upper temperature, and max upper temperature. If the room temperature is below max lower temperature or lower temperature and it warms up to either of those two triggers, the automation gets triggered and creates a log event.
Question: Is there some way to make triggers enable and disable other triggers in their conditions? What I was thinking about doing is having upper temperature and max upper temperature be the only two active triggers. If either was hit, John’s AC would then turn on and the triggers for lower temperature and max lower temperature would be enabled until one of those two triggers was hit, at which point John’s AC would turn off, and those two triggers would be disabled. until upper temperature got hit again.
Admittedly, it’s a lot of work, just to avoid a couple of log messages, but just for shits and giggles, I wonder if it’s possible.
You can use trigger IDs and conditional execution to accomplish this. Not precisely your use case, but I have an automation that manages two ornamental lamps via two smart buttons: one lamp and one button on each nightstand to either side of the bed in our main bedroom.
A single click of either button toggles the lamp on that nightstand. A double click on either button turns off both lamps, and a long press on either button calls a script that turns off all the lights inside and outside the house, by area.
I use trigger IDs to tag the button events, and then use that ID in conditional action logic to toggle the lamps, turn them off, or call the shutdown service.
You can probably use trigger IDs for your upper and lower bounds to conditionally execute your air conditioner functions.
Here’s the YAML, if you’d like to see how I use it.
alias: "QoL: Bedroom Smart Button Features" description: |- Short press toggle local ornamental lamp (amethyst, salt) Long press turn off both ornamental lamps Double press call Shutdown Everything automation triggers: - device_id: b11766b6ab9a7ae6f752e70514562f18 domain: zha type: remote_button_short_press subtype: button_1 trigger: device id: bedroom_button_short_press_right - device_id: b11766b6ab9a7ae6f752e70514562f18 domain: zha type: remote_button_double_press subtype: button_1 trigger: device id: bedroom_button_double_press_right - device_id: b11766b6ab9a7ae6f752e70514562f18 domain: zha type: remote_button_long_press subtype: button_1 trigger: device id: bedroom_button_long_press - device_id: 2a9e9c869c5e611e791232491169da77 domain: zha type: remote_button_short_press subtype: button_1 trigger: device id: bedroom_button_short_press_left - device_id: 2a9e9c869c5e611e791232491169da77 domain: zha type: remote_button_double_press subtype: button_1 trigger: device id: bedroom_button_double_press_left - device_id: 2a9e9c869c5e611e791232491169da77 domain: zha type: remote_button_long_press subtype: button_1 trigger: device id: bedroom_button_long_press conditions: [] actions: - if: - condition: or conditions: - condition: trigger id: - bedroom_button_short_press_right then: - action: light.toggle metadata: {} data: {} target: entity_id: light.salt_lamp_switch - if: - condition: or conditions: - condition: trigger id: - bedroom_button_short_press_left then: - action: light.toggle metadata: {} data: {} target: entity_id: - light.amethyst_lamp - if: - condition: or conditions: - condition: trigger id: - bedroom_button_long_press then: - action: light.toggle metadata: {} data: {} target: entity_id: - light.salt_lamp_switch - light.amethyst_lamp - if: - condition: trigger id: - bedroom_button_double_press_right - bedroom_button_double_press_left then: - action: light.turn_off metadata: {} data: {} target: entity_id: - light.amethyst_lamp - light.salt_lamp_switch mode: restartAnother idea, you could use a
wait_foraction in theturn_onaction to wait for a lower bound trigger to execute yourturn_offaction. I’ve used that for actions that turn on a light when motion is detected, and then wait for motion to clear before turning off the light.Really, you could peel.it a bunch of different ways, but these are trucks I’ve used in my automations.
I think you could create a toggle entity. When the high automation goes off, set it to True. Have logic in the high automation that says don’t go off if true. For the low automation, have it only go off if true. And then set it to false when it’s done.
I’m not sure if I explain that well. But basically the toggle entity would act as a switch that enabled the automation to run, because the automation would check the state of the toggle every time.
That sounds like it would require two automations. All of the triggers are in one single automation.
If I’ve understood @[email protected] correctly, this won’t need 2 automations
When you exceed a max, I presume you’re triggering the AC to heat / cool, at this point you’d also set the “dontlogthisagain” boolean.
Then, when you’d reached the correct temp range, then you can turn off the AC and reset the “dontlogthisagain” boolean.
The conditional statements would then be “(is the temp outsode of range) AND (dontlogthisagain=True)”
You’d need to check the logic is the right way around there, but - in my head - thst should work.
Edit: actually, thinking anout this some more, you might not need the boolean, you could use the on/off state of the AC unit itself
I have separate automations for turning on the HVAC and turning off the HVAC. When the “Turn HVAC On” automation gets triggered, one of the actions is to enable the “Turn HVAC Off” automation. One of the actions on “Turn HVAC Off” is to disable itself.
Does that get you what you want?
I don’t really want to use two separate automations. I just figure it’s more cluttered that way. And if I can do it all in one automation, why not do it? That definitely would work, but I want to see if I can do it in a single automation instead.
I have all of my automations for HVAC in a package (https://www.home-assistant.io/docs/configuration/packages/). Maybe it’ll seem more tidy/less cluttered if you do it that way?




