Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

Could you remove the "Function" node, called "Blinds + Percentage" and replace it with this new "Function" node?
And test again and let me know.
Now everything works fine :) Great
So, if this works, can you show me the debug output of the following flow, in all positions )Open. Close and a slider position)
Then I can implement that.
I added this flow in a new flow, I don't know if it's good but I think it's ok:

Data:

CLOSED:
CLOSED-dane.png
CLOSED-dane.png (20.24 KiB) Viewed 756 times
OPEN:
OPEN-dane.png
OPEN-dane.png (20.1 KiB) Viewed 756 times
15%:
15%-Dane.png
15%-Dane.png (18.53 KiB) Viewed 756 times
I have a question:
How can I copy this working flow now and save it somewhere on the disk, even in the form of the code you are sending me? I would like to have a ready code to import for the next shelly gen 3
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hello @Daro1003,

I have created a flow for the Shelly to Domoticz.

It should update the Domoticz widget only. So it does not activate any actions, that you might have configured for the Switch.

See:

Code: Select all

[
    {
        "id": "3be52bd193485cf4",
        "type": "function",
        "z": "589aa1f8113f3797",
        "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": 450,
        "y": 520,
        "wires": [
            [
                "6b107f279c3940b6",
                "ad6d65a29fe88f81"
            ]
        ]
    },
    {
        "id": "6b107f279c3940b6",
        "type": "debug",
        "z": "589aa1f8113f3797",
        "name": "debug 34",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 700,
        "y": 580,
        "wires": []
    },
    {
        "id": "3b439aac5f94e681",
        "type": "debug",
        "z": "589aa1f8113f3797",
        "name": "debug 35",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 400,
        "y": 580,
        "wires": []
    },
    {
        "id": "ad6d65a29fe88f81",
        "type": "mqtt out",
        "z": "589aa1f8113f3797",
        "name": "Domoticz In",
        "topic": "domoticz/in",
        "qos": "1",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "38b35487299a036d",
        "x": 710,
        "y": 520,
        "wires": []
    },
    {
        "id": "ce1c7ba4d1dbea73",
        "type": "mqtt in",
        "z": "589aa1f8113f3797",
        "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": 180,
        "y": 520,
        "wires": [
            [
                "3be52bd193485cf4",
                "3b439aac5f94e681"
            ]
        ]
    },
    {
        "id": "8fc9517938bfac09",
        "type": "comment",
        "z": "589aa1f8113f3797",
        "name": "Shelly  ====> Domotcz Switch",
        "info": "",
        "x": 540,
        "y": 460,
        "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": ""
    }
]
The only thing you have to do is to configure your own MQTT Settings

Can you test with your wall switch, that the indication on the widget is correct. And let me know.

You asked also:
I have a question:
How can I copy this working flow now and save it somewhere on the disk, even in the form of the code you are sending me? I would like to have a ready code to import for the next Shelly gen 3
Do it as follows:

1. Go to the "Hamburger" menu at the top right.
2. Select "Export".
3. You see the nodes, you are about to export. Select "Local".
4. In the field "Export as" give it any name you want, e.g. flows.shelly_2pmgen3 or whatever and you have saved it.

To retrieve them:

1. Go to the "Hamburger" menu at the top right.
2. Select "Import".
3. Select "Local".
4. You see the flow with the name, you have saved it, e.g. flows.shelly_2pmgen3.
5. Select that file and press "Import¨

And you are done.

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

I improvised the flow - there is an immediate connection.
Shelly-Switch.png
Shelly-Switch.png (19.23 KiB) Viewed 742 times
Unfortunately, when I click the switch on the wall it does not change the state of the switch in Domoticz.

Code: Select all

The only thing you have to do is to configure your own MQTT Settings
After importing - I didn't change anything.

Where should I insert the Domoticz switch IDX?

Where do I insert the shelly ID?
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hello @Daro1003,

What do you see in the Debug nodes?

You said:
there is an immediate connection
Then it should be connected to your MQTT broker.
After importing - I didn't change anything.
Okay
Where should I insert the Domoticz switch IDX?

Where do I insert the shelly ID?
This is already done.

Do you run this flow in the same tab as the flow from Domoticz to Shelly?

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

