Shelly integration via MQTT/Node-RED

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

hoeby
Posts: 531
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Shelly integration via MQTT/Node-RED

Post by hoeby »

I would like to share this flow.
It is completly different than what is made by Krisha, it is made only for the Shelly 2.5 in shutter mode, not for other shelly devices.
It is very basic and made for one shelly 2.5. If you have multi devices, then you need to modify the flow or multiply the flow.

This doesn't work with activating the relays like Krisha's flow does, but the position of the shutter. To get this done, your shelly has to be calibrated. This is found in the shelly webpage of your device. If all is right, you already did this step, to get the shelly working right.

What does the flow:
- When the shutter is moved, when controlled by switch. When finished controlling the position value is send to you domoticz dummy.
- When the shutter is moved, when controlled by domoticz, the position is send to your shelly

Instruction what to change, to get the flow working for your devices, read the instructions in the flow.
I made the flow where the mqtt broker is on the same device as domoticz. Otherwise you need to modify this in de flow.

Code: Select all

[{"id":"9c85c23.38ee24","type":"tab","label":"Shelly25 test flow","disabled":false,"info":""},{"id":"5166d92c.1b0f88","type":"mqtt in","z":"9c85c23.38ee24","name":"","topic":"shellies/shellyswitch25-68C63AF90E/roller/0/pos","qos":"2","datatype":"auto","broker":"99f3bb82.8e22b8","x":300,"y":160,"wires":[["67fa9d62.bffda4"]]},{"id":"67fa9d62.bffda4","type":"json","z":"9c85c23.38ee24","name":"","property":"payload","action":"","pretty":false,"x":590,"y":160,"wires":[["b7a2a86d.c3f358"]]},{"id":"b7a2a86d.c3f358","type":"function","z":"9c85c23.38ee24","name":"Prepare To Domoticz","func":"msg.payload = {\"command\":\"switchlight\",\"idx\":69,\"switchcmd\":\"Set Level\",\"level\":msg.payload}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":160,"wires":[["62862e65.23004"]]},{"id":"62862e65.23004","type":"mqtt out","z":"9c85c23.38ee24","name":"Domoticz In","topic":"domoticz/in","qos":"","retain":"","broker":"4e08fff2.0c345","x":990,"y":160,"wires":[]},{"id":"e272b9f3.395818","type":"comment","z":"9c85c23.38ee24","name":"Instructions, what to change!","info":"What to do:\n1) - Double click on \"Shellies/shellyswitch25.........\n2) - Change the code \"68C63AF90E\" to the code from your shelly 2.5 and click \"Done\"\n3) - Double click on \"Prepare to Domoticz\"\n4) - Change the number of IDX to the dummy device which you made in domoticz (blinds percentage), and click \"Done\".\n5) - Double click on \"Filter Shutter Switch\"\n6) - Change after the == to the IDX number of the domoticz dummy device and click \"Done\"\n7) - Double click on \"Prepare Shelly\", change the code \"68C63AF90E\" to the code frlom your shelly 2.5 and click \"Done\"\n8) - Deploy the flow","x":390,"y":60,"wires":[]},{"id":"35a088ff.929e88","type":"mqtt in","z":"9c85c23.38ee24","name":"Domoticz Out","topic":"domoticz/out","qos":"2","datatype":"json","broker":"4e08fff2.0c345","x":190,"y":300,"wires":[["cfd220cc.b76e"]]},{"id":"cfd220cc.b76e","type":"switch","z":"9c85c23.38ee24","name":"Filter Shutter Switch","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"69","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":300,"wires":[["beb86089.d6b3"]]},{"id":"beb86089.d6b3","type":"function","z":"9c85c23.38ee24","name":"Prepare Shelly","func":"msg.topic = \"shellies/shellyswitch25-68C63AF90E/roller/0/command/pos\";\nmsg.payload = msg.payload.svalue1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":680,"y":300,"wires":[["ea0ae9ed.0a9828"]]},{"id":"ea0ae9ed.0a9828","type":"mqtt out","z":"9c85c23.38ee24","name":"Shelly In","topic":"","qos":"","retain":"","broker":"4e08fff2.0c345","x":880,"y":300,"wires":[]},{"id":"99f3bb82.8e22b8","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4e08fff2.0c345","type":"mqtt-broker","z":"","name":"","broker":"127.0.0.1","port":"1883","clientid":"","usetls":false,"verifyservercert":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest