Device class has been set incorrectly

Hi all, I am a programmer/designer but very much a beginner in Home Assistant.
I want to keep a graph of the terminal voltage from a small 6volt solar panel that I have mounted on my garden shed, so I’ve built a Zigbee unit using an ESP32 Dev Board to measure voltage, which works. When I added it to Home Assistant it has been given a State Class of ‘Measurement’ but a Device Class of ‘temperature’ so the History Graph is labelled in degrees (Centigrade, Fahrenheit or Kelvin).
How can I change this so that it displays the value in volts ?
I’ve seen that there are certain things in YAML but I don’t fully understand it (waiting for a text book to arrive from Amazon!).
At one point I managed to open a window that showed YAML with an item configured for ‘K’ but it wouldn’t allow me to edit it and I can’t remember now how I got the said window open.

As I mentioned, I am very much a beginner with Home Assistant so please be gentle with your explanations :slight_smile:

Thanks for any assistance and your patience
PhilipJ

Using ESP32’s to create Zigbee devices is still a pretty new option, so it would be helpful if you share information on how you set it up. If possible, setting it correctly at the source is always the best option.

Otherwise, you need to give it a device class of voltage through manual customization of the existing sensor using customize in configuration.yaml:

Manual Customization

I don’t know what text book you have ordered, but pretty much all of the YAML you will ever need to understand for HA can be learned from the following 2 sources:

  1. YAML syntax - Home Assistant
  2. Thomas Lovén - YAML for Non-programmers

Beyond those two general resources, what is left is the specific configuration variables and schema for individual integrations, and it is unlikely that any text book will provide any information that helps there. That will be found in the HA docs for the integration; or in their github repo in the case of custom integrations.

Hi, thank you for your reply.
I have used a Sparkfun Qwiic Pocket Dev Board which has an ESP32-C6 CPU and I’m using the Arduino IDE system which I find the easiest and quickest way to get something up and running. There is a GitHub repository of examples ( GitHub - sparkfun/SparkFun_Qwiic_Pocket_Dev_Board_ESP32_C6: A Qwiic-sized (1"x1") Development board featuring the ESP32-C6 MINI-1 · GitHub
) so I started with some of those, implementing a temperature probe first as a test and then I moved onto their “Analog Input Output” example.
Thanks for the links which I will look at, I will also examine the example code more closely to see if I can find where it defines the device class.

I ordered the text book because, as a beginner with HA I was unsure of which files to look at (and how to look at them!!) and I hope that it will start at the very beginning and slowly build up to the more sophisticated stuff.
I’m sure I will find the links you have posted most helpful so thanks again
regards
PhilipJ