How to use node red to pass value from tasmota to openDTU

Hi all, I am a complete beginner in Node Red. My goal is to read one object from the smartmeter using tosmota (with a specific topic) and send it to OpenDTU to overwrite a specific topic value.
Tomosta->MQTT Pubish->Mosquitto-Broker->MQTT Subcribe and overwriting a specific topic value in OpenDTU. I need someguidiance to do that or at least some very simple example to understand it. Thanks in advance.

You don't provide any specific details so I can only make general assumptions.

If OpenDTU is connected to the same MQTT broker as Tasmota, then you could create a rule in Tasmota to publish the payload directly to the required topic for OpenDTU.

If you want to do it via NR then you already have the correct idea

The only missing bit is to feed this back to an MQTT out node with the needed topic.

If you can provide details of the topic and payload from Tasmota, and the required values and topic for OpenDTU I could show you how to do this.

Hi, thank you so much for the quick reply. Let me describe my goal in a more specific way.

Current setup:

  1. I have an microinverter Hoymiles which have a maximal AC Output of 600 Watt. I am using OpenDTU
    to monitor and to limit its AC Output.
    Currently I am regulating its AC output manually using OpenDTU (OpenDTU has its own fixed IP).

  2. I have installed Home Assistant with Node Red Add-On and Mosquitto in a HP Thin Client which is running as a server (24/7).
    (Its has as well its own fixed IP)

  3. I have installed tosmota 13.0.0(tasmota32) on a WT32-ETH01 micro controller (Its has as well its own fixed IP)

Current situation:
Before I installed Tosmota I am using a very primitiv solution to regulate the AC output by using a timer in Node Red (Pic Zeitschaltuhr).

After I installed Tosmota, I found out if I could get the value of the topic "Total_in" (from my script: only this row -> 1,1.7.0(@1),Wirkleistung P+, kW,Total_in,3),
I could have a zero export, of course not 100% but close to zero export.

This is the script I use to get the value from Siemens TD-3511:

