Value cannot be processed as a number: not set

Hello

I’ve noticed this Warning in my log, is there anyway to find out where it is coming from please?

2017-09-22 08:42:44 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: not set

Cheers
Mark

Check your conditions.

~Cheers

This usually happens when you are accessing a state or some value that is not a valid numeric value, and you are converting that value to int type. Check where you have code that does something like {{ states.xxx.state | int }}.

You could also add a default value by doing this: {{ states.xxx.state | default(0) | int }} . This will default the value to 0 when the state is unknown or not found. Depending upon the logic, you may or may not want to set defaults, but it should give you an idea.

2 Likes

thanks for pointing in me in the right direction, I found out it is this test proximity automation but I have no idea why? As another one almost identical, doesn’t produce that warning. Any idea please?

not working one

alias: Mark on his way home
trigger:
  - platform: numeric_state
    entity_id: proximity.home
    below: 4

condition:
  condition: and
  conditions:
  - condition: template
    value_template: '{{ states.proximity.home.attributes.dir_of_travel == "towards" }}'
  - condition: state
    entity_id: device_tracker.mark
    state: 'not_home'
action:
   - service: notify.notify_mark
     data:
       title: "going home"
       message: "you are on your way home"

one without the warning

alias: Mark leaving home
trigger:
  - platform: numeric_state
    entity_id: proximity.home
    above: 1

condition:
  condition: and
  conditions:
  - condition: template
    value_template: '{{ states.proximity.home.attributes.dir_of_travel == "away_from" }}'
  - condition: state
    entity_id: device_tracker.mark
    state: 'not_home'
action:
   - service: notify.notify_mark
     data:
       title: "leaving home"
       message: "Leaving"

Cheers
Mark

What do you see when you evaluate these templates in the dev-templates (under Developer Tools)?

{{ states.proximity.home.state }}

{{ states.proximity.home.attributes.dir_of_travel }}

See the output and look at the code. That might shine some light. I can’t see anything else that would cause that specific issue looking at the code.

1 Like

thanks… when I do it is just what I would expect?

0
arrived

Hello everyone.

I seem to have the same problem.
Below value does work correctly.
After looking at this post

I figured out the problem is in the proximity numerical value.

{{states.proximity.XXXX.state > 0}} always comes back with a Error but {{states.proximity.XXXX.state}} comes back correct.
Therefore the ‘below’ function cannot work since it is not a numerical value.
Strangely though the ‘above’ function works.

No idea of how to solve the problem. I am still stuck
If any of you found a solution please share.

most states are of type string in HA, so you’d need to format it as number before you compare using the | int filter
I would however further change your code by using states("xxx") instead of states.xxx.state as the former will not error when the entity or its value is not available.
You full statement would therefore be:

{{ (states("proximity.XXXX") | int) > 0}}

which will return true or false

Ran into this trying to use the climate state in an automation. Looks like the temperature on the climate state is stored as an attribute, so you have to use state_attr(...) to get it:

- id: '1577326811517'
  alias: Limit Temperature Setting
  description: ''
  trigger:
  - hours: '*'
    minutes: '/5'
    platform: time_pattern
    seconds: '*'
  condition:
  - condition: template
    value_template: '{{ state_attr("climate.house", "temperature") | float > 69 }}'
  action:
  - alias: ''
    data:
      entity_id: climate.house
      temperature: 69
    service: climate.set_temperature