Shelly I4 button to action
Shelly I4 and I4dc have 4 input binary sensors with true or false state This flow register clicks and convert those to actions
Using mqtt rpc topic [button_name]/events/rpc to parse mqtt message It use button events node to click patterns https://flows.nodered.org/node/node-red-contrib-button-events
It has one input for mqtt in node, 4 outputs, one for each I4 binary sensor Each output have 4 state: clicked, double clicked, triple clicked and pressed
[{"id":"417ed508cf8538a4","type":"subflow","name":"Shelly I4","info":"","category":"","in":[{"x":60,"y":220,"wires":[{"id":"5a8e35321a082689"}]}],"out":[{"x":760,"y":80,"wires":[{"id":"c2991fdf334bc78f","port":3},{"id":"c2991fdf334bc78f","port":2},{"id":"c2991fdf334bc78f","port":1},{"id":"c2991fdf334bc78f","port":0}]},{"x":760,"y":180,"wires":[{"id":"7f7123c5939ead14","port":3},{"id":"7f7123c5939ead14","port":2},{"id":"7f7123c5939ead14","port":1},{"id":"7f7123c5939ead14","port":0}]},{"x":760,"y":280,"wires":[{"id":"191542cc5f6c8406","port":0},{"id":"191542cc5f6c8406","port":1},{"id":"191542cc5f6c8406","port":2},{"id":"191542cc5f6c8406","port":3}]},{"x":760,"y":380,"wires":[{"id":"5f5b417858c495ec","port":0},{"id":"5f5b417858c495ec","port":1},{"id":"5f5b417858c495ec","port":2},{"id":"5f5b417858c495ec","port":3}]}],"env":[],"meta":{},"color":"#DDAA99"},{"id":"c2991fdf334bc78f","type":"button-events","z":"417ed508cf8538a4","name":"","outputs":4,"inputField":"payload","inputFieldType":"msg","outputField":"payload","outputFieldType":"msg","downValue":"true","downValueType":"bool","upValue":"false","upValueType":"bool","idleValue":"1","buttonEventsConfig":"2b5f554fba088ec9","clickedInterval":null,"pressedInterval":null,"debounceInterval":null,"events":[{"type":"clicked"},{"type":"double_clicked"},{"type":"triple_clicked"},{"type":"pressed"}],"x":600,"y":80,"wires":[[],[],[],[]]},{"id":"5a8e35321a082689","type":"switch","z":"417ed508cf8538a4","name":"button","property":"payload.params","propertyType":"msg","rules":[{"t":"hask","v":"input:0","vt":"str"},{"t":"hask","v":"input:1","vt":"str"},{"t":"hask","v":"input:2","vt":"str"},{"t":"hask","v":"input:3","vt":"str"}],"checkall":"false","repair":false,"outputs":4,"x":190,"y":220,"wires":[["9c8a8aa9ea574125"],["3a42bb71265f34bf"],["f8b1bd70338f73cc"],["40ca29a9d69c1764"]]},{"id":"9c8a8aa9ea574125","type":"change","z":"417ed508cf8538a4","name":"to payload","rules":[{"t":"move","p":"payload.params[\"input:0\"].state","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":140,"wires":[["c2991fdf334bc78f"]]},{"id":"3a42bb71265f34bf","type":"change","z":"417ed508cf8538a4","name":"to payload","rules":[{"t":"move","p":"payload.params[\"input:1\"].state","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":200,"wires":[["7f7123c5939ead14"]]},{"id":"f8b1bd70338f73cc","type":"change","z":"417ed508cf8538a4","name":"to payload","rules":[{"t":"move","p":"payload.params[\"input:2\"].state","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":260,"wires":[["191542cc5f6c8406"]]},{"id":"40ca29a9d69c1764","type":"change","z":"417ed508cf8538a4","name":"to payload","rules":[{"t":"move","p":"payload.params[\"input:3\"].state","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":320,"wires":[["5f5b417858c495ec"]]},{"id":"7f7123c5939ead14","type":"button-events","z":"417ed508cf8538a4","name":"","outputs":4,"inputField":"payload","inputFieldType":"msg","outputField":"payload","outputFieldType":"msg","downValue":"true","downValueType":"bool","upValue":"false","upValueType":"bool","idleValue":"1","buttonEventsConfig":"2b5f554fba088ec9","clickedInterval":null,"pressedInterval":null,"debounceInterval":null,"events":[{"type":"clicked"},{"type":"double_clicked"},{"type":"triple_clicked"},{"type":"pressed"}],"x":600,"y":180,"wires":[[],[],[],[]]},{"id":"191542cc5f6c8406","type":"button-events","z":"417ed508cf8538a4","name":"","outputs":4,"inputField":"payload","inputFieldType":"msg","outputField":"payload","outputFieldType":"msg","downValue":"true","downValueType":"bool","upValue":"false","upValueType":"bool","idleValue":"1","buttonEventsConfig":"2b5f554fba088ec9","clickedInterval":null,"pressedInterval":null,"debounceInterval":null,"events":[{"type":"clicked"},{"type":"double_clicked"},{"type":"triple_clicked"},{"type":"pressed"}],"x":600,"y":280,"wires":[[],[],[],[]]},{"id":"5f5b417858c495ec","type":"button-events","z":"417ed508cf8538a4","name":"","outputs":4,"inputField":"payload","inputFieldType":"msg","outputField":"payload","outputFieldType":"msg","downValue":"true","downValueType":"bool","upValue":"false","upValueType":"bool","idleValue":"1","buttonEventsConfig":"2b5f554fba088ec9","clickedInterval":null,"pressedInterval":null,"debounceInterval":null,"events":[{"type":"clicked"},{"type":"double_clicked"},{"type":"triple_clicked"},{"type":"pressed"}],"x":600,"y":380,"wires":[[],[],[],[]]},{"id":"2b5f554fba088ec9","type":"button-events-config","name":"ShellyI4","clickedInterval":"200","pressedInterval":"750","debounceInterval":"15"},{"id":"90d8df9c9a3fc061","type":"subflow:417ed508cf8538a4","z":"7b5181d316e352b6","name":"","x":300,"y":640,"wires":[["467f9714207294be"],["9b423319128337e2"],["e03812bce8c54c35"],["2da03622d20857f7"]],"inputLabels":["mqtt in"],"outputLabels":["Btn 1","Btn 2","Btn 3","Btn 4"],"icon":"node-red-contrib-shelly/shelly.png"}]