D
B
=>sensor53 r
M 1
+1,3,o,0,300,,1,30,2F3F210D0A,063030300D0A
1,2.7.0(@1,Aktuell Einspeisung,KWh,Current_out,3
1,1.8.0(@1,Gesammt Bezug,KWh,Total_in,3
1,2.8.0(@1,Gesammt Einspeisung,KWh,Total_out,3
1,31.7(@1,Stromwert L1,A,I_L1,2
1,51.7(@1,Stromwert L2,A,I_L2,2
1,71.7(@1,Stromwert L3,A,I_L3,2
1,32.7(@1,Spannungswert L1,V,Voltage_L1,2
1,52.7(@1,Spannungswert L2,V,Voltage_L2,2
1,72.7(@1,Spannungswert L3,V,Voltage_L3,2
1,1.7.0(@1),Wirkleistung P+, kW,Total_in,3
1,2.7.0(@1),Wirkleistung P-, kW,Total_out,3

The topic path from Tosmota:
MQTT Host 192.168.178.66
MQTT Port 1883
MQTT TLS Disabled
MQTT User mqtt-user
MQTT Client DVES_7E4C70
MQTT Topic tasmota_%06X
MQTT Group Topic 1 cmnd/tasmotas/
MQTT Full Topic cmnd/tasmota_7E4C70/
MQTT Fallback Topic cmnd/DVES_7E4C70_fb/
MQTT No Retain Disabled

My goal:
I want to create a Node Red which publish each 10 seconds the value of Total_in (from "1,1.7.0(@1),Wirkleistung P+, kW,Total_in,3") to mosquitto Broker, and afterwards be subscribed by OpenDTU as writeable value (path of writeable OpenDTU would be: solar/116183066761/cmd/limit_persistent_relative)

  1. Problem is, I do not know which topic path I should use from the Tosmota e.g. "tasmota_%06X/Total_in" since i just want to read?
  2. I do not know how to do that in Node Red.

I hope I could describe all of the information correctly and comprehensively.

Apologize for my bad english.

For any kind of assistance, I am very grateful.

Regards
Ed

Not quite clear, what your installation looks like and where and how the diffenet components come into play.
Obviously, you want a zero feed-in solution for your small balkony solar array.
Did you see this Nulleinspeisung PV mit Node-Red - Anleitungen / Projekte - simon42 Community ?

Edit. as a side-note, throwing away any excess-energy, that you are not able to consume yourself is counter productive to the community....if you really have that much of excess, you are able to sell it to your DSO...all that is needed is to register it properly whith your DSO and to this regard/intention.

Let's assume that the data from your smart-meter is already published to mqtt (via homeassistant and/or tasmota) and openDTU is also connected to the mqtt broker as well (as you had this running without tasmota beforehand) ...
For (1) I suggest to explore the contents of your mqtt broker, by using https://mqtt-explorer.com/ and learn about the topics available and required.

Can you explain how the data gets from your smart meter into Node-red?

1,2.7.0(@1,Aktuell Einspeisung,KWh,Current_out,3
1,1.8.0(@1,Gesammt Bezug,KWh,Total_in,3
1,2.8.0(@1,Gesammt Einspeisung,KWh,Total_out,3
1,31.7(@1,Stromwert L1,A,I_L1,2
1,51.7(@1,Stromwert L2,A,I_L2,2
1,71.7(@1,Stromwert L3,A,I_L3,2
1,32.7(@1,Spannungswert L1,V,Voltage_L1,2
1,52.7(@1,Spannungswert L2,V,Voltage_L2,2
1,72.7(@1,Spannungswert L3,V,Voltage_L3,2
1,1.7.0(@1),Wirkleistung P+, kW,Total_in,3
1,2.7.0(@1),Wirkleistung P-, kW,Total_out,3

Does all of this data arrive as a single message, or 1 message per line?

It would help if you can show us an example of the data arriving at Node-red. Use a debug node set to show the complete message.

Hi, thanks for your assistance. Based on the screenshot below, is the correct path : tele/tasmota_7E4C70/SENSOR/Total_in?

That is the topic to subscribe to with your MQTT in node. The value is contained in msg.payload.Total_in You can see this if you add a debug node setup like this
image

Hi,
I miss a few steps prior to your hint.
Could you assist step by step from beginning, just to show the correct value using debug?
Thanks and regards

Eddy

Well there isn't a few steps :grinning: just literally an MQTT in node and a debug node.

Import this flow and change the MQTT node to your MQTT server.

[
    {
        "id": "37b9a3007cdefd67",
        "type": "mqtt in",
        "z": "be14baae.1728",
        "name": "",
        "topic": "tele/tasmota_7E4C70/SENSOR",
        "qos": "2",
        "datatype": "json",
        "broker": "",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 775,
        "y": 2985,
        "wires": [
            [
                "955c0bd27ff218a9"
            ]
        ]
    },
    {
        "id": "955c0bd27ff218a9",
        "type": "debug",
        "z": "be14baae.1728",
        "name": "debug 329",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload.Total_in",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1030,
        "y": 2985,
        "wires": []
    }
]

If you are just starting I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

Hi, many thanks for the help. Unfortunately I got result "undefined".
For sure I will go through the tutorial as soon as I have the time (I am still looking for the right parameter to show the export to grid from Siemens TD3511, until now no luck).

Kind regards
Ed

Set the debug node to show msg.payload

I hope this is waht you mean with "Set the debug node to show msg.payload"

You have it set to show msg.payload.Total_in. Set it to just msg.payload (which is the default for a debug node).

I change the language of Node Red to EN:

If this is not what you mean, I need to raise a white flag (surrender)

Thank you so much for the patience. Sorry I did misunderstand you since this was recommend in the very beginning (add ".Total_in" in msg). Alright. It works now: So from what I understood, the Tasmota publish the data ( I have set this in tasmota) and in Node Red I simply subscribe this payload (but in a structure instead of single payload: they call that json or something similar?. Next would be: How can I tell OpenDTU to get the value from the structure of "Total_in" using the OpenDTU topic solar/116183066761/cmd/limit_persistent_absolute?

It looks like the 10 second interval is coming from tosmota since I override it (if I am not wrong) :

Yes, this payload is a nested JSON formatted list of objects, which is standard with tasmota.
In order to fetch the value of "Total_In", you need to parse / split the JSON payload.
Unfortunately the second object has no name (you can see that best in the screenshot from mqtt-Explorer.
The first Object has the Name "Time" ( and a timestamp as value)...the second object has no Name (you can see the """") and then -as its value - another object / list of key-value pairs (where one of these is your desired "Total_in" element).

As said, it would be much easier, if the second object had a non-empty Name, like "Energy".
Are you able to change the way tasmota is creating that JSON output?

As a first step, put a "Split" node after the node, that subscribes / fetches the tasmota topic.
Configure it like this:


Then show us, what the output of the debug node is giving.

Hi Menschenaffen,
sure I would add the name for the second object, if you help me to do so.
Regards
Ed

I need to somehow add a value "Energy" like below: