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

User avatar
FireWizard
Posts: 1886
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 know how to do it ;/ Can you upload a screenshot?
1. Open the "Change" node, called "Set Domoticz IDX", by double clicking.
Screenshot_Change_Annotated.png
Screenshot_Change_Annotated.png (38.66 KiB) Viewed 566 times
2. Click the +add button and another field will be added.
Screenshot_Change_Annotated2.png
Screenshot_Change_Annotated2.png (34.45 KiB) Viewed 566 times
3. Add the Domoticz IDX and the Shelly ClientID in the same way as the first item in the node.

Screenshot_Change_Annotated3.png
Screenshot_Change_Annotated3.png (35.03 KiB) Viewed 566 times
4, Deploy
5. Activate the "Inject" node.
I recommend to view some videos of Node-RED: https://www.youtube.com/watch?v=jMaHKQLXYhI

Regards
User avatar
FireWizard
Posts: 1886
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 have probably thought, that I had forgotten you. This is not the case, but I have been considering how to make the implementation of a Temperature sensor as easy as possible.

You asked:
2. Temperature

YES
To make the configuration as simple as before, I had to swap the key and value.
Previously the key was the characters IDX followed by de Domoticz idx number, e.g. IDX1060.
The value was the Shelly ClientID

I swapped those 2, as shown in the next picture

Screenshot_Shelly 2PMG3-alt.png
Screenshot_Shelly 2PMG3-alt.png (46.94 KiB) Viewed 504 times
1. The Shelly Client ID has to be inserted after flow
2. The Domoticz idx for the Switch has to be inserted in an Object after "sidx". Example 12
3. The Domoticz idx of the Temperature sensor has to be inserted in the same Object after "tidx". Example 13

The contents of the "Function" nodes has also changed.

Do the following:

Create a (new) virtual sensor for the Temperature of the Shelly device. Insert the idx number after "tidx":

Do not forget to configure your own MQTT parameters.

A complete flow you will find below.
I suggest you copy this one in a separate tab and disable the old tab.

Code: Select all

