How to use variables in automaton (Message malformed)?

I’m trying to reference the helper value, but every attempt results in “Message malformed: expected float for dictionary value @ data[‘below’]”

Here is my configuration:

alias: Maciek - Air Humidifier - On
description: ""
triggers:
  - trigger: time_pattern
    minutes: /5
conditions:
  - condition: and
    conditions:
      - condition: time
        after: "06:00:00"
        before: "22:00:00"
        weekday:
          - sun
          - sat
          - fri
          - thu
          - wed
          - tue
          - mon
      - type: is_humidity
        condition: device
        device_id: 1149c9f9af2156ac06eff73cd8dfc1f1
        entity_id: 1bc89ca09440bef6615f410d359924f3
        domain: sensor
        below: {{states.input_number.air_humidifier_on}}
actions:
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      device_id: 6d55b00f96bde882735687565ac4db25
mode: single

I’ve tried following combination without success:

below: {{states.input_number.air_humidifier_on}}
below: {{states(input_number.air_humidifier_on)}}
below: {{states(input_number.air_humidifier_on)|float}}
below: {{states('input_number.air_humidifier_on')|float}}
below: '{{states("input_number.air_humidifier_on")|float}}'
below: states.input_number.air_humidifier_on

What is the correct syntax?

Hello maciejmiklas,

The correct syntax to make this work is use an entity condition not a device condition. Device actions do not accept templates for the most part.

1 Like