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

Sorry I didn't notice the lack of object name earlier, as it the first time I have seen this particular setup in Tasmota.

You need to set the json prefix (object name) in the meter definition script. eg METER like this -

+1,3,o,0,300,METER,1,30,2F3F210D0A,063030300D0A

Then the property would be msg.payload.METER.Total_in

Try this flow and see if it works for you -

[{"id":"f2ebace250bb8c68","type":"mqtt in","z":"ccc06d33.2e8e08","name":"","topic":"tele/tasmota_7E4C70/SENSOR","qos":"2","datatype":"auto","broker":"","nl":false,"rap":false,"inputs":0,"x":265,"y":3750,"wires":[["5efc0d3414122b4a","64a94d8f913a7c29"]]},{"id":"42e8a6e9e98930aa","type":"mqtt out","z":"ccc06d33.2e8e08","name":"","topic":"solar/116183066761/cmd/limit_persistent_relative","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"","x":965,"y":3750,"wires":[]},{"id":"f0330ce30ce0d831","type":"debug","z":"ccc06d33.2e8e08","name":"payload","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"limit_persistent_relative","statusType":"auto","x":835,"y":3675,"wires":[]},{"id":"5efc0d3414122b4a","type":"change","z":"ccc06d33.2e8e08","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.METER.Total_in","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":515,"y":3750,"wires":[["f0330ce30ce0d831","42e8a6e9e98930aa"]]},{"id":"64a94d8f913a7c29","type":"debug","z":"ccc06d33.2e8e08","name":"payload.METER.Total_in","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload.METER.Total_in","targetType":"msg","statusVal":"limit_persistent_relative","statusType":"auto","x":550,"y":3675,"wires":[]}]

If not it may be you need to send to the shorter topic with "limit_persistent_relative" as the command

In which case try this flow -