[
    {
        "id": "327568dd155084e3",
        "type": "comment",
        "z": "cfcf4d6d274167af",
        "name": "Configuration",
        "info": "Insert the Shelly ClientID of the\nShelly device (e.g. shelly2pmg3-34cdb0774d4c) in the field\nflow.\n\nInsert the IDX of the Domoticz Switch in the JSON object\nfile in the field \"to the value\" after \"sidx\" and insert the IDX of\nthe Domoticz Temperature sensor after \"tidx\".\n\nExample, if the IDX of the Domoticz Switch is 12 and\nthe IDX of the Temperature sensor is 13:\n\n{\"sidx\": 12, \"tidx\": 13}",
        "x": 490,
        "y": 80,
        "wires": []
    },
    {
        "id": "13f99299d7be6bd2",
        "type": "inject",
        "z": "cfcf4d6d274167af",
        "name": "Inject Domoticz IDX",
        "props": [],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "x": 260,
        "y": 140,
        "wires": [
            [
                "50d48d9364c4f0f8"
            ]
        ]
    },
    {
        "id": "50d48d9364c4f0f8",
        "type": "change",
        "z": "cfcf4d6d274167af",
        "name": "Set Domoticz IDX ",
        "rules": [
            {
                "t": "set",
                "p": "shelly2pmg3-34cdb0774d4c",
                "pt": "flow",
                "to": "{\"sidx\": 12, \"tidx\": 13}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "2a56e8a2ce739840",
        "type": "function",
        "z": "cfcf4d6d274167af",
        "name": "Control Domoticz Switch",
        "func": "let msg1 = {};\nlet msg2 = {};\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",
                "f6cf694ec8750a8b"
            ]
        ]
    },
    {
        "id": "7ae122c721d614e4",
        "type": "debug",
        "z": "cfcf4d6d274167af",
        "name": "debug 32",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 780,
        "y": 540,
        "wires": []
    },
    {
        "id": "63781efaa0e431d8",
        "type": "debug",
        "z": "cfcf4d6d274167af",
        "name": "debug 33",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 480,
        "y": 540,
        "wires": []
    },
    {
        "id": "f6cf694ec8750a8b",
        "type": "mqtt out",
        "z": "cfcf4d6d274167af",
        "name": "Domoticz In",
        "topic": "domoticz/in",
        "qos": "1",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "38b35487299a036d",
        "x": 790,
        "y": 480,
        "wires": []
    },
    {
        "id": "80e1fbc254e2e697",
        "type": "mqtt in",
        "z": "cfcf4d6d274167af",
        "name": "Shelly Cover Status Out",
        "topic": "shelly2pmg3-34cdb0774d4c/status/cover:0",
        "qos": "1",
        "datatype": "auto-detect",
        "broker": "38b35487299a036d",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 260,
        "y": 480,
        "wires": [
            [
                "63781efaa0e431d8",
                "2a56e8a2ce739840"
            ]
        ]
    },
    {
        "id": "e6cb20d21c6d557c",
        "type": "comment",
        "z": "cfcf4d6d274167af",
        "name": "Shelly  ====> Domotcz Switch",
        "info": "",
        "x": 540,
        "y": 420,
        "wires": []
    },
    {
        "id": "725dfa2416f8df60",
        "type": "mqtt in",
        "z": "cfcf4d6d274167af",
        "name": "Domoticz Out",
        "topic": "domoticz/out",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "38b35487299a036d",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 290,
        "y": 300,
        "wires": [
            [
                "c216d4d18f94b29d"
            ]
        ]
    },
    {
        "id": "c216d4d18f94b29d",
        "type": "switch",
        "z": "cfcf4d6d274167af",
        "name": "Filter Domoticz switchType",
        "property": "payload.switchType",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Blinds Percentage",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 540,
        "y": 300,
        "wires": [
            [
                "3e74c0a6e0804e4f",
                "315dae8f498b9c4d"
            ]
        ]
    },
    {
        "id": "3e74c0a6e0804e4f",
        "type": "function",
        "z": "cfcf4d6d274167af",
        "name": "Blinds + Percentage ",
        "func": "// Function Blinds and Percentage\n\nfor (let i = 0; i < flow.keys().length; i++) {\n\n        if (msg.payload.idx === (flow.get(flow.keys())[i]).sidx) {\n\nmsg.topic = flow.keys()[i] + \"/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\n}\n\nreturn msg;\n}",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 820,
        "y": 300,
        "wires": [
            [
                "06e073c160456137",
                "3dde24433748f2c3"
            ]
        ]
    },
    {
        "id": "06e073c160456137",
        "type": "debug",
        "z": "cfcf4d6d274167af",
        "name": "debug 54",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1040,
        "y": 360,
        "wires": []
    },
    {
        "id": "3dde24433748f2c3",
        "type": "mqtt out",
        "z": "cfcf4d6d274167af",
        "name": "Shelly Cover Command Out",
        "topic": "",
        "qos": "1",
        "retain": "false",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "38b35487299a036d",
        "x": 1100,
        "y": 300,
        "wires": []
    },
    {
        "id": "315dae8f498b9c4d",
        "type": "debug",
        "z": "cfcf4d6d274167af",
        "name": "debug 55",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 780,
        "y": 360,
        "wires": []
    },
    {
        "id": "b1d50d4a3b22e08f",
        "type": "comment",
        "z": "cfcf4d6d274167af",
        "name": " Domotcz Switch ====> Shelly",
        "info": "",
        "x": 540,
        "y": 240,
        "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": ""
    }
]
Test it and let me know.

Regards
Last edited by FireWizard on Sunday 01 June 2025 11:23, edited 1 time in total.
Daro1003
Posts: 181
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 »

Everything is working properly.

The temperature of the shell GEN 3 is 45 degrees.
The temperature of the shell 2.5 is 60 degrees.

As you can see, something is probably fixed in GEN 3

Thank you for your great help.
User avatar
FireWizard
Posts: 1886
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,
Everything is working properly.
Then I suggest to close this thread,
If there is something else in the future, open a new thread and do not hesitate to ask.

You can easily expand your system with other Shelly 2PM Gen 3 devices, as follows:

