Hello @Daro1003,
I have considered, what would be the best approach in creating a flow for the Shelly blinds control.
It is important that you have a simple setup and that it also gives you easy software maintenance.
a few things, we have discovered, so far.
In Domoticz , with the theme, you use (Machinon), the Blinds Percentage and STOP button does not work.
With the default theme, it works. but it does not look so nice, as the slider is too long.
So we will use in Domoticz a Swith of type Blinds Percentage.
In order to avoid interference with the default Shelly web browser, we will not take the contrib nodes in Node-RED, but we will take the default MQTT nodes.
We can not avoid, that you have to configure a few things.
1. For each MQTT node (both MQTT Input and MQTT Output), you have to insert your own configuration.
As your Domoticz and your Mosquitto runs on the same hardware, it is the same IP address 192.168.0.40.
2. As their exist an exclusive relationship between the (virtual) Domoticz switch of type "Blinds Percentage) and you Shelly Device, we have to configure that as well. I made the choice to do that in one specific node and not that all those things are scattered over different nodes in the flow.
For this purpose a contrib node exist, but I decided to do it with the default installed nodes.
In this case an "Inject and a Change node.

- Screenshot_Inject Change.png (7.79 KiB) Viewed 1199 times
The "Inject"node functions as a trigger only and will store the so called flow variable, after the start of the node.
It is configured as follows:

