I would like to be able to run a script in a scene. I like the scene functionality but I would like to run scripts to add more functionality to it.
This used to be possible and it was specifically removed so unlikely to come back. However since the state of a scene is now the time it was last triggered you can accomplish this with an automation like this:
automation:
alias: Do extra stuff with my scene
trigger:
platform: state
entity_id: scene.my_scene
action:
- service: some_service_that_scenes_cant_use
data:
input: Stuff!
...
I remember that it worked a while ago. But why was it removed?
I only have a technical reason. Because scenes don’t “run” things, they put things back into a reproducible state. For example no matter what’s happened or is happening with a light, putting it to brightness 30% always does the same thing. Same with setting an outlet to on.
Not true with scripts though. Running a script may not even work if its already running. And how would you capture the state of a script with the scene editor? If it happened to be running at the time you were creating/updating the scene then you want to run it as a part of that scene? It doesn’t work.
What is your use case and why do you need a scene for reference? Scripts can do everything a scene can do and more. So if you already have a script why not just add some steps to it instead of making a scene?
Thank you very much for this hint! After hours of trial and error I can now finally trigger the my_button
entities which are exposed by the Overkiz integration when activating a scene from my iPhone.