I change this setting and it still doesn't work.
This is how the roller blind reacts and works.
1. It gives an export of the entire flow:
Code: Select all
[
{
"id": "42ee6529ee50e2d7",
"type": "tab",
"label": "Shelly 2PM Gen 3",
"disabled": false,
"info": "",
"env": []
},
{
"id": "e4fb67a1676b6fbc",
"type": "change",
"z": "42ee6529ee50e2d7",
"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": 160,
"wires": [
[]
]
},
{
"id": "c7de321d99fcf212",
"type": "inject",
"z": "42ee6529ee50e2d7",
"name": "Inject Domoticz IDX",
"props": [],
"repeat": "",
"crontab": "",
"once": true,
"onceDelay": 0.1,
"topic": "",
"x": 260,
"y": 160,
"wires": [
[
"e4fb67a1676b6fbc"
]
]
},
{
"id": "f75f4261a70c5c06",
"type": "comment",
"z": "42ee6529ee50e2d7",
"name": "Configuration",
"info": "Insert the Domoticz Idx of the \nBlinds Percentage Switch in the field\nflow, starting with IDX.\n\nExample: The Domoticz Idx number = 12.\nFlow variable is IDX12.\n\nInsert the Shelly Client IDX\nas string after \"to the value\".\n\nExample: shelly2pmg3-34cdb0774d4c",
"x": 490,
"y": 100,
"wires": []
},
{
"id": "9ad8dad88fdcd9ef",
"type": "mqtt in",
"z": "42ee6529ee50e2d7",
"name": "Domoticz Out",
"topic": "domoticz/out",
"qos": "2",
"datatype": "auto-detect",
"broker": "38b35487299a036d",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 210,
"y": 380,
"wires": [
[
"d82c121e2b5d39f9"
]
]
},
{
"id": "d82c121e2b5d39f9",
"type": "switch",
"z": "42ee6529ee50e2d7",
"name": "Filter Domoticz switchType",
"property": "payload.switchType",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "Blinds Percentage",
"vt": "str"
}
],
"checkall": "true",
"repair": false,
"outputs": 1,
"x": 460,
"y": 380,
"wires": [
[
"75bd2171da300327",
"9e0b171deaf56eae"
]
]
},
{
"id": "86ebb137bda2e7e8",
"type": "debug",
"z": "42ee6529ee50e2d7",
"name": "debug 27",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 960,
"y": 340,
"wires": []
},
{
"id": "0ca516e44f5f4ef9",
"type": "mqtt out",
"z": "42ee6529ee50e2d7",
"name": "Shelly Cover Command Out",
"topic": "",
"qos": "1",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "7aff5cd755ba2941",
"x": 1020,
"y": 380,
"wires": []
},
{
"id": "75bd2171da300327",
"type": "debug",
"z": "42ee6529ee50e2d7",
"name": "debug 33",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 700,
"y": 340,
"wires": []
},
{
"id": "b6797b827d56bdb6",
"type": "comment",
"z": "42ee6529ee50e2d7",
"name": " Domotcz Switch ====> Shelly",
"info": "",
"x": 540,
"y": 260,
"wires": []
},
{
"id": "8027b04f8a7b2b31",
"type": "function",
"z": "42ee6529ee50e2d7",
"name": "Control Domoticz Switch",
"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// msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 2, \"svalue\": msg.payload.current_pos }\n\n if (msg.payload.current_pos === 100) {\n msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 0, \"svalue\": \"0\" }\n }\n\n if (msg.payload.current_pos === 0) {\n msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 1, \"svalue\": \"100\" }\n }\n\n if ((msg.payload.current_pos > 0) && (msg.payload.current_pos < 100)) {\n msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 2, \"svalue\": msg.payload.current_pos.toString() }\n }\n return msg\n }\n}\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 590,
"y": 580,
"wires": [
[
"7c55fef71ce86a9d",
"25ecbf3343c343d0"
]
]
},
{
"id": "7c55fef71ce86a9d",
"type": "debug",
"z": "42ee6529ee50e2d7",
"name": "debug 34",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 840,
"y": 640,
"wires": []
},
{
"id": "ab9f88e4ce77f221",
"type": "debug",
"z": "42ee6529ee50e2d7",
"name": "debug 35",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 540,
"y": 640,
"wires": []
},
{
"id": "25ecbf3343c343d0",
"type": "mqtt out",
"z": "42ee6529ee50e2d7",
"name": "Domoticz In",
"topic": "domoticz/in",
"qos": "1",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "38b35487299a036d",
"x": 850,
"y": 580,
"wires": []
},
{
"id": "f7240543f683a8f2",
"type": "mqtt in",
"z": "42ee6529ee50e2d7",
"name": "Shelly Cover Status In",
"topic": "shelly2pmg3-34cdb0774d4c/status/cover:0",
"qos": "1",
"datatype": "auto-detect",
"broker": "38b35487299a036d",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
"x": 320,
"y": 580,
"wires": [
[
"8027b04f8a7b2b31",
"ab9f88e4ce77f221"
]
]
},
{
"id": "50be06b3fc0c2c00",
"type": "comment",
"z": "42ee6529ee50e2d7",
"name": "Shelly ====> Domotcz Switch",
"info": "",
"x": 680,
"y": 520,
"wires": []
},
{
"id": "9e0b171deaf56eae",
"type": "function",
"z": "42ee6529ee50e2d7",
"name": "Blinds + Percentage ",
"func": "// Function Blinds and Percentage\n\nmsg.topic = flow.get (\"IDX\" + msg.payload.idx.toString()) + \"/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.Level.toString() };\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 740,
"y": 380,
"wires": [
[
"0ca516e44f5f4ef9",
"86ebb137bda2e7e8"
]
]
},
{
"id": "38b35487299a036d",
"type": "mqtt-broker",
"name": "Raspberry Pi 1",
"broker": "192.168.0.40",
"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": "Shelly",
"broker": "192.168.0.40",
"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": ""
}
]
2. I import and paste the code
3.
The slider in domoticz works. Sets the blind in the appropriate position - Correct operation
The indication of the open and closed position of the roller shutter is incorrect:
The inscription indicates the shutter is closed, while the shutter is open.
Replacing the node function: "Blinds + Percentage" - nothing helps.
I think you're close to getting this flow going.