- Screenshot_Change_Config.png (19.83 KiB) Viewed 1199 times
The first value you have to insert the characters IDX follo0wd by your Domotiocz idx number.
(I think I did it already for you, but the next switch, you have to do it yourself.
The second value is the Shelly client ID, as shown in your post April 12 2025, 21:40h.
The other 2 streams represent the communication between Domoticz and the Shelly.
The other, the communication between the Shelly and Domoticz, if you use e.g. a physical switch or the web browser.
See the 3 flows below and copy each of the in the same Node RED tab.
All the other stuff you may delete or archive.
Flow 1.
Code: Select all
[
{
"id": "6d6b37aa224c0267",
"type": "change",
"z": "f55ebfe97fab5883",
"name": "Set Domoticz IDX ",
"rules": [
{
"t": "set",
"p": "IDX1060",
"pt": "flow",
"to": "shelly2pmg3-34cdb0774d4c",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 1640,
"wires": [
[]
]
},
{
"id": "72d05de408241efe",
"type": "inject",
"z": "f55ebfe97fab5883",
"name": "Inject Domoticz IDX",
"props": [],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 260,
"y": 1640,
"wires": [
[
"6d6b37aa224c0267"
]
]
}
]
Flow 2:
Code: Select all
[
{
"id": "5f6a604495a17c3b",
"type": "mqtt in",
"z": "f55ebfe97fab5883",
"name": "Domoticz Out",
"topic": "domoticz/out",
"qos": "2",
"datatype": "auto-detect",
"broker": "38b35487299a036d",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 270,
"y": 1560,
"wires": [
[
"f066f8205567a5a7"
]
]
},
{
"id": "f066f8205567a5a7",
"type": "switch",
"z": "f55ebfe97fab5883",
"name": "Filter Switch Type",
"property": "payload.switchType",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "Blinds Percentage",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 510,
"y": 1560,
"wires": [
[
"3940013d84a6f7bf",
"b9a4f7de1b6e13a5"
]
]
},
{
"id": "3940013d84a6f7bf",
"type": "function",
"z": "f55ebfe97fab5883",
"name": "Blinds + Percentage ",
"func": "// Function Blinds and Percentage\n\nmsg.topic = flow.get (\"IDX\" + msg.payload.idx) + \"/command/cover:0\";\nmsg.idx = msg.payload.idx;\n\n//Closed\nif (msg.payload.nvalue === 0) { msg.payload = \"close\" };\n\n//Open\nif (msg.payload.nvalue === 1) { msg.payload = \"open\" };\n\n//Percentage\nif (msg.payload.nvalue === 2) { msg.payload = \"pos,\" + msg.payload.svalue1 };\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 760,
"y": 1560,
"wires": [
[
"1ada67753bbe5e55",
"3fdc4c4fc5c91b17"
]
]
},
{
"id": "1ada67753bbe5e55",
"type": "debug",
"z": "f55ebfe97fab5883",
"name": "debug 27",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 980,
"y": 1520,
"wires": []
},
{
"id": "3fdc4c4fc5c91b17",
"type": "mqtt out",
"z": "f55ebfe97fab5883",
"name": "Shelly Cover Command Out",
"topic": "",
"qos": "1",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "7aff5cd755ba2941",
"x": 1040,
"y": 1560,
"wires": []
},
{
"id": "b9a4f7de1b6e13a5",
"type": "debug",
"z": "f55ebfe97fab5883",
"name": "debug 33",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 1500,
"wires": []
},
{
"id": "38b35487299a036d",
"type": "mqtt-broker",
"name": "Raspberry Pi 1",
"broker": "192.168.10.51",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "7aff5cd755ba2941",
"type": "mqtt-broker",
"name": "Jonas_MQTT_Server",
"broker": "mqtt.jonasnet.nl",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]
Flow 3:
Code: Select all
[
{
"id": "8120bc819f267c24",
"type": "function",
"z": "f55ebfe97fab5883",
"name": "function 2",
"func": "let clientId = msg.topic. split (\"/\")[0];\n\nfor (let i = 0; i < flow.keys().length; i++) {\n\n if (clientId === flow.get(flow.keys()[i])) {\n\n let idx = parseInt(flow.keys()[i].substring(3));\n\n if (msg.payload.state === \"open\") {\n msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 0, \"svalue\": \"0\" }\n }\n\n if (msg.payload.state === \"closed\") {\n msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 1, \"svalue\": \"100\" }\n }\n\n if (msg.payload.state === \"open\") {\n msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 2, \"svalue\": msg.payload.current_pos }\n }\n return msg\n }\n}\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 480,
"y": 1720,
"wires": [
[
"d08834ebc025e49b",
"dfa807b92c4aaf81"
]
]
},
{
"id": "d08834ebc025e49b",
"type": "debug",
"z": "f55ebfe97fab5883",
"name": "debug 24",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 660,
"y": 1780,
"wires": []
},
{
"id": "4cc1cb087ca69da3",
"type": "inject",
"z": "f55ebfe97fab5883",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "shelly2pmg3-34cdb0774d4c/status/cover:0",
"payload": "{\"id\":0,\"source\":\"limit_switch\",\"state\":\"open\",\"apower\":0,\"voltage\":239.7,\"current\":0,\"pf\":0,\"freq\":50,\"aenergy\":{\"total\":40.057},\"temperature\":{\"tC\":47,\"tF\":116.7},\"pos_control\":true,\"last_direction\":\"open\",\"current_pos\":100}",
"payloadType": "json",
"x": 310,
"y": 1780,
"wires": [
[
"f73459d8a1dec0e1",
"8120bc819f267c24"
]
]
},
{
"id": "f73459d8a1dec0e1",
"type": "debug",
"z": "f55ebfe97fab5883",
"name": "debug 30",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 480,
"y": 1780,
"wires": []
},
{
"id": "dfa807b92c4aaf81",
"type": "mqtt out",
"z": "f55ebfe97fab5883",
"name": "Domoticz In",
"topic": "domoticz/in",
"qos": "1",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "38b35487299a036d",
"x": 670,
"y": 1720,
"wires": []
},
{
"id": "68787371e069472f",
"type": "mqtt in",
"z": "f55ebfe97fab5883",
"name": "Shelly Cover Status In",
"topic": "shelly2pmg3-34cdb0774d4c/status/cover:0",
"qos": "1",
"datatype": "auto-detect",
"broker": "7aff5cd755ba2941",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 260,
"y": 1720,
"wires": [
[
"8120bc819f267c24",
"f73459d8a1dec0e1"
]
]
},
{
"id": "38b35487299a036d",
"type": "mqtt-broker",
"name": "Raspberry Pi 1",
"broker": "192.168.10.51",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
},
{
"id": "7aff5cd755ba2941",
"type": "mqtt-broker",
"name": "Jonas_MQTT_Server",
"broker": "mqtt.jonasnet.nl",
"port": "1883",
"clientid": "",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]
Try it and let me know.
Regards
The