I am trying to disarm a manual alarm control panel in an automation. I can call the service through the dev tools service gui like so (my code isn’t 1111), but if I use my actual code, it disarms.
Now I’m trying to figure out how to put this as an action in my automation. This is what I have, but it didn’t work. I can see that the alarm_disarm service is called after the automation fires in the log, but it doesn’t disarm. I must be missing something in translating from the services gui to the YAML formatting. Is there a better way to directly translate?
I have tried it with and without the entity_id in the data section.
Buried in my post, I mentioned that I tried it with and without the entity_id in the data section. Do I have to get rid of the other one??? That would be weird if so.
Why does it work for you the other way? It is very weird that you would have the entity_id with no data, but then have to move it inside when using data.
The data: key is for additional information that a service my support. The entity id is not additional data. It always needs to be specified but you can do that inside the data if you wish to. So both of these are correct:
If I use the script editor in the GUI to create a new script, then you can only put the entity_id in the data block. I’m beginning the think that having entity_id without data will automatically place it inside the data block and that this functionality is broken for the stock alarm_control_panel component
Guys, I don’t remember where on this forum but not long time ago I saw a discussion about placing entity_id inside or outside data as it’s really confusing to see it in different locations.
The bottom line if I remember it right was: entity_id outside data is just a trick to allow something like:
i.e when you have only one parameter for the service - entity_id.
If you have other parameters, everything goes inside data.
The first form just allows to write less code but I believe eventually it translates into the same code by wrapping everything together as data and passing it to a service.
I agree that there is no need to use entity_id twice unless you really want it… on the other hand, there should be no harm? Does it say anywhere it’s NOT correct?
Well, that means we can safely place entity_id inside OR outside data, but cannot have BOTH at the same time.
And that last bit is a bit weird to me and looks like a bug… but I won’t investigate it further… at least right now.
I don’t use GUI editor myself and as they introduced a lot of GUI things recently, I wouldn’t be surprised it isn’t working correctly. Open a new issue then.
In this case for the manual alarm panel component/platform/integration (?) , you can use entity_id without data, or inside data, but not outside data with data. You also cannot have it in both spots phew. This is directly contradicted by the behavior in the custom alarm panel component and the light example. It isn’t a homogenous answer it seems.
Yes. I have tried GUI, which only allows entity_id in the data section. I have tried all combinations manually except with no entity_id at all, the only one that works is the entity_id inside data.