Debug nodes after pressing the key are active.

Slider in domoticz NO.
Wezly_debugowania.png
Wezly_debugowania.png (98.47 KiB) Viewed 709 times
Do you run this flow in the same tab as the flow from Domoticz to Shelly?
YES.
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hello @Daro1003,

It is clear for me, why you don't see anything.

You still use my index number (12). See "Debug" node idx:12.

It is very unlikely that your Domoticz Switch (Blinds + Percentage) has also the Idx 12.

In my post, dated 12 May 2025, 18:46 , I wrote:
1. In the first stream, you have to configure the relationship between the Domoticz Switch index and the Shelly Client ID.
Open that "Change" node and edit the fields. a description is included in the "Comment" node, called "Configuration"
This has to done once for all "Blinds Percentage" Switches.
Did you ever do that? I don't think so.

If you follow the guideline in the "Comment" node, it should work.
It is very simple. Change IDX12 to IDXxxx, where xxx is the IDX number of your Domoticz switch.

Try it,

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

Did you ever do that? I don't think so.
YES - s this the node:
My shelly switch idx is 1060
SetDomoticz.png
SetDomoticz.png (68.8 KiB) Viewed 653 times
I have changed it.
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hi @Dare1003,
YES - s this the node:
Yes, that is the one, that I mean.
Check it.
I have changed it.
And does it work now?

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

As the screen has, I had it set to my own id 1060 from the moment you sent this flow.

Currently, the slider from the local key does not work.
SetDomoticz.png
SetDomoticz.png (72.64 KiB) Viewed 610 times
And does it work now?
NO
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hi, @Daro1003,

And the other way around, from Domoticz to Shelly

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

And the other way around, from Domoticz to Shelly
I don't understand.
Where else should I check the settings - change
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hello @Daro1003,
I don't understand
I mean, if you push the button in Domoticz or move the slider, does the the Shelly still react?

The only setting, you have to make is the Change node and that is okay, as you showed me

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

I change this setting and it still doesn't work.
I mean, if you push the button in Domoticz or move the slider, does the the Shelly still react?
YES
This is how the roller blind reacts and works.

Look:
Interestingly:
1. It gives an export of the entire flow:
export.png
export.png (50.88 KiB) Viewed 486 times

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": ""
    }
]
As you can see, the IDX is already correct

2. I import and paste the code

3.
The % indicator works after using the button on the wall - great
Raising and lowering with buttons in domoticz works - Correct operation
The slider in domoticz works. Sets the blind in the appropriate position - Correct operation

Problem:

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.
The slider 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.
Błąd17maj.png
Błąd17maj.png (13.71 KiB) Viewed 483 times
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hello @daro1003,

You wrote:
YES
This is how the roller blind reacts and works.
Okay

Look:
Interestingly:
1. It gives an export of the entire flow:
Yes, that is also the intention, but click on "Local".

In my post of 15 May 2025, 22:06 , I wrote:
1. Go to the "Hamburger" menu at the top right.
2. Select "Export".
3. You see the nodes, you are about to export. Select "Local".
4. In the field "Export as" give it any name you want, e.g. flows.shelly_2pmgen3 or whatever and you have saved it.
See point 3: Select "Local"
As you can see, the IDX is already correct

2. I import and paste the code
??
Problem:

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.
The slider 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.
Please can you replace the node, called "Control Domoticz Switch", with the following node.

Code: Select all

[
    {
        "id": "3be52bd193485cf4",
        "type": "function",
        "z": "589aa1f8113f3797",
        "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        //Open (for Reversed Position)\n        if (msg.payload.current_pos === 0) {\n            msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 1, \"svalue\": \"100\" }\n        }\n\n        //Closed (for Reversed Position)\n        if (msg.payload.current_pos === 100) {\n            msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 0, \"svalue\": \"0\" }\n        }\n\n        //Percentage (for Reversed Position)\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": 450,
        "y": 520,
        "wires": [
            [
                "6b107f279c3940b6",
                "ad6d65a29fe88f81"
            ]
        ]
    }
]
I think it should work.

Test it and let me know.

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

Please can you replace the node, called "Control Domoticz Switch", with the following node.
YES

