Page 1 of 1

MQTT energy meter data from Tasmota to Domoticz

Posted: Tuesday 23 March 2021 23:27
by Domoberry
Hi Forum,
Got stuck with this one, so probably took a wrong turn somewhere. Any suggestion would be welcome!

I have used the 'Tasmota Smart Meter Interface' to connect it to a 3 phase Modbus energy meter. This works, in Tasmota I can see the meter readings I requested (Energy [kWh], 3 x Power [W], and 3 x Voltage [V]; the meter offers others as well if needed).
I have also installed Mosquitto MQTT, which also works. Using an MQTT monitor I can see Tasmota publishing its messages.
Next is the part I'm stuck with:

In Tasmota you can 'Configure Domoticz'. Create a dummy device in Domoticz, and enter the corresponding IDX in Tasmota.
Example: create dummy voltage device (idx=557), then set in Tasmota 'Sensor idx 7 Voltage/PM2.5' to 557. As a result, new MQTT messages get published:
domoticz/in {"idx":557,"nvalue":0,"svalue":"12.0","Battery":100,"RSSI":10}
The value 12.0 sent is power for phase 2 and not the voltage of any of the phases.
Secondly, a 'usage (electric)' dummy device (idx=560) is linked to Tasmota's 'Sensor idx4 Power,Energy' this results in more MQTT messages addressed to Domoticz:
domoticz/in {"idx":560,"nvalue":0,"svalue":"3;1813.2","Battery":100,"RSSI":10}
Here two values are sent across: the power from phase 1 (3W) and total energy (1813,2 kWh). The Domoticz UI shows the power and only the energy 'today', not the total.
Lastly, using another Domoticz dummy device and link that to 'sensor idx 8 Current/PM10 shows power for phase 3
I have not managed to get any of the three voltages across.

It seems there are some translations taking place, but not the correct ones.
How and where can I correct that?

Re: MQTT energy meter data from Tasmota to Domoticz

Posted: Thursday 25 March 2021 21:07
by marcojpolet
Hi!
Not sure if it will help, but if you edit a power device, you can switch the 'Energy read' between 'Computed' and 'From device'.

Regards,
Marco

Re: MQTT energy meter data from Tasmota to Domoticz

Posted: Saturday 27 March 2021 9:15
by Derik
Or perhaps a node red for the reading of tasmota?
I am looking also for a option node red.

Re: MQTT energy meter data from Tasmota to Domoticz

Posted: Saturday 27 March 2021 13:23
by waltervl
There is a Tasmota MQTT discovery plugin that perhaps could solve your problem. https://github.com/emontnemery/domoticz_mqtt_discovery

Re: MQTT energy meter data from Tasmota to Domoticz

Posted: Saturday 27 March 2021 13:38
by Derik
I now
Only plugins are not always a fine way to use
Most trouble with domotiz i have whit plugins.
Like the new z2m plugin

Re: MQTT energy meter data from Tasmota to Domoticz

Posted: Saturday 27 March 2021 13:59
by FireWizard
hello @Domoberry

This is not a Domoticz issue, but a Tasmota issue.

Tasmota is not able as far as I can see to send the data for a 3 Phase system, such as 3 times the Voltage and 3 times the Power to separate idx's in Domoticz.

However you got already the solution at: https://groups.google.com/g/sonoffusers ... TElU?pli=1.

If you do not succeed in setting up the 2 rules you need, an alternative solution can be to configure it in Node Red.

Let me know if you need more support in that.

Regards

Re: MQTT energy meter data from Tasmota to Domoticz

Posted: Sunday 28 March 2021 12:27
by Domoberry
Thanks all for the tips!
Tasmota or Domoticz issue? Neither probably as this option (Sinotimer DDS024MR 3 phase MODbus power meter in Tasmota via MQTT to Domoticz) seems not out of the box available.
Here is my current understanding - thanks to all suggestions made:
  • the 'root' challenge is that you need to map data from Tasmota to Domoticz devices using MQTT
  • Tosmota has several build-in mappings to Domoticz, but not for a scripted 3 phase Energy meters
  • Domoticz expects MQTT messages formatted for a specific device
  • solution: write some code to do this mapping
The options, as far as I can see, are (I'm sure I have missed the best alternatives...):
Domoticz approach
  • Use of NodeRed is suggested to do the mapping. If I understood correctly, you can use NodeRed to create a 'flow' that receives the MQTT messages from the energy meter containing all data. Tasmota is sending these anyhow. Translate these into MQTT messages which Domoticz can use for the dummy devices you want. I have not used NodeRed, so currently looking to another way.
  • Perhaps it is possible to use DzVents to write a script, triggered by the MQTT message from Tasmota sends anyhow and handle the mapping in the Dzvents script. Not sure if that could work, seemed a bit out of my comfort zone 8-) .
  • Write a Python plugin. Definitively way out of my comfort zone!
Tasmota approach
  • Use its "Rules" engine to do the mapping. The Oops: Tasmota cannot do 'Scripting' and 'Rules' in one build. Scripting is needed to specify exactly how your MODBus device works (quite cool actually). If you do not need Scripting, the Rules approach could be a good option.
  • Use "Scripting". Actually, Tasmota scripting is more powerful than just defining a MODBus energy meter. This is the path I'm following now. (Hopefully) resulting in a script that will use the data from the meter. Do things like 'add power P1+P2+P3' and send MQTT messages to Domoticz dummy devices with exactly the data and format needed. This scripting is (for me non-programmer) new and also due to the limited resources on a Wemos ESP8266 a bit more complex. I might get stuck...
I cannot say if the scripting approach is 'better' than NodeRed, or perhaps again something else ;)
Neither is it my intention to say one is better than the other, just sharing this hobby!
If I have more details, will let you know!

Re: MQTT energy meter data from Tasmota to Domoticz

Posted: Monday 13 March 2023 10:36
by Domoberry
What I eventually did is connect the energy meter using a modbus hardware interface on Domoticz:
Sinotimer DDS024MR 3phase energy meter -> Modbus / RS485 -> RS485 to USB dongle (CH340G) -> USB -> Modbus RTU Domoticz