Above in automation

Automation has this:

action:
  - choose:
    - conditions:
      - type: is_humidity
        condition: device
        device_id: 95ce28e14d943dee6a3af327c9e968b9
        entity_id: sensor.ble_humidity_th_gostinaya
        domain: sensor
        above: "{{ states('input_number.vlazhnost')| int }}"
      sequence:
      - service: switch.turn_off
        data: {}
        entity_id: switch.rozetkauvlazhnitelvladin

I get an error

Error executing script. Invalid data for choose at pos 1: expected float for dictionary value @ data[‘above’]

what is wrong in the line?

above: "{{ states('input_number.vlazhnost')| int }}"

Welcome to the forum.

Two things,

  1. Please edit your post and format your pasted code correctly. See point 11 here. It helps us help you.

  2. You can do it like this:

above: input_number.vlazhnost

At least you can for a numeric_state condition. I have no idea what a device condition is or even if it actually exists. It does not seem to be documented. I assume you generated that with the automation graphical user interface?

It works. Thank you.

1 Like