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

**URL:** <https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759>\
**Category:** General\
**Created:** [23 August 2023 23:01 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759 "2023-08-23T23:01:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [23 August 2023 23:01 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/1 "2023-08-23T23:01:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [24 August 2023 00:28 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/2 "2023-08-24T00:28:37Z")

</div>

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.

> **[Rules - Tasmota](https://tasmota.github.io/docs/Rules/)**
>
> Documentation (Wiki) for Tasmota

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

> [@Eddy-Fischer](#):
>
> Tomosta-\>MQTT Pubish-\>Mosquitto-Broker-\>MQTT Subcribe

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.

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 08:54 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/3 "2023-08-24T08:54:05Z")

</div>

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

 ![Zeitschaltuhr](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/c/2c0f2aa712ef884b2300b990048a02e1ff049df0.jpeg)

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [24 August 2023 10:41 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/4 "2023-08-24T10:41:10Z")

</div>

> [@Eddy-Fischer](#):
>
> 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:

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](https://community.simon42.com/t/nulleinspeisung-pv-mit-node-red/615) ?

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.

> [@Eddy-Fischer](#):
>
> - 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?
> - I do not know how to do that in Node Red.

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/](https://mqtt-explorer.com/) and learn about the topics available and required.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 August 2023 10:42 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/5 "2023-08-24T10:42:21Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 13:44 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/6 "2023-08-24T13:44:58Z")

</div>

Hi, thanks for your assistance. Based on the screenshot below, is the correct path : tele/tasmota\_7E4C70/SENSOR/Total\_in?

 ![MQTT_Explorer](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b4c0a0f394fad7412c97cf981daefd67d2c3f2a8.jpeg)

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [24 August 2023 13:53 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/7 "2023-08-24T13:53:15Z")

</div>

> [@Eddy-Fischer](#):
>
> tele/tasmota\_7E4C70/SENSOR

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](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e44ca019d16b56de19d3523cd27b1924806a5873.png)

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 14:09 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/8 "2023-08-24T14:09:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [24 August 2023 15:56 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/9 "2023-08-24T15:56:10Z")

</div>

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

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

```auto
[
    {
        "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](https://www.youtube.com/playlist?list=PLyNBB9VCLmo1hyO-4fIZ08gqFcXBkHy-6). 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.

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 16:48 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/10 "2023-08-24T16:48:28Z")

</div>

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).

 ![Mqtt](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/3/23575de3d39e54d510c5f09ba662088e26fede36.jpeg)

Kind regards  
Ed

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 August 2023 17:11 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/11 "2023-08-24T17:11:24Z")

</div>

Set the debug node to show msg.payload

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 17:23 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/12 "2023-08-24T17:23:09Z")

</div>

![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/c/ac82a769f7d443f9517d135144c4b45338146de5.png)

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [24 August 2023 17:30 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/13 "2023-08-24T17:30:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 18:11 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/14 "2023-08-24T18:11:48Z")

</div>

I change the language of Node Red to EN:

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/01b21e6338b599737e84ff3f5a6bffb369691c7a.png)

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

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [24 August 2023 18:19 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/15 "2023-08-24T18:19:47Z")

</div>

![Untitled 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/1/c15df6d5183936f35612a097da2379045c71eb4f.jpeg)

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 18:34 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/16 "2023-08-24T18:34:35Z")

</div>

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?

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/f/df7cff218fb6d8839434cdc5343b5eaada663115.png)

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/5/95c8bcae9753ad9ab9f3e1361d986dee002b7817.png)

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 18:41 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/17 "2023-08-24T18:41:25Z")

</div>

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

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/1/d1751990f71684a976998f90c74ba853d51dbca1.png)

---

<div class="post-metadata">

**Author:** ![hominidae](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hominidae/32/4174_2.png) [@hominidae](https://discourse.nodered.org/u/hominidae)\
**Post date:** [24 August 2023 19:09 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/18 "2023-08-24T19:09:59Z")

</div>

> [@Eddy-Fischer](#):
>
> 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?

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:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/4/b4e3668288c002ef22614bc50f063c90d7c03601.png)  
Then show us, what the output of the debug node is giving.

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 19:50 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/19 "2023-08-24T19:50:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Eddy-Fischer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eddy-fischer/32/82092_2.png) [@Eddy-Fischer](https://discourse.nodered.org/u/Eddy-Fischer)\
**Post date:** [24 August 2023 20:15 UTC](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759/20 "2023-08-24T20:15:00Z")

</div>

> [@hominidae](#):
>
> 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?

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

 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/1/a165c5bc7d9f8fe2bf7e9289eeb43bdb6c1ae7a8.png)

[Next page](https://discourse.nodered.org/t/how-to-use-node-red-to-pass-value-from-tasmota-to-opendtu/80759.md?page=2)