1. Create a new virtual switch and a new virtual Temperature sensor. and note down their Domoticz indexes
2. in the Change node in Node Red, add another key/value pair.
3. Insert the ClientID of the Shelly 2PM Gen 3 after the flow
4. Insert the index of the Domoticz Switch and the index of the Domoticz Temperature sensor after the value as an object
as follows: {"sidx": 1234, "tidx": 5678}
5. Leave all other nodes unchanged.

Then it should work immediately

Regards
Daro1003
Posts: 181
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 »

It turns out that the topic is still relevant.

When using the last flow with the temperature sensor, it turns out that this flow introduces some interference into the operation of other devices controlled by domoticz.

I noticed that the lighting control, which is implemented via the PIR motion sensor and Sonoff - communication via MQTT, does not work.

Motion sensor -> Satel Integra -> Satel plugin -> AFE Sonof 4ch
After turning on the flow without the temperature sensor, everything works ok.
User avatar
FireWizard
Posts: 1886
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 turns out that the topic is still relevant.
That's okay for me.
I noticed that the lighting control, which is implemented via the PIR motion sensor and Sonoff - communication via MQTT, does not work.
and
Motion sensor -> Satel Integra -> Satel plugin -> AFE Sonof 4ch
After turning on the flow without the temperature sensor, everything works ok.
These 2 are the same?

I don't think it is related to the flow.

You did not mix Domoticz idx numbers?

The only relationship between this Motion sensor and the Shelly device is that they both use MQTT.

Can you compare the configuration of the MQTT output nodes, regarding QoS and Retain of both MQTT nodes (with and without Temperature)

See also: viewtopic.php?p=323871&hilit=Daro1003#p323871

Let me know.

Regards
Daro1003
Posts: 181
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 returned to the topic yesterday.

I checked the settings - everything is ok.
IDX-ynie pomylone.png
IDX-ynie pomylone.png (12.46 KiB) Viewed 287 times
ustawienia.png
ustawienia.png (16.32 KiB) Viewed 287 times
The only difference is that in the temperature flow there were "debug" nodes - I removed the debug nodes.

I turned on the flows with temperature and it was ok.

This morning, none of the lighting controllers from the sensor are working anymore.

I turned off the flows with temperature.

I turned on the flow without temperature and everything started working normally.
User avatar
FireWizard
Posts: 1886
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 said:
I checked the settings - everything is ok.
No, it is not. If it was okay, everything should function, as intended.

If you look to your second picture, you will see that the name of the Server is "Raspberry Pi 1".

That is exactly the name of the server in my test configuration.

You told me once, that your Domoticz and your Mosquitto MQTT broker run on the same hardware, and that is probably
not a Raspberry Pi 1, as Domoticz abandoned the Pi1 (armv6) already a long time ago.

In almost every post (and sorry, not the last one), I returned to you, I said:
Do not forget to configure your own MQTT parameters.
So, if you configure your own MQTT parameters it will work for all devices that communicate by MQTT.

Let me know.

Regards
Daro1003
Posts: 181
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 »

Everything is on Raspberry PI 3B+ and the server name is just the name of Pi 1 where the number 1 was supposed to mean the configuration ordinal number, I have never even had a Raspberry P1 in my hands.

In both cases with and without temp the server name is the same.

Without temperature:
Respberry Pi1 bez temp.png
Respberry Pi1 bez temp.png (26.88 KiB) Viewed 250 times
with temperature:
Respberry Pi1 z temp.png
Respberry Pi1 z temp.png (29.29 KiB) Viewed 250 times
User avatar
FireWizard
Posts: 1886
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;
Everything is on Raspberry PI 3B+ and the server name is just the name of Pi 1 where the number 1 was supposed to mean the configuration ordinal number, I have never even had a Raspberry P1 in my hands.
Sorry, that I misinterpreted that picture, as that picture is just a copy of mine, but I have a different configuration.

Just for debugging, I have to know a couple of things.

1. Do you have more devices communicating with the MQTT Broker on IP address 192.168.0.40?, than the Shellies and
the Tasmota devices?

2. How many MQTT config nodes do you have (Check the "Hamburger" menu and then "Configuration nodes") for "mqtt-broker"?

