Energy by NodeRED entity

Hi, I’ve installed NodeRED and I made a power meter that send measure over MQTT, whit functions I’ve programmed an Energy integrator and I created some entities with energy values.

The supervisor not found those entities as energy statistics, why? What propriety I’ve got to set?


State class should be “total” or “total_increasing”

HA only recognises three state classes - measurement, total, total_increasing, and the energy dashboard is looking for entities of the correct state class otherwise you will not see them

For those interested:

Hi, thanks for reply me;
I’ve already tried to set state_class to total_increasing but nothing change, and also this entity was deleted and the core find only “sensor.power” entity that I don’t exist:

and isn’t clickable

If someone can help me, I’ll so grateful


I assume your Node-RED entity node created an entity called sensor.power, and this entity is still there even though you have changed the entity node settings.

I have found that if I make a change to the Node-RED HA entity node, then it will not always update in HA. The entity node registers a new entity using API call only the first time it is deployed, it does not always update small changes, and therefore it is necessary to get Node-RED to first remove the old entity before making changes.

To make changes to an entity that has been created by the Node-RED entity node:
I first set the entity node to disabled, and deploy the flow. This usually removes the Node-RED created entity from HA (deregisters it).
Then I make the changes to the entity node.
Then I set the entity node to enabled, and re-deploy the flow. This registers and creates a new entity in HA.

You can also try settings > devices and services > entities and try selecting and deleting the old entity from there. If an old entity has become orphaned it will usually show up as such and can be deleted.
If after that you still have an old entity remaining in HA from an incorrect entity node then you may have to restart Node-RED and/or restart HA.

Thanks for your time,


Yes, I deleted the entity and after I re-created it whit modified fields

As I said in the previous post, the entity “sensor.power” isn’t reachable from “Entities” in Config tab and so I can’t delete it manually

Just tried also this for few times but nothing change


I have just been checking and I found one of my Node-RED entity nodes (for energy counter) had the state class and device class around the wrong way. This did not stop it working, but it did mean that the energy dashboard did not find the entity when I was trying to add it.

I changed the state class to ‘measurement’ and device class to ‘energy’, but I had to disable the entity, redeploy the flow which removed the entity from HA, then change the state and device classes, then re-enable the node, then redeploy the flow, then trigger the node with a payload. This re-registered the node and updated the state. Now I can see the entity with the correct state class and device class.

I can also confirm that I can now see this entity in the selection list for the energy dashboard settings. The state class can be total or total_increasing or measurement, but the device class must be ‘energy’.

In your case I now wonder if the energy dashboard setting has become corrupt.

You created a Node-RED HA entity node, EnergyAcc, but with sensor.power as the state class. You added this to the energy dashboard (the device class was energy so it was found), and this must have then broken the energy dashboard with a state class of ‘sensor.power’. Somehow an entity called ‘sensor.power’ has been created, or a false entity called ‘sensor.power’ added to the entity list, within the energy dashboard.

You have disabled the Node-RED node and deployed the flow, which should have removed the old entity. You can no longer see ‘sensor.power’ or ‘EnergyAcc’ in the list.

You have checked settings >> entities and can’t see either entity
You have checked developer tools > states and can’t see either entity
You have checked settings > integrations > Node RED > entities and can’t see either

you have restarted Node RED and HA

The issue is that the settings > dashboard > energy dashboard > add consumption/solar/etc just shows the one entity sensor.power (which does not exist)?

I am guessing that the energy dashboard (setting file) has become corrupt.

I found:

So I looked in my config folder. One of the hidden folders is ‘.storage’, and in there is a file ‘energy’ which, editing with notepad or text editor, shows up as a JS dictionary with all the configuration settings for my energy dashboard.

Part of this is

    "version": 1,
    "minor_version": 1,
    "key": "energy",
    "data": {
        "energy_sources": [
                "type": "grid",
                "flow_from": [
                        "stat_energy_from": "sensor.grid_energy_import",
                        "stat_cost": null,
                        "entity_energy_from": "sensor.grid_energy_import",
                        "entity_energy_price": null,
                        "number_energy_price": 0.274
                "flow_to": [
                        "stat_energy_to": "sensor.grid_energy_export",
                        "stat_compensation": null,
                        "entity_energy_to": "sensor.grid_energy_export",
                        "entity_energy_price": null,
                        "number_energy_price": 0.075
                "cost_adjustment_day": 0.0
                "type": "battery",
                "stat_energy_from": "sensor.mb_e_from_battery",
                "stat_energy_to": "sensor.mb_e_to_battery"

My energy dashboard is set up with ‘consumption from grid’ as ‘sensor.grid_energy_import’, and the ‘export to grid’ (solar) is ‘sensor.grid_energy_export’

After that I have set up a battery system with from/to battery energy, and then there is gas and solar and other bits.

I hope that this is enough for you to be able to find and check you energy dashboard setting file, and if you find a ‘sensor.power’ in the setting for the ‘entity_energ_from’ field then we will know that this is the file that has become corrupt, and hopefully you will be able to edit it or remove it or restore it (just take a backup FIRST!).

I hope that helps, otherwise I am out of ideas.
Good luck.

The whole thread about resetting energy configuration:
How to delete energy configuration and start again

Yes, I think so 'cause I don’t see it anywhere.

ok, I’ve just tried to reset but nothing change:

I would like to modify manually the energy file but terminal add-on as a poor nano editor and I can’t edit the file correctly.

Can you help me also to do this?


I took the easy option and set up the samba share as an add-on, and configured my HA /config folder as a network drive on my PC. This means that I can click on a network drive and go straight into my /config folder on my HA device. It really is not that difficult to do.

Also I have ticked ‘show hidden items’ so I can see the ‘.store’ folder. I just use windows to browse and notepad to edit. So much easier.

I believe that none of the inbuilt editors will access the hidden folders, so other than samba share it has to be via terminal, and I have avoided using that.

First step - if you can get at the energy setting file it is worth opening it and looking to see if it has ‘sensor.power’ in there somewhere - that would certainly suggest the file has become corrupt before you start messing about with things!

If you can only see the file but not edit, it may just be worth renaming it as is suggested in the link ‘how to delete energy configuration and start again’. To do this you should certainly stop HA first, and just rename the file to something like ‘oldenergy’. I believe from the posting that HA, on start up, will create a new default file and put everything back to right again. Do read the post!

I suggest you set up samba share if you are using a PC - makes everything much easier in the long run.

You may find this is the answer to finding the file and changing the name in terminal

change directory to config, then to .storage, then rename the file (mv command apparently moves or renames a file)

but do turn HA off first!!!

nothing about “sensor.power” in my energy file:

    "version": 1,
    "key": "energy",
    "data": {
        "energy_sources": [
                "type": "grid",
                "flow_from": [],
                "flow_to": [],
                "cost_adjustment_day": 0.0
        "device_consumption": []

I’m trying to rename to energy.old this file



So energy file is ok and not corrupt.
Still have this strange sensor.power entity which must be somewhere in HA.

Nothing under settings > devices & services > entities (and you have checked all entities are shown)

I assume you have done the usual update checks for the latest HA, Node-RED and so on.

I am sorry but I am out of ideas.