Opentherm_gw.set_outside_temperature service

Hi

HA 0.100.2

I’ve created an Automation to periodically call the opentherm_gw.set_outside_temperature service. I can successfully set the outside temperature at the boiler with something like this:

temperature: 3.3

Good so far, but I’d like to set the value depending on a sensor value. Like this:

temperature: "{{ states('sensor.clientraw_temperature')|float }}"

However, I get the following error

2019-12-02 21:52:00 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.set_outside_temp. Invalid data for call_service at pos 1: expected float for dictionary value @ data[‘temperature’]

I can create a history graph of sensor.clientraw_temperature so I’m pretty sure that’s OK.

Also tried

temperature: "{{ (float(states.sensor.clientraw_temperature.state)) }}"

Same error. And various other syntax combinations.

Please could you suggest how/if I can get a variable substitution working in this service?

Many thanks. Pete

Fixed. It appears that a data_template is required in the automation. Like this:

- alias: Set Outside Temp
  initial_state: true
  trigger:
    platform: time_pattern
    minutes: '/15'
  action:
  - service: opentherm_gw.set_outside_temperature
    data_template:
      gateway_id: boiler
      temperature: "{{ states('sensor.clientraw_temperature')|float }}"