Automations failing

I moved my HA to a Raspberry Pi 5, after some hardware issues, it seems to be working again. However, my automations don’t seem to be working.

I assumed this was because the device ids have changed, but recreating the automations didn’t solve the problem and the Yaml looks the same before and after.

alias: Front Light Sunset
description: ""
triggers:
  - trigger: sun
    event: sunset
    offset: "-00:30:00"
conditions: []
actions:
  - type: turn_on
    device_id: 7448696ccd73a84e00f3bdbae0e19f3f
    entity_id: d05e45e8bf6352728c7ba32cc8c03a6a
    domain: switch
  - type: turn_on
    device_id: 94a15a360266e634cddca85f19c0d1eb
    entity_id: 2a6abc9c6bab0fb9cdf84f29616e2389
    domain: switch
mode: single

The devices work from the Dashboard and Alexa BTW. But running the actions from the automation does nothing.

Any bright ideas?

Try

conditions: time

Thanks, but the actions don’t run when i test them standalone, which makes me think it’s a device problem.

What is the exact thing you’re trying to send the turn_on to? A switch? If so, I would expect the entity_id to look very different: switch.xxxx. Also, I have not seen device_id passed for this kind of purpose. What integration do the devices (switches, I assume) come from?

  • corrected “intestine” to “I assume” - lol.

Is that actually the entity_id you see when you look the entity up in Settings?

The automation is controlling an Insteon device(s).

The new automations i created look identical to the old automations, but i assume that HA may have updated the device ids when i reinstalled HA.

I was trying to find the id attached to the device, so i could see if it matched the automation. I obviously didn’t look hard enough. I suspect you are correct that it is a device id issue, as the ‘Then’ statement does not run.

I need to look at the log to see what error I’m getting.

Change it to entity ids instead.

When you use device ids all it does is find the device and then select the entity that is set as the default entity for that device.
You can select the entity id directly and avoid the problems in the future, because if you move hardware again or replace a device you are back to this problem.
device ids can’t be changed on the device. Entity ids can be renamed, so you can just rename the entity to what the old entity was named and everything will work again.

1 Like

It’s not device ID, I am 99% sure; and I leave the 1% only in case there is some weird legacy thing going on.

If you got to Settings → Devices & services, you’ll find an Entities tab that lists all of your entities (and it’s searchable). Find your entity, click on it, and find the gear icon. There you should find an Entity ID field that you can, if you choose, edit. It will almost certainly be prefixed with “switch.” (and you can’t change that part).

I doubt you should be passing a device_id field but I can’t be certain since I don’t know that vendor’s products.

Once you are sure you’ve got the right entity_id, we should be able to figure out the rest.

alias: Front Light Off
description: ""
triggers:
  - trigger: time
    at: "23:00:00"
conditions: []
actions:
  - action: light.turn_off
    metadata: {}
    data: {}
    target:
      entity_id:
        - light.keypadlinc_on_off_20_43_b8_main
        - light.switchlinc_relay_dual_band_20_7e_2e
mode: single

This works.

I can change the device type to Light, BTW.

It is not a “legacy thing”, it is a device action, which is the action type at the very top of the list when using the visual automation/script editor. They are meant to be easy to use in the visual editor but unfortunately results in near unreadable YAML as they use the hidden hardcoded ids for not only the device but also the entity it really operates on.

The visual editor also allows for creating device triggers and device conditions, with the same intent (ease of use), limitations (no templates) and resulting awful YAML.