Home assistant compare counter

I want to switch the heater when the temperature is above some value. It doesn’t work because it seem it cannot compare counters with floats:

##################################

>= {counter.max_badtemp} graden buitenbad verwarming uit

##################################

  • id: ‘1966000703’
    alias: ‘Buitenbad te warm: verwarming uit’
    trigger:
  • platform: numeric_state
    entity_id: sensor.sonoff_10015dbf7f_temperature
    above: counter.max_badtemp
    action:
    • entity_id: switch.sonoff_100121d4d5
      service: switch.turn_off
      mode: single

SOmebody has some ideas?

what is counter.max_badtemp?
If this is not numeric then it will fail indeed

Here is a different way of doing what you are trying to accomplish and it will turn off when reaches a certain temp and also on at a certain temp:

alias: Turn Heater Off or On When Above or Below XX or XX
description: Turn Heater Off or On When Above or Below XX or XX

trigger:
  - platform: state
    entity_id: sensor.sonoff_10015dbf7f_temperature

condition: []
action:
  - choose:
    - conditions:
        - condition: numeric_state
          entity_id: sensor.sonoff_10015dbf7f_temperature
          above: 'XX'
      sequence:
        - service: switch.turn_on
          entity_id: switch.sonoff_100121d4d5
    - conditions:
        - condition: numeric_state
          entity_id: sensor.sonoff_10015dbf7f_temperature
          below: 'XX'
      sequence:
        - service: switch.turn_off
          entity_id: switch.sonoff_100121d4d5
    default: []
mode: single

This is counter variable. The program works when I use a number. It stops working when the number is changed by the counter variable.

Thanks for reply. Problem seems to be compare float with counter:

Invalid config for [automation]: expected float for dictionary value @ data[‘above’]. Got None. (See /config/configuration.yaml, line 11).

8:47:01 PM – (ERROR) config.py - message first occurred at August 29, 2022 at 9:42:45 PM and shows up 9 times

I’m not sure how the counter works for this or what it is even counting, but if you know your temp limits you can just substitute the XXs I have in the above automation. But if this counter thing is what you really want, will will have to explain the setup in a little more detail, so I can wrap my head around it.

above: and below: do not support counters. Only number helpers and sensors:

https://www.home-assistant.io/docs/automation/trigger/#numeric-state-trigger