#Scene Parameterisation

1 messages · Page 1 of 1 (latest)

quartz kite
#

Is there a way to create a scene and parameterise it?

I'd like to create a scene which turns my LED strip on, and then depending on a simple parameter, sets the colour of the LED strip.

So I'd like for example to pass a number from 0 to 8 to the scene, and then within the scene have defined the on state / brightness / colour.

I can do this at the moment by creating 8 different scenes and then choosing which scene to activate, but is it possible to instead send payload to a scene?

( Am I overcomplicating it or misunderstanding the use-case for scenes by asking this? )

proud kelp
#

Just use a script

#

Anything you can do in a scene you can do in a script, plus you can pass variables/parameters

quartz kite
#

Thanks, but scripts seem so much harder than scenes though, all I want to do is pass an RGB value to a light and it's proving a nightmare!

proud kelp
#

They're really not

#

Just make service calls to set whatever you want

#

You cannot parameterize a scene, so that's your option

quartz kite
#

"Just make service calls" isn't easy. All I want to do this:

entities:
light.ledstrip_office:
color_mode: xy
brightness: 254
xy_color:
- {{trigger.json.x}}
- {{trigger.json.y}}
state: "on"

And yet anything I try to put it into an action is failing.

proud kelp
#

You cannot

quartz kite
#

I thought you said I could as a script?

#

I can't even make a script with that

proud kelp
#

What you have there isn't a script

#

It's just an attempt to put templates in a scene definition, which isn't possible

quartz kite
#

Okay, but how can I script that effect?

#

All I want to do is send a brightness and a XY color to a light

proud kelp
#

I get that

#

You make a service call with a variable

#

This is an old thread, but still useful

quartz kite
#

Thanks for your help, but even those examples have different levels of indentation? and different again to what happens if I try to create a new empty script?

#

I literally paste the examples from the help into a new script, hit "run script" and get cryptic error messages like:

Failed to perform the action script/new_script. Error rendering data template: UndefinedError: 'None' has no attribute 'attributes'
Like, I get it, it means I'm pasting to the wrong place, or have screwed up indentation, or have left in a property marker that only needs to be there when editing configuration.yaml isntead of editing a script yaml (I assume?).

But it's incredibly unhelpful.

"'None' has no attribute 'attributes'?