Automations GONE

Advanced mode is on. It just isn’t showing up…

Easist way is in develper tools → template. Pick any entity_id from the device.

Here’s the device ID for one of my zwave locks.

If you created the blank automations.yaml file already, restart HA.

Thanks, guys, for your help. I’m getting it done… slowly.

The hard part is figuring out the entity IDs. My automations.yaml file was 1800 lines of code. This will take a while.

I think I’m following what you’re saying, but don’t really see the difference. If I change a device, its ID along with all the Entity IDs associated with that device will also change, right?

Entities are name based, so when you replace a device and give it the same name, it will work.
This won’t be the case with device id’s :thinking:

Have a look at my automation, it doesn’t use any id’s, only entity names :wink:

alias: NightLight
description: toggle switch
trigger:
  - platform: state
    entity_id:
      - sensor.bedroomswitch_action
    to: "on"
    id: "on"
  - platform: state
    entity_id:
      - sensor.bedroomswitch_action
    to: "off"
    id: "off"
condition: []
action:
  - service: light.toggle
    data:
      transition: 2
    target:
      entity_id: light.bedroomnightlight
mode: single

My entity IDs are random numbers just like the device IDs.

- id: '1689273577770'
  alias: Master Bedroom Dimmer Long Press 20%
  description: ''
  trigger:
  - platform: device
    device_id: e16fc5fda0a493c6ff5c9c79b58af70b
    domain: zwave_js
    type: event.value_notification.central_scene
    property: scene
    property_key: '002'
    endpoint: 0
    command_class: 91
    subtype: Endpoint 0 Scene 002
    value: 2
  condition: []
  action:
  - type: turn_on
    device_id: e16fc5fda0a493c6ff5c9c79b58af70b
    entity_id: 1c93305e9794c1a5658977d05196d4d7
    domain: light
    brightness_pct: 20
  mode: single

How did I screw that up?

Hmm. That is interesting.

If I create an automation in the service call it works as it should.

description: ""
mode: single
trigger: []
condition: []
action:
  - service: light.turn_on
    data: {}
    target:
      device_id: 7debd32ca1c4f1429f9d4f86473aa070
      entity_id: light.back_house_potlights

I don’t usually use the UI for automations, I do it all in YAML. I’ve never seen something like that before. You might have to manually go through your automations and specify the entity_id where required.

You did not screw that up. It is a change in the automations editor since a few versions, before the entity_ids were readable too.

Edit: see Jason’s example above.

I think this explains it, Jason uses a service call with a device id, you use a device automation

1 Like

Good catch!

and in the latter example, the device_id can be deleted without consequences :wink:

Not if they refer to different devices.

  - service: light.turn_on
    data: {}
    target:
      device_id:
        - 7debd32ca1c4f1429f9d4f86473aa070
        - 4be59b51cd419d64829c0e0aa52d5dd5
      entity_id: light.bathroom_shower_light

I’m not that confident with yaml yet… :pensive:

I think I’m grasping this now… so in many cases turning on a light via a service call rather than through the device will help avoid my situation as long as I rename the new device IDs the same (which I did).

2 Likes

sure you can mix entities and device_id’s:


action:
  - service: light.turn_on
    data: {}
    target:
      entity_id: light.flux
      device_id: 7583e30d7b3b33083f94237b4130162c

but in the above, the device/entity are not the representing the same device🤔

So in general, just avoid using device_id’s, and use ‘choose entity’ :wink:

I’m glad you agree with me :wink:

OMG this happen to me also but I haven’t changed anything. Some of the automations are still working tho it seems. I have a few disabled I use for the holidays and it seems that nothing past this area is working in the house. You would think with the new repairs area it would put up a warning there and not disable all the automations.

1 Like

Okay after over 5000 lines finally found it. Looks like one of my devices for a condition it doesn’t like anymore. Also found 2 weird lines in the yaml.

- *id001
- id: '1692482822877'

and

- &id001
  id: '1692482428289'

Any idea where the *id001 and &id001 would of come from? I deleted them and the automations saved and loaded with no errors.

Those are YAML anchors. They are used to repeat code in YAML. I don’t think the UI based automation editor uses them so maybe you mistakenly copied and pasted them from somewhere?

Search for “anchor” on this page.
http://thomasloven.com/blog/2018/08/YAML-For-Nonprogrammers/

1 Like

Just happened to me. I tried to update firmware on my usb stick and z2m stopped working, needed to restart it manually. All seems to be working, but now most of automations don’t work. They are there, but disabled and devices are blank. All of them are zigbee, so I guess my zigbee devices somehow got missing temporarily and now I have to go fix all the automations by hand.
Devs: this behavior is not acceptable! You should disable affected automations at most, but not edit them to remove devices! This is ridiculous.

The developers don’t come here. Create an issue on Github if this really happened.