3. Can you disable the MQTT nodes, marked "Shelly Cover Status Out" and "domoticz In" and test your Lighting?

4. Does the Tasmota device to Domoticz also use Node-RED?

Regards
Daro1003
Posts: 181
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. Do you have more devices communicating with the MQTT Broker on IP address 192.168.0.40?, than the Shellies and
the Tasmota devices?
YES:
- Tasmota
- Shelly
- Sonoff 4ch soft lighting controllers AFE https://afe.smartnydom.pl/pl
- The Satel Integra alarm system probably also communicates via a broker, but there is a special plugin for this in Domoticz.
2. How many MQTT config nodes do you have (Check the "Hamburger" menu and then "Configuration nodes") for "mqtt-broker"?
WęzłyKonfiguracji.png
WęzłyKonfiguracji.png (24.21 KiB) Viewed 224 times
3. Can you disable the MQTT nodes, marked "Shelly Cover Status Out" and "domoticz In" and test your Lighting?
YES - in flow with temperature ?
The lighting only stops working after some time. After turning on the flow with temperature for some time everything works fine after some time the lighting which is turned on by the sensor of the satel alarm system stops working.
4. Does the Tasmota device to Domoticz also use Node-RED?
No - Tasmota uses the Tasmoticz plugin
User avatar
FireWizard
Posts: 1886
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,

1. So Tasmota, Shelly and the Sonoff uses MQTT?

2. You have 5 configuration nodes, but, I assume, you have only one MQTT broker (Mosquitto) installed on the same RPi3+
with IP address 192.168.0.40.. Am I correct?

If so, I recommend to delete the unused Configuration nodes. that are the one with "0" behind it and with the name "Do Domoticz" and
"Przeplyw do Do..." Then there remains 3. What are the other 2 (Z.Rekuperatora and Shelly) doing?

Do they point to the same broker? If yes, change that and remove then to 2 (now) unused configurations.
That makes it much simpler and clearer.

3. Yes, In the flow with the temperature included, but do one thing at the time. one thing and then testing.
The lighting only stops working after some time.
Some time after what (How long?)
After turning on the flow with temperature for some time everything works fine
How long?
after some time the lighting which is turned on by the sensor of the satel alarm system stops working.
Does that mean, that it is possible that the Satel switches the light "On" immediately that the Shelly flow has started?
And some time later it stops functioning?
Or is the light switched "Off" .

Can you install MQTT Explorer?. See: https://mqtt-explorer.com/

4.Okay. So you use https://tasmota.github.io/docs/Domoticz/?

I hope you can answer, as I still believe, it has nothing to do with this new flow.

Regards
Daro1003
Posts: 181
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. So Tasmota, Shelly and the Sonoff uses MQTT?
Yes, everything after MQTT
2. You have 5 configuration nodes, but, I assume, you have only one MQTT broker (Mosquitto) installed on the same RPi3+
with IP address 192.168.0.40.. Am I correct?
YES - only one broker installed on the same raspberry as Domoticz IP 192.168.0.40
If so, I recommend to delete the unused Configuration nodes. that are the one with "0" behind it and with the name "Do Domoticz" and
"Przeplyw do Do..."
Nodes removed.

In NodeRed I have only two flows.

1. Recuperator - Domoticz
2. Shelly - Domoticz.
What are the other 2 (Z.Rekuperatora and Shelly) doing?
Reku-Domoticz2.png
Reku-Domoticz2.png (34.81 KiB) Viewed 177 times
Reku-Domoticz.png
Reku-Domoticz.png (30.88 KiB) Viewed 177 times
Shelly-Domoticz2.png
Shelly-Domoticz2.png (60.02 KiB) Viewed 177 times
Do they point to the same broker? If yes, change that and remove then to 2 (now) unused configurations.
That makes it much simpler and clearer.
Which nodes should I remove? To avoid breaking something??

After how long does it take for the lighting to stop working - hmm, I don't know. I turned on the flow at around 7pm, everything was fine. In the morning, at 6am, the lighting doesn't turn on anymore. I sit down at the computer, turn off the flow with temp, turn on the flow without temp and the lighting starts working.

