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 »

You have only 1 such an interface configured?
YES

Can you show me the configuration.
YES
Hardware:
Hardware1.png
Hardware1.png (70.83 KiB) Viewed 430 times
Hardware2.png
Hardware2.png (129.13 KiB) Viewed 430 times
Hardware3.png
Hardware3.png (56.66 KiB) Viewed 430 times
I recommend to you, to install MQTT Explorer on your desktop or laptop, so that you can check what happens in MQTT.
I have it installed on my computer but everything runs very quickly because there are so many devices.
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 think we need to clean up here too.
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 »

However, there is something wrong with this flow with temperature, because if I turn it on, the dashticz stops working stably - I click on the light bulb icons and they don't work.
I turn off the flow with temperature.

I turn on the flow without temperature and the dashticz returns to working properly.
User avatar
FireWizard
Posts: 1893
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,

Please test it, with disablement of the MQTT node.
I asked you that before.

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 »

Can you try, if it happens, not to disable the whole "flow", but only the MQTT Output node, marked "Domoticz In"
(Also a button down left) and "Deploy"
Yes, now I see that you wrote it.

Of course I will check it today.
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 »

Exactly as you wrote, disabling the "domoticz in" node itself in the flow with temperature restores the system to operation.
wyłączenie.png
wyłączenie.png (61.76 KiB) Viewed 343 times
I noticed the problem in operation after domoticz performed automatic closing of all blinds. Automatic closing is performed by a scene in domoticz.
User avatar
FireWizard
Posts: 1893
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:
Exactly as you wrote, disabling the "domoticz in" node itself in the flow with temperature restores the system to operation.
Very strange, but to test, I have modified the "Function" node, so that the Temperature will not be sent to the MQTT Output.
Can you put this node in parallel with the existing "Function" node and disable the existing "Function" node (down left button).
Enable the MQTT node again and test.

Code: Select all

[
    {
        "id": "58eeb2cbc12d887e",
        "type": "function",
        "z": "cfcf4d6d274167af",
        "name": "Control Domoticz Switch",
        "func": "let sidx = (flow.get(msg.topic.split(\"/\")[0])).sidx;\nlet tidx = (flow.get(msg.topic.split(\"/\")[0])).tidx;\n\n//Open (for Reversed Position)\nif (msg.payload.current_pos === 100) {\n    msg.payload = { \"command\": \"udevice\", \"idx\": sidx, \"nvalue\": 1, \"svalue\": \"100\" }\n}\n\n//Closed (for Reversed Position)\nif (msg.payload.current_pos === 0) {\n    msg.payload = { \"command\": \"udevice\", \"idx\": sidx, \"nvalue\": 0, \"svalue\": \"0\" }\n}\n\n//Percentage (for Reversed Position)\nif ((msg.payload.current_pos > 0) && (msg.payload.current_pos < 100)) {\n    msg.payload = { \"command\": \"udevice\", \"idx\": sidx, \"nvalue\": 2, \"svalue\": msg.payload.current_pos.toString() }\n}\n\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 530,
        "y": 600,
        "wires": [
            [
                "e58167589c1a3fcf"
            ]
        ]
    }
]
I do not expect, that it is the solution, but let us test it anyway.
Let me know.

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 »

So here we go with test.
I changed the name - I added the word TEST.

I think that's what you meant.
TESTtempo.png
TESTtempo.png (48.29 KiB) Viewed 281 times
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 »

In this system the temperature in Domoticz does not work. There is no temperature from shelly.
User avatar
FireWizard
Posts: 1893
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,
changed the name - I added the word TEST.
That is alright.
I think that's what you meant.
Exactly
In this system the temperature in Domoticz does not work. There is no temperature from shelly.
That is correct and made intentional.

You said that the flow with the Temperature causes the problems. Sorry, but I do not believe that.
But to be sure, I took the Temperature out, just for testing it.

I'm curious what will happen with the Domoticz. Does it still stop working?


I said also in my post:
I have modified the "Function" node, so that the Temperature will not be sent to the MQTT Output.
Let me know the final result.

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 »

The blinds closed from the Domoticz scene.

I start dashticz and I already have poor performance - no response to switches.

I do this:
robiętak.png
robiętak.png (55.68 KiB) Viewed 267 times


