lawleo
(Lawrence Leo)
March 2, 2023, 3:23am
1
I know that all mqtt sensor state is a string but I want to display the history in a value graph, how can I do that?
I have a script analyze how many eggs in the picture and send the value to mqtt.
mqtt:
sensor:
- state_topic: "/places/chickencoop/egg"
name: "Egg"
I did try adding device_class: humidity / temperature also didn’t work
Thank you for your time.
tom_l
March 2, 2023, 4:47am
2
For a sensor state to be treated as a numeric value you need to add a unit_of_measurement
to the sensor config. It can be anything, including a quoted space " "
if you want nothing to show. e.g.
mqtt:
sensor:
- state_topic: "/places/chickencoop/egg"
name: "Egg"
unit_of_measurement: "eggs"
Or
mqtt:
sensor:
- state_topic: "/places/chickencoop/egg"
name: "Egg"
unit_of_measurement: " "
1 Like