SML 1.04 ir adapter for DTZ-541 Stromzaehler

Moderator: leecollings

sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

I'm trying to get data from usb ir-connector connected via usb with my RPi. I tried P1 smartmeter without success. In iobroker wich I installed for testing it is running with a smartmeter app. I get datas eg. momentary current/overall current. Does domoticz have a plugin to handle smart massage language SML 1.04.
User avatar
FireWizard
Posts: 1902
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by FireWizard »

Hello @ sailmich,

You might want to look at Node-RED. You can load the module: https://flows.nodered.org/node/node-red ... smartmeter
This smart-meter module is based on library: https://github.com/Apollon77/smartmeter-obis

If you read its README file you will see:
Supported Protocols:

SmlProtocol: SML (SmartMeterLanguage) as binary format
D0Protocol: D0 (based on IEC 62056-21:2002/IEC 61107/EN 61107) as ASCII format (binary protocol mode E not supported currently)
JsonEfrProtocol: OBIS data from EFR Smart Grid Hub (JSON format)
Try, if you can collect the data from your device in Node-RED. If so, it's quite easy to send the data to a virtual device in Domoticz by means of MQTT.

Regards
User avatar
waltervl
Posts: 5860
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by waltervl »

Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5860
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by waltervl »

See also https://domoticz.com/forum/viewtopic.ph ... 26#p285326 for a user who has solution with Tasmota- MQTT
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

Thx for your answers! Thought it would be easier. Got some homework from your posts and will check it. I will let you know which way I decided or when I have questions.
User avatar
waltervl
Posts: 5860
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by waltervl »

It should not be that hard. Can you read already the energy values with a bash or python script on your Pi?
Because then you could extend that script with the push to Domoticz.

Can you give an example what you can read?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