The sensor turns on the lighting for a set time. This is controlled by the dzvents script:

Code: Select all

return {
    on = {
    devices = {
      'Szatnia',    -- nazwa wlacznik w domoticz 
      'Oswietlenie Szatni' -- nazwa czujnika w domoticz
    }
  },
  data =
    {
        warunek = { initial = false },
    },
    	logging =   
    {
        level = domoticz.LOG_DEBUG, 
        marker = 'PIR Lampa',
    },
  execute = function(dz, item)
        
        local maxSeconds = 90
        local motion = dz.devices('Oswietlenie Szatni') -- nazwa czujnika 
        local switch = dz.devices('Szatnia') -- nazwa włacznika

        if item == motion then -- detekcja aktywna
          if motion.active and not switch.active then -- detekcja wyzwala skrypt
            dz.data.warunek = true
            switch.cancelQueuedCommands()
            switch.switchOn().checkFirst()
          elseif motion.active and switch.active and dz.data.warunek == true then
            switch.cancelQueuedCommands()
          elseif not motion.active and dz.data.warunek == true then 
            switch.switchOff().afterSec(maxSeconds).checkFirst()
          end
        elseif item == switch and item.active and not motion.active then 
          dz.data.warunek = false
        end
    end
}
Daro1003
Posts: 181
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 can describe the Satel - Domoticz communication because it is a bit complicated because the Satel alarm system communicates with Domoicz via the "Satel Integra via LAN interface" plugin. In Domoticz, the movement from the sensor is seen as follows:
okno-garasż.png
okno-garasż.png (13.89 KiB) Viewed 175 times
That's why I created events in Domoticz to turn signals 1 and 3 into ON and OFF signals for each motion sensor and for each reed switch on a window or door:
konwert.png
konwert.png (31.57 KiB) Viewed 175 times
Communication Alarm System Satel - Domoticz also generates some errors in the logs but it has been like this for 3 years - unfortunately the plugin author will not fix it and the communication works so it is ok.

Maybe you have an idea to convert the Satel - Domoticz communication via NodeRed?
User avatar
FireWizard
Posts: 1886
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,

Okay, now I know more.

We continue with some housekeeping.

1. See you picture, marked as "Reku-Domoticz2.png"
Edit the MQTT output node, marked "MQTT Domoticz", by double clicking on it.
Change the name of the server from "Z Rekuperatora" to "Raspberry Pi 1" (click on the "down" arrow).
The config node shows "0".

Test it!!
If it works you may want to delete the config mode, as you did before with the other 2.

2. Do not touch your modbus configuration, marked "Reku".

3. See you picture, marked as "Shelly-Domoticz2.png".
Edit the MQTT output node, marked "Shelly Cover Command Out", by double clicking on it.
Change the name of the server from "Shelly" to Raspberry Pi 1 (click on the "down" arrow)
The config node shows "0".

Test it!!
If it works you may want to delete the config mode, as you did before with the other 2.

4. Some cosmetics
Correct the typo's in the "Comments" nodes ==> Change Domotcz to Domoticz.

I do not believe that this flow for the Blinds has any impact on the correct functioning of the Satel Integra Intruder Alarm System.

I think that there is some strange misbehavior in the Plug-In I even think that it will also stop working if you turn it around. Start without the temperature and start with temperature of even restart the flow with temperature.
I think restarting (What do you really mean with that, rebooting your Pi or stop/start Node RED) causes a trigger and then it runs for some time.
As you showed me. your Satel is not even using Node RED, so that can't be the problem.

This afternoon, I spend some time with reading and I found that moere users and also yourself has trouble with the Satel integration, before we started creating a flow for these Shellies. See: viewtopic.php?t=4260&hilit=Satel+Integra.
I read a lot of problems, with switches (not) turning on or off.

So this Shelly 2PM should now be okay.
Maybe you have an idea to convert the Satel - Domoticz communication via NodeRed?
Yes, I have a number of idea's but I do not want to pollute this topic, so I suggest to open a new thread with Integration of Satel Integra,
using Node RED. As I see that old topic, maybe other Domoticz users are interested as well.

Let me know the result,

Regards
Daro1003
Posts: 181
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 »

