stevemann
(Stephen Mann (YAML-challenged))
March 11, 2024, 4:01am
1
Here is my sensor configuration:
sensor:
- platform: homeassistant
name: "glucose"
id: glucose
entity_id: sensor.dexcom_stevermann_glucose_value
In Home Assistant, dev tools, states, the state of “sensor.dexcom_stevermann_glucose_value” is 105.
Does anyone see anything wrong that would make the sensor value NAN?
nickrout
(Nick Rout)
March 11, 2024, 4:13am
2
Its not a type error is it (numeric vs text).
I still get a fright seeing a BS level of 105. That’s 5.8 in real mmol/L numbers.
WallyR
(Wally)
March 11, 2024, 12:40pm
3
NAN means Not A Number.
HA has a rigid rule about all sensors value being stored strings, so you might need to convert it in ESPHome.
" Note
This component is only for numeral states. If you want to import arbitrary text states from Home Assistant, use the Home Assistant Text Sensor ."
Isnt 105 a number?
stevemann
(Stephen Mann (YAML-challenged))
March 11, 2024, 2:19pm
5
Then you would hate my overnight highs. But my endo says I am well-controlled.
WallyR
(Wally)
March 11, 2024, 4:27pm
6
That is the hard part to decipher with computer coding.
105 can be a number, but it can also be a string consisting of 1,0 and 5.
That completely went over my head and I missed that little detail. Looking at numbers, the thought that it might be a string instead of an int or perhaps a float. that’s an easy oversight to make and I’m sure it happens to the best of us! Nice catch on that one.
stevemann
(Stephen Mann (YAML-challenged))
March 11, 2024, 6:41pm
8
It would be nice if dev tools → states had a type column: (string, float, int)
1 Like
nickrout
(Nick Rout)
March 12, 2024, 8:48am
9
You can get that in dev tools/templates.
Put this in and see what the result is
{{ states('sensor.dexcom_stevermann_glucose_value')}}
stevemann
(Stephen Mann (YAML-challenged))
March 12, 2024, 1:48pm
10
I wish it were that easy. Here is what I entered:
Glucose: {{ states('sensor.dexcom_stevermann_glucose_value')}}
Glucose Number: {{ states('sensor.dexcom_stevermann_glucose_value') | int }}
Glucose string: {{ states('sensor.dexcom_stevermann_glucose_value') | string }}
All three returns the same state. I would have hoped that int or string would have returned zero.
stevemann
(Stephen Mann (YAML-challenged))
March 12, 2024, 8:28pm
12
Thanks. It’s well hidden on the top of my screen
But now I know where to look next time.
I wonder if it’s worth a Feature Request?