[{"id":"81fb36033f46e144","type":"mqtt in","z":"ccc06d33.2e8e08","name":"","topic":"tele/tasmota_7E4C70/SENSOR","qos":"2","datatype":"auto","broker":"","nl":false,"rap":false,"inputs":0,"x":265,"y":3945,"wires":[["41b5d45db0cfa3c3","dda63fc947bc4591"]]},{"id":"bf8bfbce35454587","type":"mqtt out","z":"ccc06d33.2e8e08","name":"","topic":"solar/116183066761/cmd","qos":"1","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"","x":885,"y":3945,"wires":[]},{"id":"ba61fd81b975e590","type":"debug","z":"ccc06d33.2e8e08","name":"limit_persistent_relative","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"limit_persistent_relative","targetType":"msg","statusVal":"limit_persistent_relative","statusType":"auto","x":885,"y":3870,"wires":[]},{"id":"41b5d45db0cfa3c3","type":"change","z":"ccc06d33.2e8e08","name":"","rules":[{"t":"set","p":"limit_persistent_relative","pt":"msg","to":"payload.METER.Total_in","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":565,"y":3945,"wires":[["ba61fd81b975e590","bf8bfbce35454587"]]},{"id":"dda63fc947bc4591","type":"debug","z":"ccc06d33.2e8e08","name":"payload.METER.Total_in","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"payload.METER.Total_in","targetType":"msg","statusVal":"limit_persistent_relative","statusType":"auto","x":550,"y":3870,"wires":[]}]

Let me know if this works for you, also as I mentioned earlier you could send this directly from Tasmota without using node-red if that's better for you.

..in which way is your tasmota device configured / how does it fetch the data from your Siemens Meter?

As said, we could go on without it, but need to think a little bit sideways...
Did you test with the split node, as I suggested?
The split node - when configured as shown - will split the JSON string into separate node-red messages. Each message will carry a message topic (msg.topic), which is the the Name of each object and a payload (msg.payload) which is the value of that named object.
The split node will only work for the first "layer" in that JSON string of nested objects it receives.
In your case it will produce two messages, first is with topic "Time" and the second is with topic "" (an empty string).

Yes, OK, you did understand.
Now from my example flow above...after the split node, there is a switch node.
The switch node will route each message based on msg.topic to a different endpoint.


The first, top endpoint "ENERGY" (in your case "" - in the tasmota example "DS18B20") will route that named object back to the split node, because this object contains another JSON object (again, next layer - hence splitting it again into separate messages with message topics, like "Temperature", .. in your case with the keys & values you desire, like "Total_in" and the rest from that JSON object level.
The example in my screenshot is from a tasmotized Smart plug, that also measures energy / power consumption.
...hope you'll get the picture.

Now, in order to go on, without changeing the tasmota JSON output (name of second object), we could try and seperate the message flow like this:

  • after the split node, put in a switch node that switches based on msg.topic.
  • only enter one element, named "Time" (the name of your first object - and hence the first message created after the split node). configure it like this:

    This switch will filter away that first message with the time object and will forward the second message with the empty Name/Topic via its second outlet.
  • After the switch node, add another split node and attach that to the second outlet of the first switch node.
  • you can now add a second switch node to seperate the different topics and values:

...add a change node and change the msg.topic to the desired mqqt topic (the "value" is still in msg.payload)...like this:


...you can then use an mqqt-out node to publish that msg to the desired topic. the mqqt-out node will fetch the topic and value from msg.topic and msg.payload....connect the mqqt-out node to the broker.

Alright. Thank you!!!

To all, as a newbie in this forum, I am somehow only allowed to post a couple of posting per day. So in case you do not see my reply, it could be that this is the reason or I am still testing the object based on your help.
Regards
Ed

Hi,

I am starting with your recomendation but will take a while to finish it and I am limited by the forum to reply.

Kind regards
Ed

OK, I see you made the change in the tasmota message. The second JSON object is named "Energy".now.
That simplifies things....you can create a flow, like I showed in my screenshot above: https://global.discourse-cdn.com/business6/uploads/nodered/optimized/3X/a/b/ab88e6e0992d208cd990757a06e8f2ea05f26d79_2_690x498.png
..where the Object named Energy" gets fed back into the first split node which will then create new messages with the names/topics that are inside "Energy", like "total_in".

...give that a try...you only need to create entries in the switch node for the key/names/topics that you are interested in (all others, like "Time", "I_L1" for example, will be discarded).

Hi Affenmenschen, thanks for your help. I did something different. Now I am at the end of my goal. The last chain missing is: how can I change the value of OpenDTU (solar/116183066760/cmd/limit_persistent_relative) in the last 3 option marked red in the pic?

Please find my Flow below:

[{"id":"053ff96b481a434e","type":"tab","label":"Flow 2","disabled":false,"info":"","env":},{"id":"37b9a3007cdefd67","type":"mqtt in","z":"053ff96b481a434e","name":"","topic":"tele/tasmota_7E4C70/SENSOR","qos":"2","datatype":"auto-detect","broker":"9f2a7abf6ca7fd13","nl":false,"rap":true,"rh":0,"inputs":0,"x":250,"y":140,"wires":[["1e45892227222a90"]]},{"id":"955c0bd27ff218a9","type":"debug","z":"053ff96b481a434e","name":"100%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.TD-3511.Total_in","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":300,"wires":},{"id":"1e45892227222a90","type":"switch","z":"053ff96b481a434e","name":"Topic ändern","property":"payload.TD-3511.Total_in","propertyType":"msg","rules":[{"t":"gte","v":"1.5","vt":"num"},{"t":"lte","v":"1.4","vt":"num"},{"t":"lte","v":"0.04","vt":"num"}],"checkall":"false","repair":false,"outputs":3,"x":330,"y":280,"wires":[["b06835116f8324e1","f4d43c5fafea64d9"],["86ba9df9364b7c9c","16809916dac023ed"],["eb6be770c77d6bc4"]]},{"id":"b06835116f8324e1","type":"debug","z":"053ff96b481a434e","name":"100%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.TD-3511.Total_in","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":60,"wires":},{"id":"86ba9df9364b7c9c","type":"debug","z":"053ff96b481a434e","name":"Prozentsatz","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.TD-3511.Total_in","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":140,"wires":},{"id":"16809916dac023ed","type":"calculator","z":"053ff96b481a434e","name":"Prozentsatz","inputMsgField":"payload.TD-3511.Total_in","outputMsgField":"solar/116183066768/cmd/limit_persistent_relative","operation":"mult","constant":"66.66666667","round":true,"decimals":"0","x":630,"y":380,"wires":[["e39615d7a4c38e12"]]},{"id":"f4d43c5fafea64d9","type":"change","z":"053ff96b481a434e","name":"Konstante 100%","rules":[{"t":"set","p":"solar/116183066768/cmd/limit_persistent_relative","pt":"msg","to":"100","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":300,"wires":[["955c0bd27ff218a9"]]},{"id":"e39615d7a4c38e12","type":"debug","z":"053ff96b481a434e","name":"99% - 3%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.TD-3511.Total_in","targetType":"msg","statusVal":"","statusType":"auto","x":980,"y":380,"wires":},{"id":"eb6be770c77d6bc4","type":"change","z":"053ff96b481a434e","name":"Konstante 2 %","rules":[{"t":"set","p":"solar/116183066768/cmd/limit_persistent_relative","pt":"msg","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":460,"wires":[["164b5b6582559e4e"]]},{"id":"164b5b6582559e4e","type":"debug","z":"053ff96b481a434e","name":"2%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.TD-3511.Total_in","targetType":"msg","statusVal":"","statusType":"auto","x":970,"y":460,"wires":},{"id":"9f2a7abf6ca7fd13","type":"mqtt-broker","name":"","broker":"192.168.178.66","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

I might not be able to respond to you due to posting time limitation from this forum.

Regards

Ed

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Give this a try

[{"id":"37b9a3007cdefd67","type":"mqtt in","z":"053ff96b481a434e","name":"","topic":"tele/tasmota_7E4C70/SENSOR","qos":"2","datatype":"auto-detect","broker":"9f2a7abf6ca7fd13","nl":false,"rap":true,"rh":0,"inputs":0,"x":250,"y":140,"wires":[["1e45892227222a90"]]},{"id":"955c0bd27ff218a9","type":"debug","z":"053ff96b481a434e","name":"100%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":285,"wires":[]},{"id":"1e45892227222a90","type":"switch","z":"053ff96b481a434e","name":"Topic ändern","property":"payload.TD3511.Total_in","propertyType":"msg","rules":[{"t":"gte","v":"1.5","vt":"num"},{"t":"lte","v":"1.4","vt":"num"},{"t":"lte","v":"0.04","vt":"num"}],"checkall":"false","repair":false,"outputs":3,"x":330,"y":280,"wires":[["b06835116f8324e1","f4d43c5fafea64d9"],["86ba9df9364b7c9c","16809916dac023ed"],["eb6be770c77d6bc4"]]},{"id":"b06835116f8324e1","type":"debug","z":"053ff96b481a434e","name":"100%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.TD-3511.Total_in","targetType":"msg","statusVal":"","statusType":"auto","x":650,"y":60,"wires":[]},{"id":"86ba9df9364b7c9c","type":"debug","z":"053ff96b481a434e","name":"Prozentsatz","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.TD-3511.Total_in","targetType":"msg","statusVal":"","statusType":"auto","x":810,"y":140,"wires":[]},{"id":"16809916dac023ed","type":"calculator","z":"053ff96b481a434e","name":"Prozentsatz","inputMsgField":"payload.TD-3511.Total_in","outputMsgField":"solar/116183066768/cmd/limit_persistent_relative","operation":"mult","constant":"66.66666667","round":true,"decimals":"0","x":630,"y":380,"wires":[["e39615d7a4c38e12","daa8d3405440ca3a"]]},{"id":"f4d43c5fafea64d9","type":"change","z":"053ff96b481a434e","name":"Konstante 100%","rules":[{"t":"set","p":"payload","pt":"msg","to":"100","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":300,"wires":[["955c0bd27ff218a9","daa8d3405440ca3a"]]},{"id":"e39615d7a4c38e12","type":"debug","z":"053ff96b481a434e","name":"99% - 3%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1035,"y":405,"wires":[]},{"id":"eb6be770c77d6bc4","type":"change","z":"053ff96b481a434e","name":"Konstante 2 %","rules":[{"t":"set","p":"payload","pt":"msg","to":"2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":460,"wires":[["164b5b6582559e4e","daa8d3405440ca3a"]]},{"id":"164b5b6582559e4e","type":"debug","z":"053ff96b481a434e","name":"2%","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":465,"wires":[]},{"id":"daa8d3405440ca3a","type":"mqtt out","z":"053ff96b481a434e","name":"","topic":"solar/116183066768/cmd/limit_persistent_relative","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"9f2a7abf6ca7fd13","x":1165,"y":345,"wires":[]},{"id":"9f2a7abf6ca7fd13","type":"mqtt-broker","name":"","broker":"192.168.178.66","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

Hi all,
many thanks for all of your assistance.
I finally manage to control the Hoymiles microinverter via Node Red and OpenDTU. The basic setup is there and I only need to take the time to read and to do more experiment.
Thanks to smcgann99!, Danke an Affenmenschen! and thanks to Collin.
I will answer to jbudd question asap.
Have a great summer time!!!
Regards
Ed

Hi all,

I marked this as solved.
Thank you:
@smcgann99, @hominidae and @Colin

Kind regards

Ed

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.