Managed to clean up in NodeRed:
Posprzątane.png
Posprzątane.png (64.64 KiB) Viewed 111 times
The photo shows three flows:
1. Vents recuperator - Domoticz active flow
2. Shelly PM2 GEN 3 - Domoticz without temperature - not active
3. Shelly PM2 GEN 3 - Domoticz with temperature sensor - active on.

You asked what causes the lighting to stop working and why it starts working again.

So if the lighting control from the PIR sensors stops working, I turn off flow no. 3 and turn on flow no. 2 and that's it, the lighting control starts working after turning off flow 3.

After removing unnecessary nodes, I haven't tested the lighting yet - I'm doing that now, I'll let you know tomorrow if cleaning did anything.
Maybe you have an idea to convert the Satel - Domoticz communication via NodeRed?

Yes, I have a number of idea's but I do not want to pollute this topic, so I suggest to open a new thread with Integration of Satel Integra,
using Node RED. As I see that old topic, maybe other Domoticz users are interested as well.
I would like to go in this direction because the current integration is not working completely correctly. I am open to testing new solutions.
I do not believe that this flow for the Blinds has any impact on the correct functioning of the Satel Integra Intruder Alarm System.
It certainly has no effect on the Satel system, but it does affect the light bulb.

It works like this:

1. The Satel PIR sensor detects movement and transmits information to the Satel control panel, which transmits information to Domoticz via the ETHM module connected to the LAN switch.

2. Domoticz transmits information to the Sonoff 4ch controller via the dzvents script to turn on the light bulb.

I suspect that somewhere along the way this communication stops working.
User avatar
FireWizard
Posts: 1886
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,
Managed to clean up in NodeRed:
Okay, that looks better and I assume that everything works as before.
So if the lighting control from the PIR sensors stops working, I turn off flow no. 3 and turn on flow no. 2 and that's it, the lighting control starts working after turning off flow 3.
I do not understand, why that happens. The difference between "flow 3" and "flow 2" is that I added the following command to "flow 3", compared with "flow 2"

Code: Select all

msg2.payload = { "command": "udevice", "idx": tidx, "nvalue": 0, "svalue": msg.payload.temperature.tC.toString() }
Beside that, it only sends that command if the Switch position and/or the Temperature changes.

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"

Does the Lighting start?
msg2.payload = { "command": "udevice", "idx": tidx, "nvalue": 0, "svalue": msg.payload.temperature.tC.toString() }
We will come back, if this issue is solved, but, if I read that old post, I think your problem exists already much longer.
1. The Satel PIR sensor detects movement and transmits information to the Satel control panel, which transmits information to Domoticz via the ETHM module connected to the LAN switch.
As, you said, that should not have any effect on the Node RED flow.
2. Domoticz transmits information to the Sonoff 4ch controller via the dzvents script to turn on the light bulb.
I have to check that dzVents script, but Iḿ not a specialist on that. Do you know, who made that script?

Regards
User avatar
FireWizard
Posts: 1886
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,

Something more.

- How does Domoticz control your Sonoff device. i don't see a plug-in. MQTT?
- What software is the Sonoff running.

The reason, that I ask this, is that I read on vario8us fora that people has trouble with this device.
Don't know, if you have also similar trouble.

Regards
Daro1003
Posts: 181
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 »

- How does Domoticz control your Sonoff device. i don't see a plug-in. MQTT?
MQTT Client Gateway with LAN interface.
MQTT Client.png
MQTT Client.png (12.4 KiB) Viewed 91 times
- What software is the Sonoff running.
Sonoff has AFE software installed:
https://afe.smartnydom.pl/pl/pliki-to-p ... -wlacznik-
Don't know, if you have also similar trouble.
The light is not always turned off automatically by the Domoticz script, I don't know what causes it.

Turning on the light works almost always, but it will not always be turned off.
User avatar
FireWizard
Posts: 1886
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,
MQTT Client Gateway with LAN interface.
You have only 1 such an interface configured?

Can you show me the configuration.

I recommend to you, to install MQTT Explorer on your desktop or laptop, so that you can check what happens in MQTT.

Regards
Post Reply

Who is online

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