This shell script is unknown for me. I never wrote it and did not see it before.
This command is executed on my router with a direct connection to the Internet and that is a different machine than where Domoticz, Node RED and Mosquitto runs on.
It pipes the command into mosquitto_pub and so it publishes the data to the MQTT Server.
Node RED does the translation to Domoticz. Do not forget to install mosquitto-clients.
Code: Select all
[{"id":"71ee0102.5abb38","type":"tab","label":"Speedtest","disabled":false,"info":""},{"id":"80d3d6f7.287248","type":"mqtt in","z":"71ee0102.5abb38","name":"Server Speedtest In","topic":"speedtest/status","qos":"0","datatype":"json","broker":"f8a872af.a6898","inputs":0,"x":190,"y":100,"wires":[["f99521a7.91a89"]]},{"id":"f99521a7.91a89","type":"function","z":"71ee0102.5abb38","name":"To Domoticz","func":"var msg1 ={};\nvar msg2 ={};\nvar msg3 ={};\nvar msg4 ={};\nvar msg5 ={};\nmsg1.payload = {\"command\":\"udevice\",\"idx\":119,\"nvalue\":0,\"svalue\":msg.payload.ping.latency.toString()};\nmsg2.payload = {\"command\":\"udevice\",\"idx\":120,\"nvalue\":0,\"svalue\":(parseFloat((msg.payload.download.bytes*8/msg.payload.download.elapsed)/1000).toFixed(3)).toString()};\nmsg3.payload = {\"command\":\"udevice\",\"idx\":121,\"nvalue\":0,\"svalue\":(parseFloat((msg.payload.upload.bytes*8/msg.payload.upload.elapsed)/1000).toFixed(3)).toString()};\nmsg4.payload = {\"command\":\"udevice\",\"idx\":402,\"nvalue\":0,\"svalue\":msg.payload.ping.jitter.toString()};\nmsg5.payload = {\"command\":\"udevice\",\"idx\":403,\"nvalue\":0,\"svalue\":msg.payload.packetLoss.toString()};\nreturn [[msg1,msg2,msg3,msg4,msg5]];","outputs":1,"noerr":0,"x":410,"y":100,"wires":[["64834ac6.75a034"]]},{"id":"64834ac6.75a034","type":"mqtt out","z":"71ee0102.5abb38","name":"Domoticz In","topic":"domoticz/in","qos":"2","retain":"false","broker":"f8a872af.a6898","x":610,"y":100,"wires":[]},{"id":"b47c88ca.5804d","type":"mqtt in","z":"71ee0102.5abb38","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"f8a872af.a6898","inputs":0,"x":170,"y":220,"wires":[["6f6b8107.956448"]]},{"id":"6f6b8107.956448","type":"filter","z":"71ee0102.5abb38","name":"Filter Button","property":"payload.idx","propertyType":"msg","asArray":false,"itemProperty":"","itemPropertyType":"item","rules":[{"t":"eq","v":"122","vt":"num","output":1}],"checkall":"true","outputs":1,"x":370,"y":220,"wires":[["965aceab.7ea108"]]},{"id":"965aceab.7ea108","type":"function","z":"71ee0102.5abb38","name":"To Speedtest","func":"if (msg.payload.nvalue === 1) {\n msg.payload = \"on\";\n}\nreturn msg;","outputs":1,"noerr":0,"x":570,"y":220,"wires":[["93d16ba1.e71948"]]},{"id":"93d16ba1.e71948","type":"mqtt out","z":"71ee0102.5abb38","name":"Server Speedtest Out","topic":"speedtest/cmd","qos":"0","retain":"false","broker":"f8a872af.a6898","x":800,"y":220,"wires":[]},{"id":"d6399787.e39ee","type":"inject","z":"71ee0102.5abb38","name":"Hourly Speedtest ","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":550,"y":160,"wires":[["93d16ba1.e71948"]]},{"id":"f8a872af.a6898","type":"mqtt-broker","name":"Jonas_MQTT_Server","broker":"192.168.10.24","port":"1883","clientid":"","usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""}]
One remark.
If you run speedtest, domoticz and Node RED on the same device, you can also use an "Exec" node.
Even a dedicated speedtest node exists. See: