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: 192
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 »

1. I just need to turn on the flows and dashticz stops working properly.

2. I start a scene in domoticz and then the lighting from the sensors stops working, i.e. communication between Domoticz and sonoff 4ch.
User avatar
FireWizard
Posts: 1892
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 do not understand, why all this trouble with Dashticz and the Switches occurs.

But I went back to a very basic flow.
Can you test this one.

Disable all flows, which receive and control Shellies and try this complete new flow.
Instead of a configuration, all idx's are hard coded in the flow (1060 and 1061)
As always, configure your own MQTT settings,

Test and let me know.

Code: Select all

[
    {
        "id": "ffc4efc1cd6ece12",
        "type": "function",
        "z": "10c090a82727bafe",
        "name": "Control Domoticz Switch",
        "func": "let msg1 = {};\nlet msg2 = {};\nmsg1.topic = \"shellies/switches\";\nmsg2.topic = \"shellies/temperature\";\n\n//Open (for Reversed Position)\nif (msg.payload.current_pos === 100) {\n    msg1.payload = { \"command\": \"udevice\", \"idx\": 1060, \"nvalue\": 1, \"svalue\": \"100\" }\n}\n\n//Closed (for Reversed Position)\nif (msg.payload.current_pos === 0) {\n    msg1.payload = { \"command\": \"udevice\", \"idx\": 1060, \"nvalue\": 0, \"svalue\": \"0\" }\n}\n\n//Percentage (for Reversed Position)\nif ((msg.payload.current_pos > 0) && (msg.payload.current_pos < 100)) {\n    msg1.payload = { \"command\": \"udevice\", \"idx\": 1060, \"nvalue\": 2, \"svalue\": msg.payload.current_pos.toString() }\n}\n\n//Temperature\nmsg2.payload = { \"command\": \"udevice\", \"idx\": 1061, \"nvalue\": 0, \"svalue\": msg.payload.temperature.tC.toString() }\n\nreturn [[msg1,msg2]];",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 530,
        "y": 380,
        "wires": [
            [
                "17f76470f66893c6"
            ]
        ]
    },
    {
        "id": "63466c41eeccdb21",
        "type": "mqtt out",
        "z": "10c090a82727bafe",
        "name": "Domoticz In",
        "topic": "domoticz/in",
        "qos": "0",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "38b35487299a036d",
        "x": 1050,
        "y": 380,
        "wires": []
    },
    {
        "id": "f5114a0ea7413f87",
        "type": "mqtt in",
        "z": "10c090a82727bafe",
        "name": "Shelly Cover Status Out",
        "topic": "shelly2pmg3-34cdb0774d4c/status/cover:0",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "38b35487299a036d",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 260,
        "y": 380,
        "wires": [
            [
                "ffc4efc1cd6ece12"
            ]
        ]
    },
    {
        "id": "c3669ae0eab4b29d",
        "type": "comment",
        "z": "10c090a82727bafe",
        "name": "Shelly  ====> Domoticz Switch",
        "info": "",
        "x": 540,
        "y": 320,
        "wires": []
    },
    {
        "id": "51882f2b44c43e5c",
        "type": "mqtt in",
        "z": "10c090a82727bafe",
        "name": "Domoticz Out",
        "topic": "domoticz/out",
        "qos": "0",
        "datatype": "auto-detect",
        "broker": "38b35487299a036d",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 290,
        "y": 200,
        "wires": [
            [
                "ab0176dcde2164b2"
            ]
        ]
    },
    {
        "id": "dbc4d9f998e839fd",
        "type": "function",
        "z": "10c090a82727bafe",
        "name": "Blinds + Percentage ",
        "func": "// Function Blinds and Percentage\n\nmsg.topic = \"shelly2pmg3-34cdb0774d4c/command/cover:0\";\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": 820,
        "y": 200,
        "wires": [
            [
                "91622adcb065ef12",
                "adb3dcf604b852df"
            ]
        ]
    },
    {
        "id": "91622adcb065ef12",
        "type": "debug",
        "z": "10c090a82727bafe",
        "name": "debug 76",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1040,
        "y": 260,
        "wires": []
    },
    {
        "id": "adb3dcf604b852df",
        "type": "mqtt out",
        "z": "10c090a82727bafe",
        "name": "Shelly Cover Command Out",
        "topic": "",
        "qos": "0",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "38b35487299a036d",
        "x": 1100,
        "y": 200,
        "wires": []
    },
    {
        "id": "67acc7281fe20577",
        "type": "comment",
        "z": "10c090a82727bafe",
        "name": " Domoticz Switch ====> Shelly",
        "info": "",
        "x": 540,
        "y": 140,
        "wires": []
    },
    {
        "id": "ab0176dcde2164b2",
        "type": "switch",
        "z": "10c090a82727bafe",
        "name": "Filter Domoticz Switch Index",
        "property": "payload.idx",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1060",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 540,
        "y": 200,
        "wires": [
            [
                "dbc4d9f998e839fd"
            ]
        ]
    },
    {
        "id": "17f76470f66893c6",
        "type": "rbe",
        "z": "10c090a82727bafe",
        "name": "Prevent Loop",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 790,
        "y": 380,
        "wires": [
            [
                "63466c41eeccdb21",
                "1917bf35635d0f9e"
            ]
        ]
    },
    {
        "id": "1917bf35635d0f9e",
        "type": "debug",
        "z": "10c090a82727bafe",
        "name": "debug 77",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1040,
        "y": 440,
        "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": ""
    }
]
Regards
Daro1003
Posts: 192
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'm testing this new flow for the second day and everything works fine.

Where do I provide the switch IDX and temperature IDX?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest