In DOMIQ we advocate for cable building automation installations, which ensures high reliability of data transmission.
However, there are use cases, when making a cable installation is not (longer) possible. To face such situations we decided to add integration with Shelly devices.
1.1. Communication
Shelly devices allows integration over HTTP API or using the MQTT standard. Considering the fact, that HTTP API re- quires constant data polling, we decided to use the MQTT which is bi-directional by default.
For the purposes of integration with Shelly, we made our own implementation of the MQTT broker. In its current form, the broker is partially compatible (not yet fully compatible) with the MQTT 3.1.1 standard. At this stage, it han- dles communication with QoS equal to 0 and requires the Clean Session option enabled for each connection. More information on the MQTT standard is available on the Internet.
1.2. Configuration
The very first step is the correct configuration of Shelly modules.
Network Settings
Shelly modules work in Access Point mode by default – so each module creates its own local WiFi. The first step is to disable Access Point mode and connect Shelly module to your local WiFi.
- Connect to a network created by a Shelly module.
- Open the web UI in the web browser (see Shelly user manual for the default IP address).
- In the Internet & Security (gen. 1 devices) or in the Networks section (gen. 2 devices) enter network settings that allow the module to connect to your local WiFi. We recommend setting a static IP address or creating IP bin- ding based on module’s MAC address (this has to be done in the router settings).
- Save settings and reopen web UI using the IP in your network.
MQTT Settings
The next step is configuration of a MQTT server, to which the Shelly module will connect. The configuration is sligh- tly different for Shelly 1st and 2nd generation devices, so we will describe configuration separately.
Gen. 1 Devices
1. Navigate to the Internet & Security -> Advanced – Developer Settings 2. Check the Enable MQTT option.
3. Fill the following fields of the form:
- Server – Enter the IP address of your Base module and the default MQTT port – 1883 separated with colon. Example: 192.168.1.100:1883
- Enable the Use custom MQTT prefix option and in the field below enter a name of your Shelly module. The entered name must be unique in the entire installation.
- Enable the Clean Session option.
- Set the Max QoS to 0.
- Click the Save button to save changes. To apply changes a reboot is required (you’ll be notified about that by theShelly intefrace).
- Shelly module is now ready to use.
Gen. 2 devices
1. Navigate to the Networks -> Mqtt 2. Enable the Enable option.
3. Fill the following fields of the form:
- Connection type: MQTT
- In the next field enter a name of your Shelly module. The entered name must be unique in the entireinstallation.
- Enable the RPC status notifications over MQTT option.
- In the textfield below, enter the IP address of your Base module and the default MQTT port – 1883 separatedwith colon. Example: 192.168.1.100:1883
4. Click on the Apply button to confirm the changes.
5. Shelly module is now ready to use.
Additional SettingsAt this stage, the Shelly module is ready to be controlled by the DOMIQ/Base. Other settings such as input type, schedules, etc. should be configured as needed.
1.3. DOMIQ/Base configuration
In DOMIQ/Base’s configurator navigate to the Settings tab and then enable MQTT and Shelly options. Next save theSettings tab and reboot the module.After rebooting, Base is ready to control Shelly devices. Shelly modules will automatically connect to Base – no addi- tional actions are required. Parameters read from Shelly modules will automatically appear in the State tab.
1.4. Commands and State
As mentioned before, there are two generations of Shelly devices. Apart from the hardware differences, they also use different integration protocol. The integration protocol used by the gen. 2 devices is unified for all modules, whi- le the first generation of devices vary a lot in terms of parameters that can be read as well as commands that can be sent to modules.
General Guidelines
- All the described commands and state identifiers represent a generalized syntax and contains fragments that have to be replaced with data specific for a particular Shelly module. Those fragments are enclosed in angle brackets: <some_value>.
Example: SHELLY.<name>.relay.<0-1>=<command_value> - Relays numbering in Shelly starts at 0. So when a module has only one relay then its index is 0.
- The same rule applies to binary inputs. Binary inputs can be used to connect wall switches, motion sensors andother devices that are capable to control the input contacts.
In the Base module we implemented support for the following Shelly devices:
Generation 1:1. 1/1PM/1L
2. 2/2.5
3. Plug/PlugS
4. Dimmer 1/2
5. RGBW2 (only the White mode) 6. Uni7. TRV
8. Vintage
9. H&T
10. Smoke
11. Flood 12.Door/Window 1/2 13. Motion
14. Sense
15. Button1
16. I3
17. Gas
18. EM
19. 3EM
Generation 2:
1. Plus 1/1 PM
2. Plus 2 PM
3. Plus I4
4. Pro 1/1 PM
5. Pro 2/2 PM
6. Pro 4 PM
Generation 1 1/1PM/1L
Actor module with one relay and one binary input. Shelly1PM also includes energy metering.
2.5
Module conains two relays with energy metering and two binary inputs. Shelly 2.5 can operate in two distinct mo- des: Relay and Roller Shutter.
Plug/PlugS
Controlled outlet with energy metering.
Dimmer 1/2
Module with dimmable output for lighting control with a single binary input.
RGBW2 (only White mode)
Four-channel LED driver (12/24V). Each channel can be controlled independently. Module is also equiped with a sin- gle binary input.
Uni
Module with two binary inputs and two potential-free outputs.
TRV
Smart thermostatic radiator valve.
Vintage
Dimmable LED bulb
H&T
Wireless temperature and humidity sensor.
Smoke
Wireless smoke detector.
Flood
Wireless flood detector.
Door/Window 1/2
WiFi-connected door and window sensor with luminance measurement.
Motion
Wireless motion detector with luminance measurement.
Sense
Universal room sensor with IR transmitter to control air conditioners, TV sets, audio devices etc. Sending IR codes is not available over MQTT, so this function is not available in Base module. However it’s available using Shelly app, HTTP API or using Shelly web UI.
Button1
A WiFi button which can detect and announce 4 types of button presses – short, 2x short, 3x short, long. As an option it can be connectted via USB for constant power supply and Wi-Fi connection. Response time of less than 2sec. on battery and 100 ms on USB power.
i3
Module with three binary inputs. Each input can detect six different types of actions.
Gas
LPG or CNG gas detector.
EM
Shelly EM measures electrical consumption on two channels (shared phase) and allows for controlling one low-po- wer external appliance.
3EM
Shelly 3EM is a professional 3-phase energy meter.
Generation 2
The “Plus” Series
The Plus series consists of 2nd generation modules intended for installations in electrical boxes.
Plus 1/1 PM
Actor module with one relay and one binary input. Shelly Plus 1PM also includes energy metering.
Plus 2 PM
Module contains two relays with energy metering and two binary inputs. Shelly Plus 2PM can operate in two distinct modes: Relay and Roller Shutter.
Relay Mode
I4
Module with four binary inputs.
The “Pro” Series
The Pro series modules are designed for installation on DIN-rail in electrical cabinets. Modules are equiped with LAN, WiFi and Bluetooth connectivity.
Pro 1/ Pro 1PM
Actor module with one relay and two binary inputs. Shelly Plus 1PM also includes energy metering.
Pro 2
Actor module with two relays and two binary inputs. Shelly Plus 1PM also includes energy metering.
Pro 2 PM
Din-mounted module with two relays with energy metering and two binary inputs. Module can operate in two di- stinct modes: Relay and Roller Shutter.
Commands, state parameters and events are identical as for Plus 2 PM module.
Pro 4 PM
Din-mounted module with four relays with energy metering and four binary inputs.
Commands, state parameters and events are identical as for Plus 1/1 PM module, with the difference that the num- bering range of relays and inputs is from 0-3.