Hue automation triggers stop working after restarting HA

Hi folks

I’ve very much been enjoying HA over the past few months. Initially set it up to get around some issues I was having with IFTTT, but it’s gradually growing arms and legs as I see what’s possible. However, I’m having a bit of a strange problem - the closest thing I could find in the archives is this which doesn’t seem to be resolved.

My setup is a Raspberry Pi (v1B) running Raspbian 10/Buster with HA Core.

I have the Philips Hue integration. I have an automation set up via the HA web interface which is triggered by a long press on one of the Hue dimmer switches. This works fine, except after a reboot or restarting the HA service. After either of those, the automation no longer triggers. I can fix it by editing the automation, deleting then re-adding the trigger.

I wonder if this is something to do with the Hue integration automatically detecting all the Hue lights on startup, assigning them different internal identifiers in some way? However, I do not know HA’s internals well enough to know if that’s the issue, or how to fix it if it is.

Has anyone else seen this behaviour or have any ideas I can try?

Thanks!

Please post the automation in question.

I would think that the entities would be created the first time the integration is set up then added to HA storage to quickly know what is there after a reboot. As I don’t have experience with the Hue integration, have you seen otherwise when editing the automation?

I had a similar issue for a while with zwavejs based automations. They simply didn’t fire after a restart but if I reloaded the automations everything was fine. One of the updates along the way seemed to resolve the issue. Never did figure out what was causing it.

Do the automations work after a restart if you reload automations?

If so and you’d like a temporary fix until the issue is actually resolved you can create an automation that will automatically reload your automations after a restart.

- id: hass_startup
  alias: '[Hass] Startup'
  description: ''
  trigger:
    - platform: homeassistant
      event: start
  action:
    - service: automation.reload

Thanks for the replies!

Please post the automation in question.

It’s fairly simple - when one of two switches is pressed, set the thermostat to low, and send my phone an alert (added for debugging once when I noticed it wasn’t working). It was all set up in the visual editor, which generated the following YAML:

alias: Bedtime
description: ''
trigger:
  - device_id: a62196ac162e1426e1703fead0a7e7c4
    domain: hue
    platform: device
    type: remote_button_long_release
    subtype: turn_on
  - device_id: 1054d26e5b67e04beb7148e90b3564a9
    domain: hue
    platform: device
    type: remote_button_long_release
    subtype: turn_on
condition: []
action:
  - service: climate.set_temperature
    data:
      temperature: 14
    entity_id: climate.living_room
  - device_id: 87ceef98abe5d07e9ccbabbcfd38078b
    domain: mobile_app
    type: notify
    title: bedtime
    message: bedtime
mode: single

I would think that the entities would be created the first time the integration is set up then added to HA storage to quickly know what is there after a reboot. As I don’t have experience with the Hue integration, have you seen otherwise when editing the automation?

I’ve no evidence at all - it was just a theory. However, on pasting the code above I noticed the device IDs that weren’t visible in the visual editor. I tried making a new automation after a reboot and the IDs don’t seem to have changed. So this probably isn’t the problem.

Do the automations work after a restart if you reload automations?

Thanks for this. I hadn’t realised it was possible to reload them. Yes, they do work after a reload, and your suggested “reload” automation does the trick! Much appreciated.

Would be good to know the root cause of the issue but at least for now this is a fix.