All I want to do is display this data as a gauge on the dashboard and use the data to trigger some automations. I managed to create the sensor entity in the config file, but when trying to set up the gauge it leaves an error saying “entity is non-nemeric: sensor.current_sensor_1”.
Assume you are getting values for this sensor from somewhere.
Then, if you keep getting it - wait a little, the history will be filled.
Unless you have one update a year…
Anyway - why not posting a screenshot with a history? It already has a value after creation the sensor.
I told you to post a screenshot for Set state. Since you already manually set it to 20 - you have to wait for a real value.
Since you are a beginner (we all were) , suggest you:
Create a template sensor with value “10”.
Create two cards - history-graph and gauge - for this sensor.
Set manually values in Dev tools - Set state to ”20.5” and “20,5”.
See what happens to you cards. Also, monitor the Log.
Compare your observations with your user settings for “number format”.
Then you will understand what is a proper number format in your setup.
I never dealt with mqtt - probably a user have to convert strings to expected format…
I got it working. So for anyone that comes across this noobie issue, it seems its not necessarily value_template that determines received mqtt data format, instead its device_class along with unit_of_measurement line to specify what unit of measurement that is compatible with your selected device class you want to use. List of supported device class formats: Customizing entities - Home Assistant
My new mqtt sensor configuration entry in configuration.yaml ( You need file editor add on or similar if its unclear, it was for me) :
# Example configuration.yaml entry
mqtt:
- sensor:
name: "Current Sensor 1"
unique_id: Current_Sense_1
state_topic: "/CurrentSense_1"
device_class: current
suggested_display_precision: 1
unit_of_measurement: A