Puzzling error in automation - data vs data_template

I have Daikin integration which is based on a climate controller. The Daikin integration is a bit limited, and only two preset modes are supported, ‘none’ and ‘away’. But it is still possible to change the preset mode from the GUI (lovelace card). If you change preset to ‘eco’ for instance, this is clearly stated on the card.

I want to use this indicator and just change the temperature setting in an automation and at the same time change the indication of the preset mode. I tried to change the indicator (preset mode) by an action like this:

- service: climate.set_preset_mode
  target:
     entity_id: climate.gamla-huset
  data:
     preset_mode: eco

this gives me the following error:

Invalid config for [automation]: not a valid value for dictionary value @ data['action'][1]['target']['entity_id']. Got None. (See /config/configuration.yaml, line 4

I struggled quite some time with this without success, but finally found an example based on data_template instead of data. I changed the action like this:

- service: climate.set_preset_mode
  data_template:
      entity_id: climate.gamla_huset
      preset_mode: eco

and everything works fine!

I have learned data_template is deprecated and should not be used any more, so this puzzles me a lot.
What’s the problem with my first variant?

Data template is no longer required. You just need to indent your config correctly:

- service: climate.set_preset_mode
  target:
    entity_id: climate.gamla-huset
  data:
    preset_mode: eco

I’m sorry I made a mistake when I pasted the code example. My code was correctly formatted and still it gives me this error. So this is a bit more comlicated I’m afraid. (I have changed my original post now)

climate.gamla-huset - This is an invalid entity ID. Entity IDs cannot have dashes in them so this can’t be correct.

In the second example with data_template you corrected it to climate.gamla_huset which is a valid entity ID.

1 Like

What a shame! Many thanks for your fresh eyes!

Now, evertything works as expected.