And dashticz starts working properly.
Last edited by Daro1003 on Wednesday 25 June 2025 22:07, edited 1 time in total.
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 »

wtymprzepływie.png
wtymprzepływie.png (43.21 KiB) Viewed 267 times

Of course, in this earlier flow without temperature this problem does not exist.

So maybe I will skip the temperature sensor but it is a bit of a shame because I wanted to monitor the shelly temperature due to the temperature problems in the earlier shelly versions.
User avatar
FireWizard
Posts: 1893
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.

I wrote June 24:
I have modified the "Function" node, so that the Temperature will not be sent to the MQTT Output.
You wrote June 22:
However, there is something wrong with this flow with temperature, because if I turn it on, the dashticz stops working stably - I click on the light bulb icons and they don't work.
I turn off the flow with temperature.

I turn on the flow without temperature and the dashticz returns to working properly.
and June 23:
Exactly as you wrote, disabling the "domoticz in" node itself in the flow with temperature restores the system to operation.
and June 25:
The blinds closed from the Domoticz scene.

I start dashticz and I already have poor performance - no response to switches.
and
Of course, in this earlier flow without temperature this problem does not exist.

So maybe I will skip the temperature sensor but it is a bit of a shame because I wanted to monitor the shelly temperature due to the temperature problems in the earlier shelly versions.
No, no, it is not the temperature sensor.

What did we test last couple of days:

1. I removed the sending of the Temperature sensor from the flow (in the TEST function node). So the temperature of the Shelly will not be send.
2. Only the switch status will be send.
3. If the MQTT output node, called Domoticz In, sends, either the Switch status or the Temperature, the problem starts and finally the switch cannot be operated anymore
4. As soon as you disable the MQTT mode, the system returns to normal.

That made me think, that there is a loop in Domoticz.

To find that loop, I suggest to do the following:

1. Delete/Remove the "Function "node, called "Control Domoticz Switch TEST"
2. Re-enable the old Function node, called "Control Domoticz Switch"
3. Put a "Debug" node parallel to the MQTT Output node and connect this to the "Function" node.
4. Re-enable the MQTT Output node.

Everything is now, as it was originally, but with an extra Debug node at the output.

Test as follows.

1. Activate the push button for the Shelly in Domoticz. Note what you see in the Debug node and let me kinow.
2. Do it again with your "Scene" button. Note again what you see in the "Debug" node and let me know.

And the, I want to check the following in the settings of the MQTT

1. Go to "Setup" ====> "Hardware"
2. got to MQTT (your Id = 4), called MQTT Client gateway with LAN interface.
3. What is your configuration of "Prevent Loop"? Let me know.

Regards
Last edited by FireWizard on Saturday 28 June 2025 9:36, edited 1 time in total.
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 haven't tested the above option yet.

But NOTE:
Although I turned off two nodes as in the post, in the morning the lighting no longer worked from the sensors, after turning off the entire flow, the lighting started working and has been working until today. The roller blind is controlled from the flow without temperature and everything is ok.
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 »

Test as follows.

1. Activate the push button for the Shelly in Domoticz. Note what you see in the Debug node and let me kinow.
2. Do it again with your "Scene" button. Note again what you see in the "Debug" node and let me know.
I don't see any differences

Switch Domoticz:
switch.png
switch.png (81.72 KiB) Viewed 148 times
Scena Open i 25%:
ScenaOPEN.png
ScenaOPEN.png (92.11 KiB) Viewed 148 times
scenaPrzysłona.png
scenaPrzysłona.png (92.52 KiB) Viewed 148 times
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. Go to "Setup" ====> "Hardware"
2. got to MQTT (your Id = 4), called MQTT Client gateway with LAN interface.
3. What is your configuration of "Prevent Loop"? Let me know.
MQTTClient.png
MQTTClient.png (87.94 KiB) Viewed 148 times
User avatar
FireWizard
Posts: 1893
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 looked to your both posts

Your MQTT configuration is okay. The "Prevent Loop" configuration has been set to "True".

The other pictures show exactly, what I had expected to see. Multiple identical messages means a loop.
However I have no idea, yet, where that loop will be introduced,

