How to pause automations when house is in "Guest" or "Away" mode?

Hey,

Sorry if this question has been answered, I haven’t found relevant results in the Community or the Docs.

So, if I have someone house-sitting and want everything to become “stupid” for a while, how do I set up a “Guest” mode that can override automations?

Do I setup a condition in each automation like “Guest mode status not on”? (I imagine guest mode as a Script, so that I can start it whenever).

A code example from someone’s config would be excellent, I really appreciate any help with this :slight_smile:

something like this:

  - alias: People not home
    id: 'People not home'
    # initial_state: 'on'
    trigger:
      platform: state
      entity_id: group.grand_family
      to: 'not_home'
      for:
        minutes: 10
    condition: []
#      condition: template
#      value_template: >
#        {{ is_state('input_boolean.guest_mode', 'off')}}
    action:
      - service: script.leave_home
      - condition: template
        value_template: >
          {{ is_state('input_boolean.notify_presence', 'on')}}
      - service: notify.notify
        data_template:
          message: >-
            {{as_timestamp(now()) | timestamp_custom("%X") }}: 
            Emtpy House, securing the premises.

of course you have to adapt things, but the main system could be like this.

in the script you could do anything you want. switch of all automations, or a subset you’ve declared for that.
Easiest thing to do that is create a group with automations, and switch of/on that group.

in above automations all is done automatically reading the state of the group.grand_family, which holds all devices.
you could of course also do it manually by flipping an input_boolean.

many many variations possible, so start and see where you want to alter setup to your needs.

Thanks a lot! Will attempt adapting the rules to my devices.

I think the simpliest way is a script where you turn the wanted automations off und another one to turn them on.

script:
  guest_mode_on:
    sequence:
      - service: automation.turn_off
        data:
          entity_id: automation.bla_bla1
      - service: automation.turn_off
        data:
          entity_id: automation.bla_bla2
     ...

  guest_mode_off:
    sequence:
      - service: automation.turn_on
        data:
          entity_id: automation.bla_bla1
      - service: automation.turn_on
        data:
          entity_id: automation.bla_bla2
     ...

So you don’t have to edit every automation with a condition.

You can take a Template Switch to call the scripts.

EDIT: Sorry, forgott the sequence:

Cool, this might be easier, thanks!

this could help you too:

  - alias: 'Automate GuestMode'
    id: 'Automate GuestMode'
   #initial_state: on
    trigger:
      platform: state
      entity_id: input_boolean.guest_mode
    condition: []
    action:
      service_template: >
        homeassistant.turn_{{ 'off' if is_state('input_boolean.guest_mode', 'on') else 'on' }}
        entity_id: group.guest_mode_automations

group:
  guest_mode_automations:
    name: Guest mode automations
    entities:
      - automation.bla_bla1
      - automation.bla_bla2
      - automation.bla_bla3

or use the same setup with @VDRainer 's script, calling each automation individually. IN which case you could use

     service_template: >
        homeassistant.turn_{{ 'off' if is_state('input_boolean.guest_mode', 'on') else 'on' }}
        entity_id: script.guest_mode_{{ states('input_boolean.guest_mode')}}

btw: if you care for shorter and better readable yaml, this would be an option too:

sequence:
  - service: automation.turn_off
    entity_id: 
      - automation.bla_bla1
      - automation.bla_bla2
      - automation.bla_bla3

or use the template switch:

switch:
  - platform: template
    switches:
      guest_mode:
        friendly_name: Guest mode switch
        value_template: >
          {{ is_state('input_boolean.guest_mode', 'on') }} # this needs some figuring out, depending on what us use: input_boolean, input_select, boolean sensor etc
        turn_on:
          - service: script.guest_mode_on
        turn_off:
          - service: script.guest_mode_off
3 Likes

Or…

You could set up an automation with the appropriate trigger and just set the group.all_automations to off.

depending on the automations in the system, i wouldn’t advice to do so, it would stop HA from working completely.
it should be fairly easy to throw some relevant automations in a dedicated group to switch on/off, and keep the rest of the system automated

He said he wanted his house “to become stupid for a while”. I was just telling him how to do that.

If he doesn’t want it completely stupid then the things he doesn’t want to work he could put in a single group and then turn off only THAT group.

check, that would be best. very nice property of the group that is, makes things easy.
thats why i suggested that 2 posts above :wink:

1 Like

I know…

I was agreeing with you! :laughing:

But if he does want it to be completely stupid there is always that option too.

1 Like