Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

MQTT interfacing Tasmota Smart Meter to Domoticz - how to?

1,300 views
Skip to first unread message

Domoberry

unread,
Mar 24, 2021, 5:39:49 AM3/24/21
to TasmotaUsers

Hi Team, first post here, looking for some advice on using Tasmota Smart Meter via MQTT to Domoticz.

What do I want to achieve?

I would like to receive data from a Sinotimer DDS024MR 3 phase MODBus energy meter in Domoticz. To that extend I have created the Tasmota Smart Meter build and installed that on a Wemos D1 mini. Together with the RS485 hardware and a suitable Tasmota Smart Meter script, this works: Tasmota shows values for Energy, 3 x Power and 3 x Voltage as intended. I have installed an MQTT broker (Mosquitto) together with Domoticz on an RPI. 

What is the challenge?

As next step, I need to interface Tasmota via MQTT to Domoticz. From an MQTT point of view, that works. Then, one needs to create in Domoticz ‘Dummy’ devices of a suitable type and record their ID’s (idx). In Tasmota, using the Configure Domoticz menu, one can link a measured value – say power – to a dummy Domoticz device by entering its idx. As a result, Tasmota starts publishing MQTT messages to the topic ‘domoticz/in’ which are picked up by Domoticz. It’s this step that I’m stuck with. I probably missed some piece of ‘how to’ information…

My question

I cannot figure out how setup on Tasmota side such that Domoticz receives the right data in the right dummy devices. For example, the Configure Domoticz Tasmota menu has only one Power option, how do I get the three values (one for each phase) across? Same for the three voltage values for each phase; only one voltage option in the Tasmota menu (and if I use it, I get one of the power values in Domoticz).

How to set this up in a more flexible way than the Configure Domoticz Tasmota menu offers? Or, where did I miss out? Or is it perhaps something not fully supported?

Tom

unread,
Mar 25, 2021, 1:58:30 PM3/25/21
to TasmotaUsers
Hi,

I had a similar problem with multiple DS18B20 sensors on Tasmota. I solved it by leaving the Domoticz config empty in Tasmota and creating a rule like the following one to publish data to Domoticz instead:

on tele-DS18B20-1#temperature do publish domoticz/in {\"idx\":41,\"svalue\":\"%value%\"} endon on tele-DS18B20-2#temperature do publish domoticz/in {\"idx\":44,\"svalue\":\"%value%\"} endon

You'll need to figure out the correct triggers for your smart meter inputs. 

Tom
Dne středa 24. března 2021 v 10:39:49 UTC+1 uživatel Domoberry napsal:

Domoberry

unread,
Mar 25, 2021, 5:15:21 PM3/25/21
to TasmotaUsers
Hi Tom,
That is indeed the type of solution I'm looking for!! I can create the (dummy) devices in Domoticz I would like to use and construct require 'rule' to generate the mqtt message I need. The use of rules would be a new chapter for me. Yet for your example I get a good idea of how this could work.
Some homework to do. Thanks for your top!

Domoberry

unread,
Mar 27, 2021, 10:49:42 AM3/27/21
to TasmotaUsers
Hi Tom,

To use rules in Tasmota, I needed to create a new tasmota.bin. I use GitPod for that. However, when I tried to compile this new version, an error was thrown: "#error "Select either USE_RULES or USE_SCRIPT. They can't both be used at the same time".
I'm using a script to define the energy meter and want to use rules to get the correct mqtt messages, e.g. need them both.
Are you using both scripts and rules? If so, where did I make a mistake?
A DS18B20 is a one-wire temperature sensor, so you might not need to use scripts?

sfromis

unread,
Mar 27, 2021, 11:08:02 AM3/27/21
to TasmotaUsers
You cannot use Tasmota rules and scripting at the same time. The things you can do in rules should also be possible in scripting, but you may need some learning curve to get there.


Domoberry

unread,
Mar 27, 2021, 11:44:33 AM3/27/21
to TasmotaUsers
Is there a specific path towards a solution recommended? What would like to achieve is to map values from a 3 phase energy MOSbus meter to the correct Domoticz devices, the Tasmota build-in 'Configure Domoticz' menu seems too limited (or I missed something).
If scripting as you suggested, could you point me to some wiki where this approach is explained (to get me on the learning curve ...)
Thanks!

Domoberry

unread,
Mar 27, 2021, 12:56:31 PM3/27/21
to TasmotaUsers

Tom

unread,
Mar 27, 2021, 1:03:57 PM3/27/21
to TasmotaUsers
I use the default tasmota.bin for most of my devices. To be honest I do not know anything about energy meters, but if you can see all the information you need within the Tasmota WebUI then you should  be able to use all these information within your rules, I think. You just need to figure out the correct events to bind your rules to.

Dne sobota 27. března 2021 v 16:44:33 UTC+1 uživatel Domoberry napsal:

sfromis

unread,
Mar 28, 2021, 8:04:04 AM3/28/21
to TasmotaUsers
As a starting point, the Domoticz setup simply does not accommodate many of the Tasmota features, which are thus unavailable. As I understand it, getting full support for things like power monitoring would take expansion of what Domoticz can accept, and Tasmota-side support (like using rules) to publish additional data to Domoticz. Other home automation platforms may be less restricted in what they expect to receive. Unless you really, really want to connect to Domoticz, that platform would not be one I'd recommend.

Domoberry

unread,
Mar 28, 2021, 4:14:34 PM3/28/21
to TasmotaUsers
I'm already using Domoticz...
But, made - at least form my point of view - progress with Tasmota scripting! 
The script successfully defines the various variables, defines the MODBus meter, assigns values from the meter to the variables, even does a simple calculation. 
Using the script?<var> console command I can check that it is as I intended. 
The last and crucial step is to publish using several mqtt messages with the topic 'domoticz/in'. For mqtt, the ">J" section in the script looks like the way to go.
Domoticz expects mqtt messages published to the topic 'domoticz/in' with a payload like {"idx":559,"svalue":"3.10;1893.67","nvalue":0,"Battery":255,"RSSI":100.00}. In this example device 559 is an Energy device which accepts the current power (3.10W) and the total usage (1893.67 kWh). 
However...
Everything is published in one mqtt payload on the topic "EVSE_pwr_87970E/tele/SENSOR" (EVSE_prw_87970E is the topic name given to mqtt in Tasmota)
So, next step is to figure out how to change the topic (for these messages) and how to generate separate messages.
If someone already has a suggestion, welcome! 

cool53

unread,
May 5, 2023, 2:01:09 PM5/5/23
to TasmotaUsers
As Tom already mentioned, you can use rules instead of the builtin domoticz support
especially if multiple power and/or sensors are used on a single device.
Tasmota is perfect in collecting sensor data of all kind, but getting things converted to
the correct formats (no matter if using domoticz, homeassistant, iobroker  or whatever
you like)  you will end up frustrated - that is - without node-red.
Node-red can trigger on any mqtt message and change it in your desired target input.
Plus: node-red provides a grafical view of what (should) be going on.
I really recommend using it.
Beside that, I am still trying to figure out what data a domoticz smart meter will accept.
Reply all
Reply to author
Forward
0 new messages