I recently bought an iPhone and discovered the Home Assistant widget where I can easily run Scene. I have some tapo c200 cameras with the privacy function that I can call as a service.
I wanted to create a script that disable the privacy mode on cameras and start recording when a movement is detected. The script works fine but I can’t run it from inside a scene.
Creating a scene I can’t call the service to disable the privacy mode so why it’s not possible to run a script inside a scene? I think it’s something we should be able to do.
EDIT: a workaround I found is to run an automation from a scene even if I prefer running a script from a scene
Pretty sure that isn’t possible either. Can you show your scene?
Scenes convert specified states into service calls to set those states. So if you are setting the automation on or off, you are enabling / disabling it. Not triggering it.
If you want the sort of functionality described in your post title, don’t use a scene. Use a script. You just have to use service calls yourself to set the states you want.
If the scene sets light 1 at 10% and light 2 at 20% and the volume of media player at 50%, then all those are conditions in an automation.
All you need is a trigger and that could be either of those entities.
No it isn’t. Vincenzo is setting the state of an automation in a scene, probably with the assumption that this runs the automation. It does not.
It’s possible to replace the scene with an automation, but that is not what they have done. And a better fit would be replacing the scene with a script.
I can’t because what I want to reach is having the scene on my iphone HA widget so I must use scene. I wanted to call a script from a scene but it’s not possible so I’m calling an automation instead.
This is my code:
SCENE
- id: '1619801047175'
name: Camera ON
entities:
automation.camera_on:
last_triggered: '2021-10-18T07:23:05.476255+00:00'
mode: queued
current: 4
max: 5
id: '1634541742343'
friendly_name: Camera ON
state: 'on'
It’s working. On the automation I’ve also other actions like recording when cameras detect movement, sent notification to my smartphone and possibly I can add more. Can I put those in the template?
I don’t know, I’m thinking it’s just easier to do it with automation that triggers when I run the scene.
I have been wondering about this and was going to make a post on it, but seems approppriate to just comment here. WHAT IS THE POINT OF SCENES!?!?!? It seems to me that between automations and scripts, you would never need to create a scene? What are any use case scenarios where you would use scene vs. automation/script? Thanks all!
ahhhh ya, #2 is a great point. I actually use that exact function to return my lights to previous state after they flash (when my 4 yo escapes his room). Thanks for the reply!