You can use switch node, connect input from what ever mqtt device - I have a shelly button1 giving commands
Button1 can give 4(5) type of commands - those are S, SS, SSS and L which are single, double, triple and long push. Fifth type of command is blank and that's the one what we want to filter
Create a switch node with 5 output, one for each command. Then wire output in a way how you like
Entire flow is over complicated to perform simple tasks. I'm trying to keep my flows tidy:
Button1 send command.
Short push toggle lights.
Double push toggle between 20% and 70% dimming
Triple push reboot shelly (just in case) loop to toggle light after 10sec
Long push set 100% brightness
Empty message is not connected
MQTT is used to read and send commands. node-red-contrib-shelly palette is used to read dimmer current status and function node to parse status and toggle command depending of current state
pasted-from-clipboard.png
full flow json is available from pastebin
you need to modify device names & IP's
Switch node:
[
{
"id": "632f6fe805837237",
"type": "switch",
"z": "ef25cf265c7ab0f7",
"name": "msg",
"property": "payload.event",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "S",
"vt": "str"
},
{
"t": "eq",
"v": "SS",
"vt": "str"
},
{
"t": "eq",
"v": "SSS",
"vt": "str"
},
{
"t": "eq",
"v": "L",
"vt": "str"
},
{
"t": "eq",
"v": "",
"vt": "str"
}
],
"checkall": "false",
"repair": false,
"outputs": 5,
"x": 310,
"y": 240,
"wires": [
[
"89c6775b087c8abf"
],
[
"77bd7dcb155c0615"
],
[
"9fba0aad21971c9e"
],
[
"61ca88fca7d9a1f0"
],
[]
]
}
]
Alles anzeigen