nckslater
(Nckslater)
November 13, 2021, 8:05am
1
Hi all,
Noob question. I want to get my baby boy’s weight gain displayed since he came out of hospital.
The starting number is 3.3 which I’ve created an input boolean for and I have the Withings scale that calculates his weight which is 4.3
I want to create a calculation but when I put it in dev template it gives me the wrong answer of
0.43000000000000016
"{{ states('sensor.withings_weight_kg_sashka') | float - states('input_number.sashka_hospital_weight') | float }}"
Where I am going wrong?
I’d really like to get it on a graph but just a badge would do for now although if anyone has a suggestion for a better way of doing it I’m open to ideas.
Thanks in advance
tom_l
November 13, 2021, 8:11am
2
Booleans are on or off not numbers, but that was just a typo looking at your template.
Try this in the Developer Tools template editor:
Scale weight = {{ states('sensor.withings_weight_kg_sashka') }}
Starting Weight = {{ states('input_number.sashka_hospital_weight') | float }}
Result = {{ states('sensor.withings_weight_kg_sashka') | float - states('input_number.sashka_hospital_weight') | float }}
1 Like
nckslater
(Nckslater)
November 13, 2021, 8:52am
3
Perfect man thank you.
For some reason even when I changed the input number it was picking up the old value so I’ve created a new one and it works.
Scale weight = {{ states('sensor.withings_weight_kg_sashka') }}
Starting Weight = {{ states('input_number.sashka_hospital_start_weight') | float }}
Sashka weight gain= {{ states('sensor.withings_weight_kg_sashka') | float - states('input_number.sashka_hospital_start_weight') | float }}
Scale weight = 4.33
Starting Weight = 3.3
Sashka weight = 1.0300000000000002
Really appreciate your assistance