onlize
November 29, 2018, 8:59pm
1
I have some strange error. Can someone help? This is the code that I use:
water_sensor_battery_status:
friendly_name: 'Water Sensor Battery Level'
value_template: >-
{% if states.zwave.aeotec_dsb45_water_sensor %}
{{ states.zwave.aeotec_dsb45_water_sensor.attributes.battery_level }}
{% else %}
n/a
{% endif %}
unit_of_measurement: '%'
This is the error message:
Log Details (WARNING)
Thu Nov 29 2018 16:06:20 GMT-0600 (Central Standard Time)
Value cannot be processed as a number: <state sensor.water_sensor_battery_status=; friendly_name=Water Sensor Battery Level, unit_of_measurement=% @ 2018-11-29T16:06:20.192911-06:00> (Offending entity: )```
petro
(Petro)
November 29, 2018, 10:17pm
2
n/a is not a number. Change that to 0 or something else.
onlize
November 29, 2018, 10:24pm
3
Thank you, but there is something else. I tried to make it more simple:
water_sensor_battery_status:
friendly_name: 'Water Sensor Battery Level'
value_template: "{{ states.zwave.aeotec_dsb45_water_sensor.attributes.battery_level }}"
unit_of_measurement: '%'
But still have the same error:
Log Details (WARNING)
Thu Nov 29 2018 16:22:30 GMT-0600 (Central Standard Time)
Value cannot be processed as a number: <state sensor.water_sensor_battery_status=; friendly_name=Water Sensor Battery Level, unit_of_measurement=% @ 2018-11-29T16:22:30.951923-06:00> (Offending entity: )
petro
(Petro)
November 29, 2018, 10:26pm
4
what does the attribute battery_level output? Check the states tab
petro
(Petro)
November 29, 2018, 10:32pm
6
Put this in the template editor and tell me what the output is
{{ states.zwave.aeotec_dsb45_water_sensor.attributes.battery_level * 2 }}
petro
(Petro)
November 29, 2018, 10:33pm
7
also, you restarted after changing the template right?
onlize
November 29, 2018, 10:37pm
8
Yes, I restarted HA using Restart in the Server Management.
The output is 200.
petro
(Petro)
November 29, 2018, 10:50pm
9
I’m stumped, its gotta be something simple. Go take a look at the actual logs. home-assistant.log in the config directory. Search for the error associated with the template sensor
onlize
November 29, 2018, 10:59pm
10
It gives me the same error in the home-assistant.log file:
2018-11-29 16:55:23 WARNING (MainThread) [homeassistant.helpers.condition] Value cannot be processed as a number: <state sensor.water_sensor_battery_status=; friendly_name=Water Sensor Battery Level, unit_of_measurement=%, icon=mdi:battery-alert @ 2018-11-29T16:55:23.580208-06:00> (Offending entity: )
petro
(Petro)
November 29, 2018, 11:08pm
11
try swapping it for this:
"{{ state_attr('zwave.hallway_ms','battery_level') }}"
onlize
November 29, 2018, 11:20pm
12
This fixed it, thank you.
petro
(Petro)
November 29, 2018, 11:24pm
13
Hmm, that must have been a startup error then.