Is it the Shelly 2PM Gen 3 unit, that returns a message? I cannot test that, as I do not have one available here.

or

Is it "Dashticz" that causes the loop? I do not expect that, as I can't get an idea, how that should work.
I don't think that "Dashticz" interferes with MQTT.
But I cannot test that either, as I do not have "Dashticz" installed.

I have modified the "Function" node a little and I have introduced a "Filter" (RBE) node.

See:

Screenshot_Shelly 2PM GEN3 and RBE.png
Screenshot_Shelly 2PM GEN3 and RBE.png (27.99 KiB) Viewed 128 times

I have added the flow for the "Function" node, called "Control Domoticz Switch" and the "Filter" node, called "Prevent Loop" , below:

Code: Select all

[
    {
        "id": "2a56e8a2ce739840",
        "type": "function",
        "z": "cfcf4d6d274167af",
        "name": "Control Domoticz Switch",
        "func": "let msg1 = {};\nlet msg2 = {};\nmsg1.topic = \"shellies/switches\";\nmsg2.topic = \"shellies/temperature\";\n\nlet sidx = (flow.get(msg.topic.split(\"/\")[0])).sidx;\nlet tidx = (flow.get(msg.topic.split(\"/\")[0])).tidx;\n\n//Open (for Reversed Position)\nif (msg.payload.current_pos === 100) {\n    msg1.payload = { \"command\": \"udevice\", \"idx\": sidx, \"nvalue\": 1, \"svalue\": \"100\" }\n}\n\n//Closed (for Reversed Position)\nif (msg.payload.current_pos === 0) {\n    msg1.payload = { \"command\": \"udevice\", \"idx\": sidx, \"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\": sidx, \"nvalue\": 2, \"svalue\": msg.payload.current_pos.toString() }\n}\n\n//Temperature\nmsg2.payload = { \"command\": \"udevice\", \"idx\": tidx, \"nvalue\": 0, \"svalue\": msg.payload.temperature.tC.toString() }\n\nreturn [[msg1,msg2]];",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 530,
        "y": 480,
        "wires": [
            [
                "7ae122c721d614e4",
                "eb28f7bede650b97"
            ]
        ]
    },
    {
        "id": "eb28f7bede650b97",
        "type": "rbe",
        "z": "cfcf4d6d274167af",
        "name": "Prevent Loop",
        "func": "rbe",
        "gap": "",
        "start": "",
        "inout": "out",
        "septopics": true,
        "property": "payload",
        "topi": "topic",
        "x": 790,
        "y": 480,
        "wires": [
            [
                "f6cf694ec8750a8b",
                "10f0146e2906fd36"
            ]
        ]
    }
]
Can you replace the existing "Function" node with this new pair of nodes, as shown in the picture.
And test again. For the time being, leave the "Debug" node in place.

You said also:
But NOTE:
Although I turned off two nodes as in the post, in the morning the lighting no longer worked from the sensors, after turning off the entire flow, the lighting started working and has been working until today. The roller blind is controlled from the flow without temperature and everything is ok.
I do not understand that, as the "Function" node and the "MQTT Output" node were already disabled.
By disabling the whole flow, you disabled the stream from Domoticz to Shelly and the MQTT Input node in addition.

Or!

Do you have also flows with the Shelly nodes (http) active in some way. that those create the loop?

Let me know.

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 »

Is it "Dashticz" that causes the loop? I do not expect that, as I can't get an idea, how that should work.
I don't think that "Dashticz" interferes with MQTT.
But I cannot test that either, as I do not have "Dashticz" installed.
Dashticz works correctly.

After recent tests I think that:

If I turn on the flow with temperature:

Dashticz immediately stops working.

If I use a scene in domoticz:

Lighting stops working, i.e. another communication fails.
User avatar
FireWizard
Posts: 1893
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,

Did you already test with the 2 nodes, I sent you?

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 »

Did you already test with the 2 nodes, I sent you?
YES:
TestowyFilter.png
TestowyFilter.png (57.08 KiB) Viewed 105 times
Unfortunately it doesn't work.

Communication is down.
- Dashticz stops working.
- Lighting from sensors also - in this case new domoticz settings turn on the switch but there is no communication to Sonoff for Sonoff to turn on the bulb.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 0 guests