Cover automation based on temperature - problems

Hey there, I tried to make an automation for my windows.
Closing works but opening does not work.

alias: Outdoor to 🥵
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.balkon_temperature
    above: sensor.temp_hum_co2_temperature
    for:
      hours: 0
      minutes: 2
      seconds: 0
conditions: []
actions:
  - action: cover.close_cover
    metadata: {}
    data: {}
    target:
      entity_id:
        - cover.alle_fenster
        - cover.alle_markisen
mode: single

I have tried it with above: "{{states('sensor.balkon_temperature')|float0}}" as well but get an error “Message malformed: expected float for dictionary value @ data[‘above’]”

alias: Indoor to 🥵
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.temp_hum_co2_temperature
    above: sensor.balkon_temperature
conditions: []
actions:
  - action: cover.open_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.alle_fenster
mode: single

anyone some ideas?
Thx

If you want to compare two entities, you must use template.

Example:

Outdoor to

...
trigger:
  - platform: template
    value_template: >
      {{ states('sensor.balkon_temperature')|float(0) > states('sensor.temp_hum_co2_temperature')|float(0) }}
    for:
      minutes: 2
...

Indoor to
/

...
trigger:
  - platform: template
    value_template: >
      {{ states('sensor.temp_hum_co2_temperature')|float(0) > states('sensor.balkon_temperature')|float(0) }}
...

Thanks mate, that did it.

Just to clarify, what you had originally does work. However, that construction is better suited for uses where the entity used in “above” has a relatively static value. This is because it will only be triggered by when the state of sensor.balkon_temperature changes from below the state of sensor.temp_hum_co2_temperature to above it…

The value has to cross the threshold and it has to be sensor.temp_hum_co2_temperature that changes.

Using a Template trigger as @krskrab suggested is the more compact option, but another method would be to use 2 Numeric state triggers as follows:

alias: Indoor to 🥵
description: ""
triggers:
  - trigger: numeric_state
    entity_id: sensor.temp_hum_co2_temperature
    above: sensor.balkon_temperature
    for: "00:01:00"
  - trigger: numeric_state
    entity_id: sensor.balkon_temperature
    below: sensor.temp_hum_co2_temperature
    for: "00:01:00" 
actions:
  - action: cover.open_cover
    metadata: {}
    data: {}
    target:
      entity_id: cover.alle_fenster
mode: single