Automation syntax

Can someone put me out of my misery? What am I doing wrong…

automation:
- id: emptyhouse
  alias: No-one Home
  trigger:
    - platform: state
      entity_id: climate.wts
      to: 'heat'

  condition:
    condition: or
    conditions:
      - condition: and
        conditions:
          # reports 'home' if anyone is home - so check no-one is home
          - condition: state
            entity_id: group.mypeople
            state: 'not_home'
            for: '01:00:00'
            # and its not a day when pete comes to work
          - condition: state
            entity_id: binary_sensor.pete_expected
            state: 'off'

        # or if the temp outside is hot
      - condition: template
        value_template: "{% if  states('sensor.dark_sky_daytime_high_temperature_0d')|int > 24 %} true {% else %} false {% endif %}"

        # force heating off regardless
      - condition: state
        entity_id: binary_sensor.heating_off
        state: 'on'

  action:
    - service: climate.set_temperature
      entity_id: climate.wts
      data:
        temperature: >
          {{states('input_number.fix_temp') | float}}

This is ‘valid’ config but errors when triggered from services with skip_conditions: true

Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data['temperature']

It does the same if I do this

      data:
        temperature: "{{states('input_number.fix_temp') | float}}"

or remove the cast to float.
It works fine if I put an actual number there instead.

You need data_template

      data_template:
        temperature: >
          {{states('input_number.fix_temp') | float}}

Probably the most asked question on this forum so you’re not alone!
We’ve all done it.

At least once…

1 Like

aaah, so obvious. Thanks for the gentle response.

1 Like