Enable automation via another automation

I apologise if my question sounds stupid but I’m new to HA.
I have a motion sensor in a garage that is linked to an automation. When activity is detected, it sends a TTS text to my Google Home device that warns me of the motion.

Sometimes I need to work in the garage so I want the automation to remain off (I am looking at using NFC tags for this). What I would like to do is to automatically re-enable the automation (the Google Home sound alert) if it has been off for, say, 5 minutes. This is in case I forget to re-enable it.

Is there any way I can set up a new Automation that look at the state of the motion_automation, and if it has been off for more than 5 minutes, it automatically re-enables it?

If you plan to turn off the automation via a NFC tag, you can always turn it back on when the NFC tag is not detected, or trigger another automation to turn on the motion automation if it has been off for >5.

  action:
  - data: {}
    entity_id: automation.myautomation
    service: automation.turn_off
  initial_state: false

Thanks, that seems to be working if I execute it manually, but when I set the trigger, I don’t actually know what state I need to query. I guess the automation doesn’t have a ‘enabled’ or ‘disabled’ state?

I don’t think that would work. I am planning to use the Hass NFC app (although the tags I already have don’t seem to be compatible), so the tag is only used to run a script that will disable the automation, it won’t stay connected to the phone.
I wanted to enable the automation via another automation, but I still don’t understand how I can query the status of an automation (enabled/disabled).

How do you plan on turning off the motion automation?

EDIT:

  - alias: Automation2
    trigger:
      - platform: state
        entity_id: automation.automation1
        to: 'off'
        for:
          minutes: 5
    action:
      - service: automation.turn_on
        data:
          entity_id: automation.automation1

Thanks, I think I made it work, although I had to reboot Home Assistant a couple of times because the second automation was switching itself off after 2 seconds.

I currently turn off the motion automation by simply disabling it on the app on my phone (until I find a way of doing this with NFC tags), so the disabling process itself isn’t actually automated.

Glad you got it working for you.

You can always use telegram or a scene button to turn off the motion automation.

It would be easier to create an input_boolean like input_boolean.working_in_garage. Turn on this input_boolean with the NFC tag and then use this input_boolean as a condition for the motion automation like this:

condition:
  - condition: state
    entity_id: 'input_boolean.working_in_garage'
    state: 'off'

Add another automation to turn off the input boolean after x minutes.

1 Like