Hi everyone,
I got an ESP chip reading my electricity meter using the tasmota addin. The reading apears on the dashboard, but does not apear under the energy tab. I found out that the device class must be ‘energy’ and the unit must be ‘kW’ in order to be recognise as energy sensor. How and where can I set those parameters?
Thanks in advance for your hell.
I had the same question some weeks a ago, when i’ve started with Home Assistant and Tasmota.
I’ve read alot of different threads and now everything is working.
First of all you need a Samba or SSH Addon in your HA to access the configuration.yaml on HA virtual machine.
Settings->Addons->Search for Samba or SSH and install and configure it.
If you already have this running, edit the configuration.yaml and add something like this:
homeassistant:
customize: !include customize.yaml
Save the file and add a new file “customize.yaml” in the same directory as configuration.yaml.
Edit the “customize.yaml” and add one or all of the following lines:
sensor.tasmota_e320_total_in:
state_class: total_increasing
device_class: energy
unit_of_measurement: kWh
sensor.tasmota_e320_power_in:
state_class: measurement
device_class: energy
unit_of_measurement: W
sensor.tasmota_e320_total_out:
state_class: total_increasing
device_class: energy
unit_of_measurement: kWh
You have to edit the first lines of the blocks. f.e. sensor.tasmota_e320_total_out
You can find your right sensors names under Developertools → States → sensor.tasmota*
These names are my personal tasmota sensor names, your sensors could have different names / IDs.
The first block is the total count of kWh and its increasing.
The second block is the current power which is used, its in W and its class is measurement.
The third block is the total count of kWh i am not using and sending “back” to the net.
If you have edited your sensor names save the customize.yaml file, save configuration.yaml file and restart HA completely (Settings->System->Right upper corner icon)
I hope i didnt miss something.
After this you should be able to use the tasmota sensors in energy dashboard.
Hi Insolein,
Many thanks for the Tips. It helps me a lot as new commer to HA. Indeed my entities have now the device_class: energy and the right units, and state_class. Newertheless the dont want to apear in the dropdown menu to configure an input under dashboard/energy.
Would you have another idea?
When you take a look under development tools - >States.
Do the tasmota sensors have the correct values as configured in the yaml files?
Hi Insolein,
I found out the reason: the statistics had some recordings without units, and other with units “kWh”. I had to go to “developper tools/statistics” and correct this issue by clicking in the last column.
Now I have my data Consumtion and Photovoltaic production showing in the nice energy tab.
Many thanks again for your help.
Best Regards.
Sorry for my late answer.
Im glad to hear, that everything is working now for you.
Good to know, that the statistic can be a problem in that case.
You’re very welcome!