Helpers in Automation

I’m trying to replace some hardcoded values in my automation conditions with helpers. However when I use helpers specifically in the conditions (i.e. above, below) I get a Message malformed: expected float for dictionary value @ data['above']

Here is my current script

alias: Toggle Downstairs AC Power when above or below 25c
description: ""
trigger:
  - platform: time_pattern
    hours: /1
    alias: Hourly
condition:
  - condition: time
    before: "23:00:00"
    after: "07:00:00"
    alias: It's after 7am and before 11pm
  - condition: numeric_state
    entity_id: sensor.openweathermap_forecast_temperature
    below: 30
    alias: Forecast below 30c
  - condition: state
    entity_id: input_boolean.disable_ac_automations
    state: "off"
action:
  - choose:
      - conditions:
          - type: is_temperature
            condition: device
            device_id: xxxxxxxxxx
            entity_id: sensor.downstairs_universal_remote_temperature
            domain: sensor
            below: 25
            alias: Downstairs ambient temp is below 25
          - condition: not
            conditions:
              - condition: state
                entity_id: climate.downstairs_ac
                state: "off"
            alias: NOT (Confirm Downstais AC is off)
        sequence:
          - service: climate.set_temperature
            data:
              hvac_mode: "off"
              temperature: input_number.ac_temp
            target:
              entity_id: climate.downstairs_ac
      - conditions:
          - type: is_temperature
            condition: device
            device_id: xxxxxxxxxxx
            entity_id: sensor.downstairs_universal_remote_temperature
            domain: sensor
            above: 25
            alias: Downstairs ambient temp is above 25
          - condition: state
            entity_id: climate.downstairs_ac
            state: "off"
        sequence:
          - service: climate.set_temperature
            data:
              temperature: input_number.ac_temp
              hvac_mode: cool
            target:
              entity_id: climate.downstairs_ac
mode: single

I’m wanting to replace the 25 with input_number.ac_temp_threshold. I tried just doing

below: input_number.ac_temp_threshold
anbove: input_number.ac_temp_threshold

Replace all of the Numeric Device Conditions with Numeric State Conditions.

A Numeric State Condition accepts an input_number for above and below.

Example:

 condition:
   - condition: numeric_state
     entity_id: sensor.downstairs_universal_remote_temperature
     above: input_number.ac_temp_threshold

That was it thank you!

1 Like