Automations keep being disabled in under a minute after enabling them (in one area)

UPDATE: ive added error logs and YAML.

Since a couple of updates ago 2 of my Ikea ZigBee switches stopped working in one area (lights/plugs were OK, just the switches). A Ikea STYRBAR 4 way switch and a RODRET. I just started looking into this and noticed there was another update so I did that hoping it would sort it out, but it did not.

So I did a bit of digging and noticed the relevant blueprint automations were off, odd I thought but enables them and tested switched. All seems to be working OK. Then (maybe 30 seconds later) the automations were then disables by HA. I tried turning them back on carried on testing and every time I enable them they work fine (I did a few things with the switches and all OK) and then within under a minute were automatically disabled.

UPDATE: actually I think the automations are being turned off due to error, not after a period of time.

Its all the automations in one area, all of them are being automatically turned off in under minute, maybe 30 seconds, if I enable them.

I am however getting this in the logs when I click the on button on RODRET switch, off seems to be working, this is what seems to be turning off automation.

Log details (WARNING)

Logger: homeassistant.components.automation.mbed_main_switch
Source: helpers/script.py:2064
integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 21:16:41 (1 occurrence)
Last logged: 21:16:41

MBed Main Switch: Choose at step 2: choice 2: If at step 1: Error in 'if[0]' evaluation: In 'and' (item 1 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event' In 'and' (item 2 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event' In 'and' (item 3 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event'

Log details (ERROR)
Logger: homeassistant.helpers.template
Source: helpers/template/__init__.py:1750
First occurred: 21:16:41 (3 occurrences)
Last logged: 21:16:41

Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.command == 'off' }}'
Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.cluster_id == 6 }}'
Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.endpoint_id == 1 }}'```
alias: MBed Main Switch
description: ""
use_blueprint:
  path: damru/ikea-rodret-dimmer-remote-e2201-zha-control-anything.yaml
  input:
    remote: 06b5848a51721191ae65ee591992401b
    off_press_action:
      - target:
          area_id: benroom_ben
          entity_id: switch.mbed_plug_zigbee_router_tablet
        data: {}
        action: homeassistant.turn_off
    on_press_action:
      - target:
          entity_id:
            - switch.mbed_plug_zigbee_router_tablet
            - light.mbed_side
        data: {}
        action: homeassistant.turn_on
    on_hold_action: []
    off_hold_action: []
    on_double_press: true
    on_double_press_action: []
    helper_max_loops: 10
    off_double_press: true
    off_double_press_action: []```

You must have an automation that is disabling them.

It’s unlikely that automations switch off by themselves.
Normally it’s not advised to switch them on/off as a way to control stuff but you would not be the first or last to do it that way.

Make sure that you don’t have another automation/script which controls these automations.

This happens every time I get the error in the log. My understanding is errors can disable automation. Maybe the blueprint has got broken due to HA Core update. That is the only thing that makes sense.

I dont even know how to do an action to disable and automation.

I’v changed nothing, for months. Everything was working fine. And I agree, a trigger that turns off an automation seems very bad practice, I don’t even know how I would do this.

This happens when I get the error (I updated the question adding YAML and error, not sure if you saw this). Whenever I get error the automation is disabled.

Doesn’t the log reveal anything or the traces from one of the automations that gets turned off?

The logs are
image

Log details (WARNING)

Logger: homeassistant.components.automation.mbed_main_switch
Source: helpers/script.py:2064
integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 21:16:41 (1 occurrence)
Last logged: 21:16:41

MBed Main Switch: Choose at step 2: choice 2: If at step 1: Error in 'if[0]' evaluation: In 'and' (item 1 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event' In 'and' (item 2 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event' In 'and' (item 3 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event'

Log details (ERROR)
Logger: homeassistant.helpers.template
Source: helpers/template/__init__.py:1750
First occurred: 21:16:41 (3 occurrences)
Last logged: 21:16:41

Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.command == 'off' }}'
Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.cluster_id == 6 }}'
Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.endpoint_id == 1 }}'

This happens when I press off, on seems to work. Maybe a recent update broke the blueprint

The logs are

Log details (WARNING)

Logger: homeassistant.components.automation.mbed_main_switch
Source: helpers/script.py:2064
integration: Automation ([documentation](https://www.home-assistant.io/integrations/automation), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+automation%22))
First occurred: 21:16:41 (1 occurrence)
Last logged: 21:16:41

MBed Main Switch: Choose at step 2: choice 2: If at step 1: Error in 'if[0]' evaluation: In 'and' (item 1 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event' In 'and' (item 2 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event' In 'and' (item 3 of 3): In 'template' condition: UndefinedError: 'None' has no attribute 'event'

Log details (ERROR)
Logger: homeassistant.helpers.template
Source: helpers/template/__init__.py:1750
First occurred: 21:16:41 (3 occurrences)
Last logged: 21:16:41

Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.command == 'off' }}'
Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.cluster_id == 6 }}'
Template variable error: 'None' has no attribute 'event' when rendering '{{ wait.trigger.event.data.endpoint_id == 1 }}'

This happens when I press off, on seems to work. Maybe a recent update broke the blueprint

Do you have the automation tagged with the area benroom_ben?

Don’t put Automation in an area. If you do and you then turn off the area (a common thing to do) you’ll turn off the automation. I suspect something along these lines is what is happening.

1 Like

Remove that line or remove the area from the automation as suggested above.

The blueprint is using homeassistant.turn_off, which switches off everything in the targeted area.

2 Likes

I just had something very similar happen - the STYRBAR remote somehow lost all of its trigger events. You’re not using zigbee2mqtt by any chance? It took about 10 resets before it came alive again with all events triggering.

It really doesn’t feel like the same thing. Sounds like you had automations which weren’t being triggered, not automations that were disabled.