Numeric_state condition not working

Hi, I want to switch a floor heating automatically on if the highest temperature of the day is below 20. Unfortunately it does not work, the switch is always turned on. any hints? :slight_smile:

- id: Fussbodenheizung_Bad_einschalten
  alias: Fussbodenheizung_Bad_einschalten
  trigger:
  - at: 06:00:00
    platform: time
  - entity_id: group.alle
    platform: state
    to: home
  condition:
  - after: 05:59:59
    before: '22:00:00'
    condition: time
  - condition: state
    entity_id: group.alle
    state: home
  - condition: state
    entity_id: input_boolean.heizperiode
    state: 'on'
  - condition: state
    entity_id: input_boolean.urlaub
    state: 'off'
  - below: '20'
    condition: numeric_state
    entity_id: sensor.dark_sky_daytime_high_temperature_0d
    value_template: '{{ states("sensor.dark_sky_daytime_high_temperature_0d") | float }}'
  action:
  - entity_id: switch.badezimmer_fussbodenheizung
    service: switch.turn_on
  initial_state: 'on'

Try

 - below: 20 # this is a number

Instead of:

 - below: '20' # this is a string

Also put single quotes around your times.

  - at: '06:00:00'

Not as critical but good practice.

2 Likes

unfortunately still not working:

- id: Fussbodenheizung_Bad_einschalten
  alias: Fussbodenheizung_Bad_einschalten
  trigger:
  - at: '06:00:00'
    platform: time
  - entity_id: group.alle
    platform: state
    to: home
  condition:
  - after: '05:59:59'
    before: '22:00:00'
    condition: time
  - condition: state
    entity_id: group.alle
    state: home
  - condition: state
    entity_id: input_boolean.heizperiode
    state: 'on'
  - condition: state
    entity_id: input_boolean.urlaub
    state: 'off'
  - below: 20
    condition: numeric_state
    entity_id: sensor.dark_sky_daytime_high_temperature_0d
    value_template: '{{ states("sensor.dark_sky_daytime_high_temperature_0d") | float }}'
  action:
  - entity_id: switch.badezimmer_fussbodenheizung
    service: switch.turn_on
  initial_state: 'on'

Let me guess, you are triggering the automation manually instead of waiting for 6am.

Conditions are skipped when an automation is manually triggered.

3 Likes

Further to what Tom said, I recommend that you create an input_boolean.test_bit and just have it lying around. Then when you need to test actions and conditions you can insert it as a trigger (remember to remove it or 90% of your automations will all fire) this can be done on a reload (no restarts required).
Testing Triggers is way more tricky

:rofl:

1 Like

OMG that is completely new to me… thanks for that hint! So I will wait and see if its working. Thanks @tom_l!