I replaced the node - unfortunately it did not help, it still works the same.
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hello @Daro1003,
I replaced the node - unfortunately it did not help, it still works the same.
Then try this new "Function" node.

Code: Select all

[
    {
        "id": "3be52bd193485cf4",
        "type": "function",
        "z": "589aa1f8113f3797",
        "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        //Open (for Reversed Position)\n        if (msg.payload.current_pos === 100) {\n            msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 1, \"svalue\": \"100\" }\n        }\n\n        //Closed (for Reversed Position)\n        if (msg.payload.current_pos === 0) {\n            msg.payload = { \"command\": \"udevice\", \"idx\": idx, \"nvalue\": 0, \"svalue\": \"0\" }\n        }\n\n        //Percentage (for Reversed Position)\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": 450,
        "y": 520,
        "wires": [
            [
                "6b107f279c3940b6",
                "ad6d65a29fe88f81"
            ]
        ]
    }
]
Let me know

Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

Then try this new "Function" node.
Działa odpowiednio cały przepływ.

Dziękuję za dużo pracę jaką włożyłeś w uruchomienie tej integracji.

I understand that for the next shelly driver I change the IDX and shelly ID as in the picture.
W nowym przepływie zmieniamy IDX i ID shelly.png
W nowym przepływie zmieniamy IDX i ID shelly.png (32.01 KiB) Viewed 446 times
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

Question:

Would you have the time and desire to fight with the roller shutter controller on Tasmota?

I have one in stock for testing.

It is half the price of shelly and may be less prone to failures.

I would like to test it and try to run it in domoticz. Unfortunately, integration via the Tasmoticz plugin does not work.

https://nous.technology/product/b3t.html
https://nous.technology/product/manual? ... s%C5%82ugi
User avatar
FireWizard
Posts: 1868
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by FireWizard »

Hello @Daro1003,

I understand, no Google understands, that:
Działa odpowiednio cały przepływ.

Dziękuję za dużo pracę jaką włożyłeś w uruchomienie tej integracji.
means
The entire flow works properly.

Thank you for the great work you put into getting this integration up and running.
Thank you and that's fine for me.

You should do the following

Remove the "Debug" nodes, if you are satisfied with the final result.
Or if you want them to stay on the canvas, disable them, by clicking the right button

I understand that for the next shelly driver I change the IDX and shelly ID as in the picture.
NO, ABSOLUTELY NOT

Never edit the visible text in the import or export function.
Work only on the canvas.

If you want to add another Shelly 2PM Gen 3 to the system, do the following

In Domoticz:

1. Create a new virtual Switch in Domoticz.
2. Configure this Switch as "Blinds Percentage" and tick the box "Reverse position"
3. Note its IDX number ( perhaps 1061 ???)

In Node-RED

1. Open the "Change" node, called "Set Domoticz IDX", by double clicking.
2. Click the +add button and another field will be added.
3. Add the Domoticz IDX and the Shelly ClientID in the same way as the first item in the node.
4, Deploy
6. Activate the "Inject" node.

That's all and then the new Shelly should work

You asked also in another post:
Would you have the time and desire to fight with the roller shutter controller on Tasmota?

I have one in stock for testing.

It is half the price of shelly and may be less prone to failures.

I would like to test it and try to run it in domoticz. Unfortunately, integration via the Tasmoticz plugin does not work.

I have never used a Tasmota flashed device and so I have zero experience with it. Could be a challenge, but
I suggest that a more experienced user support you.

Question for you too,

For the Shelly, do you want more data in Domoticz, such as:

1. Power/Energy consumption
2. Temperature

Let me know.

Have a good weekend and Regards
Daro1003
Posts: 167
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Re: Is it possible to add Shelly 2PM GEN 3 to Domoticz?

Post by Daro1003 »

For the Shelly, do you want more data in Domoticz, such as:
1. Power/Energy consumption
NO
2. Temperature
YES

In Node-RED

1. Open the "Change" node, called "Set Domoticz IDX", by double clicking.
2. Click the +add button and another field will be added.
I don't know how to do it ;/ Can you upload a screenshot?
Post Reply

Who is online

Users browsing this forum: madpatrick and 1 guest