How to parametrize a scene with input_numbers

Hey all,
I’m banging my head with an apparently simple problem.
I have many Generic Thermostat entities controlling the heating of the different rooms of my house.
I created a Scene to change all the thermostats to e.g. night/daytime temperatures:

name: Riscaldamento Notturno
entities:
  climate.termostato_cameretta_arancione:
    state: heat
    temperature: 21
  climate.termostato_cameretta_gialla:
    state: heat
    temperature: 21
metadata:
  climate.termostato_cameretta_arancione:
    entity_only: true
  climate.termostato_cameretta_gialla:
    entity_only: true

So far so good. Now I’d like to remove that hardcoded&repeated “21” from the scene and encode it into an “input_number” helper.
So I tried to change this to (using the YAML editor instead of UI editor):

name: Riscaldamento Notturno
entities:
  climate.termostato_cameretta_arancione:
    state: heat
    temperature: {{ states('input_number.temperatura_riscaldamento_notturno_stanze')|float(0) }}
  climate.termostato_cameretta_gialla:
    state: heat
    temperature: 21
metadata:
  climate.termostato_cameretta_arancione:
    entity_only: true
  climate.termostato_cameretta_gialla:
    entity_only: true

But then when I try to apply the scene I get:

Failed to perform the action scene/turn_on. expected float for dictionary value @ data['temperature']

What am I missing?

Thanks a lot!

Templates are not supported everywhere… I don’t see any evidence in the Scene docs that they support templating. Use a Script or Automation instead of a Scene.

You also failed to follow Rule #1 of templates… but, I don’t think it really matters here.

I use both Scripts and Scenes

  • I use Scripts when I want to set everything the same - for example turn off all the lights in a room **.
  • I use Scenes when I want to customize something - I.e. have each bulb have a different color or brightness.

I only have two zones for my AC so it wasn’t worth using scenes for that (I only use scripts) but I would do a similar Scene/Script split if my needs were more complex.

The scripts can use labels, rooms, groups or scenes to define which entities they should update, so if done correctly you don’t have to keep repeating the definitions, example my “Off” script actually uses the “Bright” scene to figure out which lights it should turn off - you can probably do something similar for your AC units.

** - I used to use an “Off” scene but I didn’t see the value in maintaining it separately, hence the conversion to a script.

hey @Didgeridrew ,
thanks for pointing out the rule #1. I put quotes but it still seems like Scenes do not support templating… so scenes are probably not the tool I need :frowning:

@dtrott ,
yeah I see what you mean and makes sense to me. Scripts are much more flexible than Scenes indeed. I will look at them as alternative solution.

thanks :+1: