Override switch on time scheduled action

Hi there,

I have a time action switch, it switches my stereo, TV etc off when we go to bed. Most of the times we go to bed before 00:00 so the switch is set to switch off if that moment arrives. Occasionaly we stay up…later than that hour. I would like to have an override switch that tells HA not to to that action if i flipped the switch.

If anyone could give me a clue of what function to use…?

This is the automation i have now:

- alias: 'Neo Switch on'
  trigger:
    platform: time
    # When 'at' is used, you cannot also match on hour, minute, seconds.
    # Military time format.
    at: '16:30:00'
  action:
    - service: switch.turn_on
      entity_id: switch.neo_coolcam_power_plug_12a_switch_5

- alias: 'Neo Switch off'
  trigger:
    platform: time
    at: '00:00:00'
  action:
    - service: switch.turn_off
      entity_id: switch.neo_coolcam_power_plug_12a_switch_5

Turn off the 'Neo Switch off' automation in the front end. Every automation that is not hidden has an enable/disable toggle switch.

You could write another automation to re-enable the 'Neo Switch off' automation at sunrise.

I’m waiting for a strain gauge sensor to arrive to actually detect if I’m in bed. Detecting if you are actually in bed would be a better solution for you too.

For these cases I am using an input_boolean and checking the value of the input_boolean as a condition on my automation. Your automation would then look like this:

- alias: 'Neo Switch off'
  trigger:
    platform: time
    at: '00:00:00'
  condition:
    - condition: state
      entity_id: input_boolean.neo
      state: 'on'
  action:
    - service: switch.turn_off
      entity_id: switch.neo_coolcam_power_plug_12a_switch_5

And optionally you could have an automation that resets the input_boolean.neo.

1 Like

What advantage does this have over using the automation on/off switch that is already present in the front end?

Not really any if you are using it for one automation. If it concerns only one automation I’d probably go with the automation switch built-in, but for example with a vacation mode there are multiple automations I’d like to stay on which is why I like the input boolean better for those cases.

1 Like

Hi, that is exactly what I am doing, using it in a global var to be used in several automations. Working fine so far!.
Thanks

Fair enough. I actually have an input_select so I can set more than one mode (normal, away, guest & away, guest & home, all off).

1 Like