Shelly is a company located in Bulgaria. They make a ton of devices for the IoT market. They are very well known for their innovation and devices with an extreme good quality.
I came across the Shelly 2PM GEN4 device since I was looking for a switch with small dimensions to control my roller shutters.
In the mean time I bought 20 of those devices to control all my roller shutters (17 in total, but having some spare parts isn't a bad idea).
Below, you will find useful information about the Shelly 2PM GEN4 devices, but if you want to know more about Shelly in general, pls. visit the following web site:
https://www.shelly.com/
And also visit the Shelly shop to see what they have to offer. And it's a lot, really, a lot!
Note: I'm not affiliated in any way with Shelly, so I'm not earning a single eurocent if you buy something from them.
I was looking for a device that could control roller shutters. Mostly, Somfy is used as motor for roller shutters. At least, that's what I currently have in mind.
The motors in the roller shutters we want to install will be made by Somfy. One of the types of roller shutters from Somfy is the LT 50 WT range. WT stands for Wired Technology. It means nothing more or nothing less than 4 wires that are controlling the motor.
The Somfy LT 50 has two end switches: white and yellow. One will be used to indicate the UP end position and the other one will be used to indicate the DOWN end position.
To control the Somfy motor, 4 wires are connected to it.
The 4 wires are:
Ground
Neutral: goes directly to the motor
Red: related to the yellow button
Black: related to the white button
Those wires are connected to the line wires:
Green-yellow (earth wire) of the line to green-yellow of the Somfy motor
Blue (neutral wire) of the line to blue of the Somfy motor
Red (live wire) of the line to brown or black of the Somfy motor
Connecting the red live wire to one of the brown or black wires can be done by means of a manual toggle switch but in my case I will use a Shelly 2PM GEN4 device. This is the perfect device for that job!
The Shelly 2PM GEN4 device has two outputs which can be connected to the live wire of the mains. A front and back image of the Shelly device can be seen below this section. It has the following connections:
O1: first
L: live wire (2 connections)
O2: second output
S2: second input (optionally used)
S1: first input (optionally used)
N: neutral wire
I will use the switch with a 220V AC connection but the device can also be used with a 24V DC voltage.
The device is remotely controllable by means of the following protocols (not necessarily always available in all modes):
WiFi
Bluetooth
Zigbee
MQTT
Matter
The Somfy motor has two directions: clockwise (CW) or counterclockwise (CCW). There's a fixed relation between the rotation direction and the connection of the brown or black wire indirectly (via the motor, obviously) to the live wire of the net.
This is the relation:
CW rotation:
Connect the brown wire through the motor to the live wire
CCW rotation:
Connect the black wire throught he motor to the live wire
This way, depending on the location of the motor in the roller shutter construction (left or right) you can unambigously define the UP and the DOWN direction of the roller shutter.
When you activate a Shelly 2PM GEN4 device for the first time, the internal AP is started up.
If the device is already in service, then normally the internal AP is already switched off (this is done automatically by the Shelly SW itself if you don't specify a password for the AP within a certain amount of time after startup). You can switch on the internal AP again later if you press the button at the back of the device for 5 seconds or more (but no more than 10 seconds, else the device goes back to factory mode!)
Wait some time (yes, it can take a while) and go to the network overview section of your PC (the monitor icon located in the task bar). Check if you see something like this appearing in the list of Wi-Fi access points:
Shelly2PMG4-ACEBE6EB73EC
Note that the hex value at the end is the MAC address of the device, so it is unique.
Once you see this, connect to that AP. No need for username or password, the AP is completely open.
Once connected, go to the IP address 192.168.33.1 in your browser: this is the default IP address of the Shelly AP.
In the welcome screen you will see a link to Configure Wi-Fi settings. Click on that link.
You will end up in the section Wi-Fi 1 settings.
Fill in the SSID of the Wi-Fi network/AP you want to use as well as the password for that AP.
Click the Save settings button: the Enable W-Fi button of the section Wi-Fi 1 settings will be activated.
After a short time, you will see the IP address assigned to this Shelly device in the section Wi-Fi status. Note down the IP address!
From now onwards you can disconnect from the Shelly AP. Then use the assigned IP address to go to the Shelly web UI.
Note: I've seen the Shelly device is trying to connect to the new IP address itself. However, I had to forcefully reload the page before I got the web UI of the device.
I've encountered issues with the above procedure. I had Shelly's which, after a fresh startup, did not connect to the IP address 192.168.33.1.
I asked the help of Gemini AI and there was a prefect solution given. The reason seems to be that, since the PC is wired to subnet 192.168.1.x, at times it can be that a device on another subnet (here: 192.168.33.1) is not able to connect to the PC. The DHCP server of the Shelly gives an address the moment it's requested by the PC, but the PC doesn't always takes the given IP address into account.
The solution is the following:
Press the Windows-R button: The Run window will open
Type ncpa.cpl: the network window will open and you will see all the network connections (be it active or not), including the Wi-Fi one
Right-click on the Wi-Fi one and select Properties
Select Internet Protocol Version 4 (TCP/IPv4) and then select Properties.
In the next screen, select Use the following IP address and fill in the following values:
IP address: 192.168.33.2
Subnet mask: 255.255.255.0
Default gateway: 192.168.33.1
Press OK to activate the new settings.
If you now point to 192.168.33.1 in the browser, you will see the web UI page of the Shelly in which you can perform the initial settings.
Note: it's sometimes interesting to leave the Network Connections dialogue view open and have a look to the Wi-Fi connection. Each time you switch to another AP (be it the Shelly AP or one of your internal AP's), you should see the name of the AP appearing in the Wi-Fi connection area.
See section "Initial settings after first connection with a Shelly 2PM GEN4 device" for details about the initial settings.
If all of the above is not working, then there's still the possibility to use the Shelly app on the smartphone in combination with Bluetooth.
Add the device using BT and follow the guidelines on the app itself. You will have to connect to the WiFi AP and pass SSID + password.
If all goes fine, you will get connected to the AP. Then you can come back to the browser and use the IP address assigned during the BT session.
In your modem or - in case of a Deco X50 system - in your smartphone, change the address reservation for this Shelly device to the IP address of your choice, so that the Shelly always gets the same IP address.
Check for SW updates
Click Settings -> Firmware (under the section Device settings)
Click Check for updates
Install the updates (2.1.0 as of this writing; there's also a beta but I didn't pick that one yet)
Once you clicked Update you will see a progress bar at the top of the screen
After a reboot, refresh the page to see the new web UI
You will see a few warnings:
Motor connection:
Since we're using it for roller shutters we HAVE to be in Cover mode. To be sure, click the Switch button.
If the mode is Cover (which it apparently is when the device is new), nothing has to be done.
Network Connected:
Since the AP and BT are open, they will be disabled after a certain amount of time, unless you secure them with a password.
I ignore this and let the system shut down the AP and BT after the predefined time since I'm not interested in them.
The only disadvantage of not having the AP up and running is that the router functionality of the Shelly switch will also be disabled.
While still in Settings, switch to Zigbee mode
Click on Switch to alternative firmware and choose Switch to Zigbee.
Once clicked, a progress bar will again be visible at the top of the page. Once the conversion is done, the device will reboot.
Switching to Zigbee will reset the device parameters but will keep the Wi-Fi settings (IP address) intact. So, you can always access the device through Wi-Fi.
Note: first switch to Zigbee before modifying other settings. Switching the firmware to Zigbee resets the device profile and all settings (except Wi-Fi).
While still in Settings, disconnect from the cloud if not done yet.
We don't want "big brother is watching you" situations.
While still in Settings, change the name
Cover (0) is the default name, adapt to your own taste (e.g. Shelly-xx)
While still in Settings, check the Location and Time
Location:
Timezones: Europe/Brussels
Latitude: xx.xxxxxx
Longitude: xx.xxxxxx
Time format:
24 hour format
Date format:
YYYY-MM-DD
To change typical cover settings, click on the cover name (default: Cover (0)) to open the cover settings.
Name
Specify a meaningful name to indicate which roller shutter (when in cover mode) or circuits (when in switch mode) is controlled by the Shelly switch
Calibration
When the Shelly switch is connected to the roller shutter, the following will happen when you start the calibration phase:
The roller shutter is completely opening or completely closing
The roller shutter is then going the opposite site until it is completely opened or closed. In the meantime, the time is measured (e.g. the time to completely open the roller shutter)
The roller shutter is then again going the opposite site until it is completely opened or closed. The time is measured again (e.g. the time to completely close the roller shutter)
The roller shutter is then going to move in different intervals (10, to be precise) in a certain direction (e.g. going to completely open the roller shutter). The time is again measured.
The roller shutter is then going to move in different intervals (10, to be precise) in a certain direction (e.g. going to completely close the roller shutter). The time is again measured.
Once this is done, the Shelly device will be able to open or close the roller shutter in a range from 0% (completely closed) to 100% (completely opened)
Reverse directions
If the direction of the roller shutter motor is wrong (e.g. the roller shutter is going down instead of up), you can do two things:
change the wires connected to O1 and O2 of the Shelly switch
the more easy way: change the directions through SW so that the roller shutter is going the correct direction
Movement time limits
The maximum time the roller shutter will move up or down until it stops moving any further. The default is 60 seconds for both directions, which means the roller shutter will not be active for a time longer than 60 seconds.
Important: Those values are only valid for as long as the roller shutter has not been calibrated.
What does this mean in case the calibration is not done yet?
Suppose the roller shutter is almost in its open position and you press the open button. The roller shutter will start moving to its open position but since the roller shutter was already almost open, that won't take long (max. a few seconds). Still, it will take until the full 60 seconds are over before the internal relay of the Shelly switch will be switched off again.
In se, that is not harmful since the internal microswitches of the roller shutter motor will prevent any further movement when the roller shutter is in a complete open or close posistion, but it's in fact useless to put power on the lines while it's not useful anymore...
If the Shelly switch is calibrated, however, the relay will go back to its off posistion shortly after the roller shutter has reached its full open or close position!
Action on power on
Here you can define what should happen if power comes back after a power outage. I think the default value (Stopped, do nothing) is the safest.
Idle motor settings
With the idle settings you can set two parameters:
set the wait time before the motor changes direction, a kind of "rest" time; the default is only 0.25 seconds which to me is very short. I prefer 1 second instead.
set the power threshold at which value the motor is considered stopped: I leave the value of 2 as-is.
Cover input settings:
Here you can define what type of buttons will be connected to S1 and/or S2, how many inputs will be used and so on
Input types: select "Button" since that's a momentary action. "Switch" is a fixed state which I don't want (when you release the button, it should come back to its initial state, not stick to its active or passive state)
Control button mode: since I'm planning to use both inputs, the setting must be "Dual" (default)
Swap inputs: software wise change S1 and S2, not interesting...
Rest is irrelevant
Obstacle detection
The switch is constantly measuring the power consumed by the roller shutter motor. To know if an obstacle is blocking the roller shutter you can specify from which wattage onwards it's seen as an obstacle, since the engine has to start using more power to move the roller shutter.
I still need that value from the manufacturere, but 1000W (default value) is way too much. I'll keep it to 200W for the moment.
The rest of the options for obstacle detection speak for themselves...
That's it, the Shelly device should now be ready to be detected by Z2M. In the past, you had to fiddle with the button on the Shelly device. You had to press the button 3 times to put the device in pairing mode.
This is not needed anymore! There's a software way to do this, which makes pairing with Z2M much, much more easy and convenient.
To get the device paired, go to the Zigbee section on the web UI page of the Shelly device. You can find this in the left sidebar (on the condition that the device is indeed already set to Zigbee mode!).
On that web page, press the button Start pairing et voila! The paring session is started. Make sure Z2M is also in pairing mode, otherwise it won't result in a successful pairing!
If the pairing was successful you will see "joined" next to the Connection Status line on the Zigbee web UI page of the Shelly device.
Once all initial settings are given it's time to connect the Shelly switch to Home Automation.
You have two choices to connect to Home Automation:
Using Wi-Fi
Using Zigbee
The two methods are given below.
Go to Settings, then select Devices & services: you should see all the new Shelly switches added.
Click on the Shelly switch you want to add and then click the Submit button on the next popup window.
You will be asked for the location of the Shelly switch. Once this is filled in, the switch is added to Home Assistant.
See end of previous section on how to do this, to avoid repetition of the use case...
Note: only one protocol should be used to communicate with the Shelly devices. Since they're mainly developped for WiFi communication, WiFi is the preferred communication method. Unless you have good reasons to use Zigbee, don't use it...