Evohome Setpoint, is it possible to use template?

Hello, I am trying to use templates for defining setpoint in Evohome using the service “set_zone_override”…

Here is the code:

    - service: evohome.set_zone_override
      data_template:
        entity_id: climate.chambre_t
        setpoint: '{{ states.input_select.t_chambre_thomas.state }}'

I am getting the following error:
ERROR (SyncWorker_14) [homeassistant.util.yaml.loader] invalid key: “OrderedDict([(‘states.input_select.t_chambre_thomas.state’, None)])”

The template is working with set_climate service but not with set_zone_override…

    - service: climate.set_temperature
      data_template:
        entity_id: climate.chambre_t
        temperature: '{{ states.input_select.t_chambre_thomas.state }}'

Any idea ? Setpoint is maybe not accepting templates ?

I found the solution remembering some comments about writing states, so I modified the setpoint template this way:

    - service: evohome.set_zone_override
      data_template:
        entity_id: climate.chambre_t
        setpoint: "{{ states('input_select.t_chambre_thomas') }}"

Bug in the integration?


These two formats are functionally equivalent:

{{ states.input_select.t_chambre_thomas.state }}

{{ states('input_select.t_chambre_thomas') }}

The first format is a valid way to reference an entity’s State Object.
The second format employs a function to reference the entity’s State Object.

For most purposes, the two are interchangeable but the second one has an advantage in the event the entity doesn’t exist (it returns unknown).

Example (entity exists):
Screenshot from 2021-02-21 09-55-17

Example (entity doesn’t exist):
Screenshot from 2021-02-21 10-03-43

BTW, unless you are using a very old version of Home Assistant, the data_template option was deprecated in favor of data. It’s possible your Logs show warning messages (at startup) informing you of every instance of data_template in your configuration.

@123 I don’t understand why the first one is not working (maybe by remplacing the simple quotes by double quotes…I did not try that one)…

Regarding “data_template”, I should have missed the announcement a couple of weeks ago… I am still using it a lot and I am running the latest version of HA (and no warning) on hassos 5.12… When I have time I will replace them all… Thanks for your help and the advice ! :wink: