Value cannot be processed as a number - help

Dear,

I am pretty new here, had already made my first experience with HA, so still learing a lot. Just saw that one of my sensors (its a weather station) give some failueres in the log file. On the other hand, I could easily use this sensor and see the values. I’ts to say, that I made an automation with this values as well, there might be the trouble?
Below an extract from my log file - thank you for any help. Dave

'Logger: homeassistant.helpers.condition
Source: helpers/condition.py:234
First occurred: 28. Dezember 2020, 14:34:07 (287 occurrences)
Last logged: 7:32:30

  • Value cannot be processed as a number: <state sensor.outdoor_temperature=-0.5; unit_of_measurement=°C, friendly_name=Aussen Temperatur, icon=mdi:thermometer, device_class=temperature @ 2020-12-29T06:22:08.134086+00:00> (Offending entity: mdi:thermometer)’

I think you need to select the individual attribute, the error is complaining about it being given all the attributes sensor.outdoor_temperature=-0.5; unit_of_measurement=°C, friendly_name=Aussen Temperatur, icon=mdi:thermometer, device_class=temperature

OK, and how/where to select the individual attribute? Below is an extract of the condition in my automation:

type: temperature
platform: device
device_id: fe348f932183425db3bd19ed0df81e1e
entity_id: sensor.outdoor_temperature
domain: sensor
below: 1
for:
hours: 0
minutes: 30
seconds: 0
above: -30

Any idea? Thank you - Dave

Developer Tools -> States and look for your entity

Or the easier way is in the automation UI select the attribute from the dropdown list below entity

Which attribute of the sensor are you planning to use in your automation? The state-value?
In that case use something like this: {{ states.sensor.xyz.state }}
When you want to use another attribute, look here: https://www.home-assistant.io/docs/configuration/templating/

Anyway, the best way to start is to go to Developer Tools --> Template and enter in the Template editors box: {{ states.sensor_xyz }}
In the Result box all info available for this sensor will be shown.

OK, that’s what I got in the box:

<template TemplateState(<state sensor.outdoor_temperature=2.89; unit_of_measurement=°C, friendly_name=Aussen Temperatur, icon=mdi:thermometer, device_class=temperature @ 2020-12-29T08:32:20.816453+00:00>)>

so, it looks to be OK, or not?
But still having the trouble with the automation “value cannot processed as a number”

Thank you - Dave

Please answer the question in my first sentence.

It’s the temperature I wnt to use:

state sensor.outdoor_temperature

Automation should do something when the temperature is below 1°C (see my extract from the automation above). Thank you

That’s actually bad advice to use the notation states.xxxx instead of states(…), it’s written in the warning in the states section of the docs you linked…

Ok, then the answer is in my 2nd line.

The rest of my writing is meant to help you learn how to properly template. Go click the link. And read the info there.
And by using the Template editor you can see what result a certain template will give.

@Burningstone I haven’t been looking at that page since a long time, thanks for pointing this out!

@jjdave2020 use {{ states('sensor.outdoor_temperature') }} to get the value you want.

Try with a condition like this:

condition:
  condition: numeric_state
  entity_id: sensor.outdoor_temperature
  value_template: "{{ float(state.state) }}"
  above: -30
  below: 1
  for:
    minutes: 30

I’m not sure if you can use the for: option in a numeric state condition.

did, but no success, get another failure and could not even save the automation:

Message malformed: required key not provided @ data[‘trigger’][1][‘platform’]

Do you suggest to use the temperature as a condition? I used it as a trigger and then add the time when this automation is allowed to execute as a condition.

How should the automation looks like if I want to use the temperature as a trigger? Thanks - Dave

You said in your previous post, here’s part of my condition, that’s why I assumed it was a condition. Please post your full automation, properly formatted (see point 11 in the community guidelines).

Sorry, I was not correct, temperature is used as trigger. see below my full automation:

‘’’
trigger:

  • type: temperature
    platform: device
    device_id: fe348f932183425db3bd19ed0df81e1e
    entity_id: sensor.outdoor_temperature
    domain: sensor
    below: 1
    for:
    hours: 0
    minutes: 30
    seconds: 0
    above: -30
    condition:
  • condition: time
    after: ‘06:00:00’
    before: ‘08:30:00’
    action:
  • service: notify.pushbullet_ha
    data:
    message: Temperatur Aussen <1° - MORGENS
    mode: single
    ‘’’
    Hope you could help on this, thank you - Dave

Please format your code properly! You used the incorrect quotes ’ instead of `
Easiest option is to highlight the code and then press the button </> at the top.

hope that’s now OK, I cant’ see any </> button at the top

trigger:
  - type: temperature
    platform: device
    device_id: fe348f932183425db3bd19ed0df81e1e
    entity_id: sensor.outdoor_temperature
    domain: sensor
    below: 1
    for:
      hours: 0
      minutes: 30
      seconds: 0
    above: -30
condition:
  - condition: time
    after: '06:00:00'
    before: '08:30:00'
action:
  - service: notify.pushbullet_ha
    data:
      message: Temperatur Aussen <1° - MORGENS
mode: single

You don’t see this:

Change your code to this:

trigger:
  - platform: numeric_state
    entity_id: sensor.outdoor_temperature
    below: 1
    for:
      hours: 0
      minutes: 30
      seconds: 0
    above: -30
condition:
  - condition: time
    after: '06:00:00'
    before: '08:30:00'
action:
  - service: notify.pushbullet_ha
    data:
      message: Temperatur Aussen <1° - MORGENS
mode: single

Please be informed that the numeric state trigger works like this:
It only triggers when the value goes from outside the threshold to inside the threshold for 30 minutes and then only trigger again when the value goes outside the thresholda and inside thw thresholds again.

Thank you, willl try and double check if the warning still occurs. Will keep you updated.

Regarding the treshold/trigger, how should it be realized when I want to get following:

  • triggers once a day (between 06:30 and 08:30am) only if the
    temperature is below 1°

Thank you - Dave

OK, looks that for is not allowed, got follwing message:

“Message malformed: extra keys not allowed @ data[‘condition’][0][‘for’]”

automation looks as follwing:

trigger:
  - platform: time
    at: '06:30'
condition:
  - condition: numeric_state
    entity_id: sensor.outdoor_temperature
    value_template: '{{ float(state.sensor.outdoor_temperature.state) }}'
    above: '-30'
    below: '1'
    for:
      minutes: 30
action:
  - service: notify.pushbullet_ha
    data:
      message: Test2 - Temperatur Aussen <1° - MORGENS
mode: single

I want to check the temperatuer every day between a certain time slot and
when it is below a certain level for 30 minutes, start the action.
Sounds simple but it looks not to be that simple.

Any help, I am really stucked, thank you - Dave