Energy Dashboard Configuration - MQTT / Domoticz

Greetings,

I am very new to the energy dashboard. With some help from @mobile.andrew.jones I have been able to input the data from my solar inverter, which is coming via Domoticz… because Domoticz will talk to my SolarMax Inverter.

I have a few problems to solve. Inaccuracies in the Energy Dashboard data and being able to reset the data shown in the dashboard.

Here’s my is my mqtt energy config…

 - platform: mqtt
   state_topic: "domoticz/out/8"
   value_template: "{{ value_json.svalue1|float(0) }}"
   device_class: "energy"
   name: "Solar kWh Meter"
   state_class: "measurement"
   unique_id: "c17e1348-d4ee-47ed-b790-4963727d94c0"
   unit_of_measurement: "kWh"
   last_reset_topic: "domoticz/out/8"
   last_reset_value_template: '1970-01-01T00:00:00+00:00'

So… I have the following data coming from Domoticz via MQTT…

{
	"Battery" : 255,
	"RSSI" : 12,
	"description" : "",
	"dtype" : "General",
	"hwid" : "2",
	"id" : "00000101",
	"idx" : 8,
	"name" : "kWh Meter",
	"nvalue" : 0,
	"stype" : "kWh",
	"svalue1" : "1759.000",
	"svalue2" : "27061000.000",
	"unit" : 1
}

What is interesting… despite the use of kWh in the MQTT data, I suspect the figure: “svalue1” : “1759.000” is actually a real-time feed of the ‘watts’ coming from the inverter? So not sure how that translates to kWh… remember, I said I am very new to the energy dashboard, so feel free to let me know what I am missing.

The second issue… I integrated the MQTT feed from Domoticz, no problem… however I was initially using total_increasing instead of measurement. And that appears to have caused a ‘spike’ in the statistics in the Energy Dashboard…

I know the data above is incorrect… so I would really like to erase all the data and start from scratch… but no matter what I do I am unable to reset the data? Is there a simple way to erase everything and then start again?

Here’s the data from the Domoticz Dashboard, which helps me believe the HA Energy Dashboard is wrong…

I assume my mqtt energy config is correct now? But I am still not sure about the data coming from Domoticz i.e. watts versus kWh?

Any help would really be appreciated, no doubt there will be something simple I have missed.

To help explain the watts versus kWh concern I have… Here’s a side by side comparison from MQTT Explorer (on left) and Domoticz dashboard (on the right).

It looks to me like the MQTT data is the real time ‘watts’ from the inverter? Which I assume I somehow need to tell the HA Energy dashboard?

If it is actually watts, you will need to use the Integration integration

Here is an example of my own setup:

  - platform: mqtt
    name: "House Electric"
    state_topic: "dhjm/rfxgateway/CM119_160/0xC872"
    device_class: power
    unit_of_measurement: 'W'
    value_template: "{{ value_json.power.value | int }}"
  - platform: integration
    source: sensor.house_electric
    name: House Electric KWh
    unit_prefix: k
    round: 2

Integration takes an existing sensor and performs the calculations to convert it to kWh

Hi Andrew,

I changed the config to below, primarily to see what would happen…

 - platform: mqtt
   state_topic: "domoticz/out/8"
   value_template: "{{ value_json.svalue1|float(0) }}"
   device_class: "power"
   name: "Solar Inverter"
   state_class: "measurement"
   unique_id: "c17e1348-d4ee-47ed-b790-4963727d94c0"
   unit_of_measurement: "W"
   last_reset_topic: "domoticz/out/8"
   last_reset_value_template: '1970-01-01T00:00:00+00:00'

Are you saying the HA Energy Dashboard wont know how to deal with power statistics in watts, and instead needs kilowatt hours?

I also still haven’t figured out how to reset the data already in the Energy dashboard, so hope I can find a way to reset back to zero :laughing:

Yes the energy dashboard does no calculations itself, it takes data that it expects has already had the calculations done. As for starting again:

Hi Andrew,

Changed my config to below… it eventually appeared as an option under the Energy config area. So will see what happens.

# kWh Solar from Domoticz
 - platform: mqtt
   name: "Solar Inverter"
   state_topic: "domoticz/out/8"
   device_class: power
   unit_of_measurement: 'W'
   value_template: "{{ value_json.svalue1 | int }}"
 - platform: integration
   source: "sensor.solar_inverter"
   name: "Solar Inverter KWh"
   unit_prefix: "k"
   round: "2"

Here’s what I see in Developer Tools…

So it’s looking promising, because the 1247 figure shown matches the wattage numbers in Domoticz. Not sure if the kWh figure is right, but it is at least changing. What I will do is try and match the kilowatt hours in Domoticz with what I see in HA.

What is interesting, when I changed the HA config (above) the Energy Dashboard appeared to reset and has possibly started from scratch. Interesting?

1 Like