Mqtt sensor setup help without json formating

I have an mqtt message that just sends a string of a numeric value ie 3434
I am trying to set up an mqtt sensor that displays this number as it changes.
Currently I have the following in my config

- platform: mqtt
  name: "Moisture level"
  state_topic: "garden/sensor1"

But this only shows as “off” and not the numeric value
I have many other sensors using Json that work fine.

Feel this should be obvious but just cant see it.

Is it under the sensor section or under the binary_sensor section in your configuration file?

Just realised this myself and came back to admit it. Yes I had put it under the binary_sensor section.

However in the more information dialog it is just showing the states of all the values and not plotting it as a graph.

Any ideas on this

You need to add unit_of_measurement.

That’s it all works as expected now.

Thanks

1 Like