ir reader on my energy main counter connected with usb to Rpi iobroker. With mqtt on my domoticz server I subscribe to topic Gesamtverbrauch and Momentanverbrauch on my iobroker client. In a terminal with mosquitto I get
Screenshot 2022-02-09 094055.png
Screenshot 2022-02-09 094055.png (5.3 KiB) Viewed 2320 times
Screenshot 2022-02-09 093724.png
Screenshot 2022-02-09 093724.png (5.6 KiB) Viewed 2320 times
Node red flow in this case for Momentanverbrauch. Momentanverbrauch Unit is Watt.
Spoiler: show
[{"id":"01d2b81be215d539","type":"tab","label":"iobrokerZuDomoticz","disabled":false,"info":"","env":[]},{"id":"f7b83dee25255d6e","type":"mqtt in","z":"01d2b81be215d539","name":"Strom aktuell","topic":"Momentanverbrauch","qos":"1","datatype":"auto","broker":"f9f13036.e28b58","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":100,"wires":[["bd592749fb63b759"]]},{"id":"bd592749fb63b759","type":"function","z":"01d2b81be215d539","name":"","func":"msg1 = {};\nmsg1.payload = {\"command\":\"udevice\",\"idx\":485,\"nvalue\":0,\"svalue\":msg.payload.Momentanverbrauch};\nreturn [[msg1]];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":100,"wires":[["9a141a683afd66ac"]]},{"id":"9a141a683afd66ac","type":"mqtt out","z":"01d2b81be215d539","name":"domoticz/in","topic":"domoticz/in","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":530,"y":100,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
My virtual device for power usage shows always zero but last seen change always.
User avatar
FireWizard
Posts: 1902
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by FireWizard »

Hello @sailmich

I do not know what the format is of your received message. I tested it with a simple value (in this case 597), represented as a string.
If you can connect a debug node after the MQTT input node (as shown on the picture below), I can check your function node.

Screenshot_power_NR1.png
Screenshot_power_NR1.png (21.66 KiB) Viewed 2310 times

I injected a string value (597) to your topic Momentanverbrauch and this is received by your MQTT input node.

Screenshot_power_NR2.png
Screenshot_power_NR2.png (35.51 KiB) Viewed 2310 times

You can see that on the first received message. On the second message you see the result of the output of your function node.
The svalue is undefined and that results in that the Domoticz virtual sensor is not updated.
But as said earlier, I'm not sure that the injected message is correct.

I modified your function node into:

Code: Select all

msg.payload = { "command": "udevice", "idx": 485, "nvalue": 0, "svalue": msg.payload };
return msg;
Your declaration of a new variable (msg1) is not necessary, as there exist only 1 message for the output.
The result you will see in the last message of the picture above,

Complete flow, you will find below:

Code: Select all

[{"id":"f6c7807cab872308","type":"tab","label":"iobrokerZuDomoticz","disabled":false,"info":"","env":[]},{"id":"1ed653afb7e5303b","type":"mqtt in","z":"f6c7807cab872308","name":"Strom aktuell","topic":"Momentanverbrauch","qos":"1","datatype":"auto","broker":"f9f13036.e28b58","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":100,"wires":[["c3accf01d66fafc7","29aadd3461791c27"]]},{"id":"c3accf01d66fafc7","type":"function","z":"f6c7807cab872308","name":"","func":"msg.payload = { \"command\": \"udevice\", \"idx\": 485, \"nvalue\": 0, \"svalue\": msg.payload };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":100,"wires":[["c3ef3855cd5673a9"]]},{"id":"3ec6e831b9bc19ac","type":"mqtt out","z":"f6c7807cab872308","name":"domoticz/in","topic":"domoticz/in","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":570,"y":100,"wires":[]},{"id":"c3ef3855cd5673a9","type":"debug","z":"f6c7807cab872308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":570,"y":60,"wires":[]},{"id":"29aadd3461791c27","type":"debug","z":"f6c7807cab872308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":390,"y":160,"wires":[]},{"id":"4bf2a1da2b1f3171","type":"mqtt out","z":"f6c7807cab872308","name":"MQTT Out","topic":"Momentanverbrauch","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":390,"y":260,"wires":[]},{"id":"81dba57675f8969b","type":"inject","z":"f6c7807cab872308","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"597","payloadType":"str","x":210,"y":260,"wires":[["4bf2a1da2b1f3171"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
Let me know.

Regards
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

@FireWizard, I just took your modified function node and get the correct instant Watt into my domoticz device!
Your declaration of a new variable (msg1) is not necessary, as there exist only 1 message for the output.
The result you will see in the last message of the picture above,
I did that because later I would like to get booth values into Electricity (instant/counter) dummy device.
But I assume it wouldn't work the way I choose. I have to get booth values into my function node to modify the dummy devices
msg.payload = { "command": "udevice", "idx": 484, "nvalue": 0, "svalue":POWER;ENERGY };
How can I bring two topics Gesamtverbrauch = Energy and Momentanverbrauch Power into a function node?
User avatar
FireWizard
Posts: 1902
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by FireWizard »

Hello @sailmich,

You said:
Your declaration of a new variable (msg1) is not necessary, as there exist only 1 message for the output.
The result you will see in the last message of the picture above.
I did that because later I would like to get booth values into Electricity (instant/counter) dummy device.
Also, if you want to send 2 or more values to the same virtual sensor, you do not need multiple msg definitions.
You only need that, in case you want to send from the same Function node multiple messages, either to the same output or to different outputs,
Multiple messages are needed in case of multiple virtual sensors. This is not the case.

You want:
I would like to get booth values into Electricity (instant/counter) dummy device.
msg.payload = { "command": "udevice", "idx": 484, "nvalue": 0, "svalue":POWER;ENERGY };
This is correct.
How can I bring two topics Gesamtverbrauch = Energy and Momentanverbrauch Power into a function node?
I assume that these two values are not in the same message but in two different messages with the topics Momentanverbrauch and Gesamtverbrauch.

Therefore for simulation I created 1 Inject nodes (See picture)

In order to combine these 2 messages, you have to use a "Join" node. I use the msg.topic as the key/value pair. As soon as the "Join" node has received two messages it will send to the output.

See the picture below:

Screenshot_power_NR3.png
Screenshot_power_NR3.png (35.03 KiB) Viewed 2294 times

The picture is self-explanatory.

The contents of the Function node is now as follows:

Code: Select all

msg.payload = { "command": "udevice", "idx": 485, "nvalue": 0, "svalue": msg.payload.Momentanverbrauch + ";" + (msg.payload.Gesamtverbrauch) * 1000 };
return msg;
Remarks!

1. The semicolon is part of the string and so should be concatenated and between " ".
2. Domoticz expert the Energy in Wh, If you send the data in kWH (what I assumed), you have to multiply with 1000.

See the result below:

Screenshot_power_NR4.png
Screenshot_power_NR4.png (24.26 KiB) Viewed 2294 times
The complete flow below:

Code: Select all

[{"id":"f6c7807cab872308","type":"tab","label":"iobrokerZuDomoticz","disabled":false,"info":"","env":[]},{"id":"1ed653afb7e5303b","type":"mqtt in","z":"f6c7807cab872308","name":"Strom aktuell","topic":"Momentanverbrauch","qos":"1","datatype":"auto","broker":"f9f13036.e28b58","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":100,"wires":[["559fb68b706cd711"]]},{"id":"c3accf01d66fafc7","type":"function","z":"f6c7807cab872308","name":"","func":"msg.payload = { \"command\": \"udevice\", \"idx\": 485, \"nvalue\": 0, \"svalue\": msg.payload.Momentanverbrauch + \";\" + (msg.payload.Gesamtverbrauch) * 1000 };\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":140,"wires":[["c3ef3855cd5673a9"]]},{"id":"3ec6e831b9bc19ac","type":"mqtt out","z":"f6c7807cab872308","name":"domoticz/in","topic":"domoticz/in","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":770,"y":140,"wires":[]},{"id":"c3ef3855cd5673a9","type":"debug","z":"f6c7807cab872308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":60,"wires":[]},{"id":"29aadd3461791c27","type":"debug","z":"f6c7807cab872308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":60,"wires":[]},{"id":"4bf2a1da2b1f3171","type":"mqtt out","z":"f6c7807cab872308","name":"MQTT Out","topic":"Momentanverbrauch","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":390,"y":260,"wires":[]},{"id":"81dba57675f8969b","type":"inject","z":"f6c7807cab872308","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"597","payloadType":"str","x":210,"y":260,"wires":[["4bf2a1da2b1f3171"]]},{"id":"6d3e0f9c584d476f","type":"mqtt in","z":"f6c7807cab872308","name":"Strom gesamt","topic":"Gesamtverbrauch","qos":"1","datatype":"auto","broker":"f9f13036.e28b58","nl":false,"rap":true,"rh":0,"inputs":0,"x":190,"y":180,"wires":[["559fb68b706cd711"]]},{"id":"b7531d04bc3918e8","type":"mqtt out","z":"f6c7807cab872308","name":"MQTT Out","topic":"Gesamtverbrauch","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"f9f13036.e28b58","x":390,"y":340,"wires":[]},{"id":"558e23349b261fdb","type":"inject","z":"f6c7807cab872308","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"11313.0046","payloadType":"str","x":210,"y":340,"wires":[["b7531d04bc3918e8"]]},{"id":"559fb68b706cd711","type":"join","z":"f6c7807cab872308","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":370,"y":140,"wires":[["29aadd3461791c27","c3accf01d66fafc7"]]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
Let me know, if this is what you want.

Regards
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

Hello FireWizard, fantastic! But I'm to leazy to read the documentation of domoticz json/api :( . Electricity (Instant/Counter) energy is todays consumption and not the total of my counter. I don't get a daily from my ir reader so I have to stay with first your flow and set counter to energy read: computed. The other value Gesamtverbrauch I will sent to /json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=COUNTER;USAGE;DATE. Because this value is not interesting to see it in real time I would like to update eg. every day at 23:00. Can I use inject for that?
Thanks a lot for your time and help!
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

No, I can't. I must dig deeper into node red. I found some timer but so far can't get it working.
User avatar
waltervl
Posts: 5860
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by waltervl »

Just to check:
Gesamtverbrauch seems to be the correct value for ENERGY, perhaps needs a 1000 multiplier as it needs (as already explained by Firewizard) Wh values.
If you get Momentanverbrauch (= POWER) and no Gesamtverbrauch perhaps it is possible to use the last sent Gesamtverbrauch or ENERGY value if Node-Red is able to remember that.
The best value you get if Gesamtverbrauch is used.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
FireWizard
Posts: 1902
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by FireWizard »

@sailmich

You asked:
Can I use inject for that?
Yes you can.
I found some timer but so far can't get it working.
See below an example flow.

I use the following timer: node-red-contrib-moment.

I used it to convert the epoch time to the by Domoticz expected date/time.

See the example flow below:

Screenshot_power_NR5.png
Screenshot_power_NR5.png (25.98 KiB) Viewed 2278 times

You can see the 3 debug messages below:

Screenshot_power_NR6.png
Screenshot_power_NR6.png (25.28 KiB) Viewed 2278 times

Some Remarks

1. I used as IP address 127.0.0.1 (localhost). If your Domoticz has a different address than your Node-RED you will have to change that.
2. Check also the Join node, Compared to my previous post I unticked "and every subsequent message." This means that the Join node has to receive the value AND the data/time. I joined these two messages into 1 and prepared the URL.

See below the complete flow:

Code: Select all

[{"id":"7ff754e7b87b4a38","type":"mqtt in","z":"f6c7807cab872308","name":"Strom gesamt","topic":"Gesamtverbrauch","qos":"1","datatype":"auto","broker":"f9f13036.e28b58","nl":false,"rap":true,"rh":0,"inputs":0,"x":170,"y":500,"wires":[["587c60e05ae3cba3"]]},{"id":"fe21907678de1d0b","type":"inject","z":"f6c7807cab872308","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":170,"y":560,"wires":[["d3e527a6c51a2444"]]},{"id":"d3e527a6c51a2444","type":"moment","z":"f6c7807cab872308","name":"","topic":"date","input":"payload","inputType":"msg","inTz":"Europe/Berlin","adjAmount":0,"adjType":"days","adjDir":"add","format":"DD-MM-YYYY HH:mm:ss","locale":"en-US","output":"payload","outputType":"msg","outTz":"Europe/Berlin","x":350,"y":560,"wires":[["4219702fa390e412","587c60e05ae3cba3"]]},{"id":"587c60e05ae3cba3","type":"join","z":"f6c7807cab872308","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":510,"y":560,"wires":[["4da225a51d28ea0b","0419446fe4174f9d"]]},{"id":"4da225a51d28ea0b","type":"function","z":"f6c7807cab872308","name":"Function","func":"var url = \"http://127.0.0.1:8080\";\n\nmsg.url = url + \"/json.htm?type=command&param=udevice&idx=486&nvalue=0&svalue=-1;\" + (msg.payload.Gesamtverbrauch) * 1000 + \";\" + msg.payload.date;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":560,"wires":[["3bb0a27c5d28dd28"]]},{"id":"7ce36d0df94c73e2","type":"http request","z":"f6c7807cab872308","name":"HTTP","method":"PUT","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":890,"y":560,"wires":[[]]},{"id":"3bb0a27c5d28dd28","type":"debug","z":"f6c7807cab872308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"url","targetType":"msg","statusVal":"","statusType":"auto","x":900,"y":500,"wires":[]},{"id":"0419446fe4174f9d","type":"debug","z":"f6c7807cab872308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":500,"wires":[]},{"id":"4219702fa390e412","type":"debug","z":"f6c7807cab872308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":620,"wires":[]},{"id":"f9f13036.e28b58","type":"mqtt-broker","name":"localhost","broker":"127.0.0.1","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
Let me know the result, as it is untested.

Regards
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

Hello FireWizard,
your code work but the device 486 would not updated. Node red and domoticz are on the same RPi. I tried it also with complete url. I tried it also in firefox with no succeed.
Screenshot 2022-02-10 205314.png
Screenshot 2022-02-10 205314.png (6.58 KiB) Viewed 2264 times
Spoiler: show
msg.url = url + "/json.htm?type=command&param=udevice&idx=486&nvalue=0&svalue= -1;" + (msg.payload.Gesamtverbrauch) * 1000;
I removed the date. Same result in node red the device 486 would not updated. But in firefox with url the device would updated?
Screenshot 2022-02-10 211239.png
Screenshot 2022-02-10 211239.png (10.82 KiB) Viewed 2264 times
Any idea?
User avatar
FireWizard
Posts: 1902
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by FireWizard »

Hello @sailmich

From the Wiki:
To insert data in history log:

/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=COUNTER;USAGE;DATE

IDX = id of your device (This number can be found in the devices tab in the column "IDX")
COUNTER = total cumulative counter energy (Wh, can be set to -1 if unknown or unused, in that case it won't show on dashboard or in logs)
USAGE = energy usage in Watt-hours (Wh)
DATE = date with %Y-%m-%d format (for instance 2019-09-24) to put data in last week/month/year history log, or "%Y-%m-%d %H:%M:%S" format (for instance 2019-10-03 14:00:00) to put data in last days history log
Could this be caused by Counter = -1?
Try it with a positive value. I used 486 just as an example IDX. Replace it with yours.

Regards
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

Screenshot 2022-02-10 214518.png
Screenshot 2022-02-10 214518.png (13.43 KiB) Viewed 2259 times
Screenshot 2022-02-10 214442.png
Screenshot 2022-02-10 214442.png (18.55 KiB) Viewed 2259 times
I tried it with 1 instead of -1 with same result. It shows Update Device but in fact it doesen't change!
Screenshot 2022-02-10 214402.png
Screenshot 2022-02-10 214402.png (4.99 KiB) Viewed 2259 times
There is a problem when using date but also
why it doesen't work without date from node red but change when using a browser?
User avatar
FireWizard
Posts: 1902
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by FireWizard »

Hello @sailmich

I do not use HTTP very often. Mostly I use MQTT.
However this seems to work properly.

The managed counter, I never used.
I tried it with 1 instead of -1 with same result. It shows Update Device but in fact it doesn't change!
You may want to look carefully to the WIKI and perhaps others can tell you more about the managed counter.
There is a problem when using date but also
why it doesn't work without date from node red but change when using a browser?
What do you exactly send with your browser?

Regards
User avatar
waltervl
Posts: 5860
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by waltervl »

I would not use the managed counter as it has no history. You will have to manage that yourself with scripts.
Better use the Electric (instant and counter) device.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
sailmich
Posts: 245
Joined: Wednesday 17 February 2016 22:55
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Germany
Contact:

Re: SML 1.04 ir adapter for DTZ-541 Stromzaehler

Post by sailmich »

@waltervl according to domoticz api/json in wiki, the syntax which is sending from node red flow is right. I assume this command is changing the data of Energy but at least it should insert data in history log. When I tic the log of the button there is nothing in.
@FireWizard just copy and paste of the string I get from your flow but instead of localhost I use 192.xxx.xxx.xx. The json without date change value with date no changes.
I might change to Electric as waltervl said.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest