I have a calculated result from a Python/AppDaemon script running on Home Assistant. I want to display that calculated result on my HA/LoveLace dashboard, so I created a sensor from AppDaemon. Unfortunately, I don't seem to be able select what variable type I want my state to be. Clearly HA distinguises between float, string, or bool internally. When you go to history some sensors are displayed as plots, and others as bar charts. Everything I create---even numeric data---shows up as a string. How do I set the variable type of my own sensors?

I am using this line in AppDaemon to (1) create, and (2) update my sensor.

self.set_state('sensor.my_sensor_value', result)

  • 1
    By no means an expert, but in a template you would use is_state(sensor.my_sensor_value) | float to convert/use as a float. You may be able to use that in AppDaemon
    – FreeMan
    Nov 2 '21 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.