Skip to content

About

Matterbridge shelly plugin

Resources

Code of conduct

Contributing

Stars

142 stars

Watchers

9 watching

Forks

Latest commit

 

History

931 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matterbridge Logo   Matterbridge shelly plugin    Shelly logo

npm version npm downloads Docker Version Docker Pulls Node.js CI CodeQL codecov tested with Vitest styled with Oxc linted with Oxc TypeScript Native ESM matterbridge.io

powered by powered by powered by


This plugin allows you to expose all Shelly Gen 1, Gen 2, Gen 3, Gen 4 and BLU devices to Matter.

Features:

  • Shellies are automatically discovered using mDNS.
  • Shelly wifi battery-powered devices are supported.
  • Shelly wifi battery-powered devices with sleep_mode are supported. If they don't report in the last 24h, they are considered offline.
  • Shelly BLU devices are supported through local devices configured as ble gateway.
  • Discovered shellies are stored in local storage and cached for fast loading on startup.
  • The components exposed are Light (with brightness and RGB color), Switch, Relay, Roller, Cover, PowerMeter, Temperature, Humidity, Illuminance, Thermostat, Button and Input.
  • Gen 2+ covers with slat control enabled (e.g. venetian blinds on a Shelly 2PM Gen3) also expose the tilt position. Enable and calibrate the slat control in the Shelly app or web page first, then restart Matterbridge.
  • PowerMeters expose electrical measurements with the electricalSensor device type, supported by Home Assistant and partially by SmartThings and Apple Home. Available readings depend on the controller and its software version.
  • Shelly devices report Matter test vendor ID 0xfff1 and product ID 0x8000, allowing Home Assistant to use ha_entitylabel endpoint labels when provided.
  • Devices expose Grid/Battery semantic tags for their own power supply. These tags do not classify the circuits measured by power meters.
  • Shellies are controlled locally, eliminating the need for cloud or MQTT (which can both be disabled).
  • Shelly Gen 1 devices are controlled using the CoIoT protocol (see the note below).
  • Shelly Gen 2, Gen 3 and Gen 4 devices are controlled using WebSocket. Starting with release 2.6.0, it is possible to use RPC over UDP instead of websocket.
  • The Matter device takes the name configured in the Shelly device's web page (each Shelly device must have a different name).
  • Each device can be excluded or included using its name, id or mac address. Refer to the COMPONENTS.md documentation.
  • Device components can be blacklisted globally or on a per-device basis. Refer to the COMPONENTS.md documentation.
  • Devices ids can be selected from a list in the config editor or in the Devices panel on the Home page.
  • If the device has a firmware update available, a message is displayed in the log.
  • If the device's CoIoT protocol is not correctly configured for the gen 1 devices, a message is displayed.
  • If the device's Outbound websocket settings is not correctly configured for the gen 2+ battery powered devices, a message is displayed.
  • If the device cover/roller component is not calibrated, a message is displayed.
  • If a device changes its ip address on the network, a message is displayed and the new address is stored.
  • A 1 hour timer checks if the device has reported within that time frame, fetch an update and save the cache file.
  • Support for RPC over UDP update protocol (alternative to websocket) for Gen2+ devices.
  • If the device's RPC over UDP settings is not correctly configured for the gen 2+ devices, a message is displayed.
  • Support for Secure Connection with https:// and wss:// for Gen2+ devices. Use caBundlePath and rejectUnauthorized.
  • Support for Range Extender for Gen2+ devices. It is also possible to manually add a device in the config.

If you like this project and find it useful, please consider giving it a star on GitHub at https://github.com/Luligu/matterbridge-shelly and sponsoring it.

Buy me a coffee

Sponsors

This project was proudly sponsored by:

Shelly logo

Acknowledgements

I would like to express my appreciation to Tamer Salah for his invaluable contribution to this project. His expertise and assistance have been instrumental in its success. You can sponsor Tamer here https://buymeacoffee.com/6sjde6vkzl.

Prerequisites

Matterbridge

See the complete guidelines on Matterbridge for more information.

Any shelly device

A shelly device gen. 1 or 2 or 3 or 4 or BLU.

How to add a device

Verify that enableMdnsDiscover and enableStorageDiscover are selected in the plugin configuration. Restart matterbridge in case these options were not flagged and the devices will be discovered.

Follow these guidelines for specific devices.

Add Gen. 1 devices

  • CoIoT: the CoIoT (coap) service must be enabled in the settings of the device and the CoIoT peer must be mcast. If mcast is not working on your network put in the peer field <matterbridge-ipv4>:5683 (where <matterbridge-ipv4> is the ipv4 address of Matterbridge e.g. 192.168.1.100:5683). You can find the matterbridge ipv4Address address in the frontend or in the log. Multicast may not work for all networks due to router or access point configuration or network topology (I cannot help you on this, just check your router or access point configuration). If CoIoT is not configured correctly you will not receive any update from the device.

Add Gen. 1 battery-powered devices

  • First check that enableMdnsDiscover and enableStorageDiscover are flagged in the plugin configuration. If they are not, enable them and restart matterbridge. Then awake the device you want to register pressing the device button. It is also possible, when CoIoT is correctly configured, to just wait for the device to awake and it will be registered automatically.

Add Gen. 2 or 3 or 4 battery-powered devices

  • First check that enableMdnsDiscover and enableStorageDiscover are flagged in the plugin configuration. If they are not, enable them and restart matterbridge. Then awake the device you want to register pressing the device button and in the device web page go to Settings, then Outbound websocket and enable it, select "TLS no validation" and put in the server field ws://<matterbridge-ipv4>:8485 (where <matterbridge-ipv4> is the ipv4 address of Matterbridge e.g. ws://192.168.1.100:8485). You can find the matterbridge ipv4Address address in the frontend or in the log. It is also possible, when "Outbound websocket" is configured correctly, to just wait for the device to awake and it will be registered automatically. Starting with release 2.6.0, it is possible to use RPC over UDP instead of "Outbound websocket".

Add Gen. 4 devices

  • Matter: the integrated Matter component should be disabled to save network bandwidth and device resources (memory and energy consumption). Gen 4 devices are supported like any other Shelly device. The Matter component serves no purpose when you add them to Matterbridge.

Add BLU devices

  • BLU devices are supported through a local Shelly device acting as a ble gateway. To enable this feature, choose one or more devices that have the ble component and support the ble gateway (e.g. PRO, Gen 3 and Gen 4 devices). In the gateway device web page, enable both "Enable Bluetooth" and "Enable Bluetooth gateway" or "Enable RPC". Then, go to the "Components" section and add your BLU devices in "Bluetooth (BTHome) devices". Give a meaningful name to your device if desired and restart Matterbridge. See the full guide here: https://github.com/Luligu/matterbridge-shelly/blob/dev/BLU.md

How to configure RPC over UDP

In the Shelly device web UI go to "Settings", then "RPC over UDP", enable it and set the destination address to <matterbridge-ipv4>:8585 (where <matterbridge-ipv4> is the ipv4 address of Matterbridge, e.g. 192.168.1.100:8585). Set the listening port to 8585. You can find the Matterbridge ipv4Address in the frontend or in the log. When RPC over UDP is configured correctly, Matterbridge receives device updates and events directly over UDP and the WebSocket client is not connected for that device.

How to make the device IP address stable

There are two ways to have the wifi device IP stable:

  1. In your router configuration find, in the DHCP settings, the option to reserve an ip address for all your shelly wifi devices.
  2. In the device web UI (or Shelly app) go to Settings / WiFi and set a static IP for Wi-Fi 1 settings.

A stable IP address is mandatory for battery powered devices. I suggest to set it for all the other devices too.

How to install the plugin

With the frontend (preferred method)

Just open the frontend, select the matterbridge-shelly plugin and click on install.

Without the frontend

On windows:

cd $HOME\Matterbridge
npm install -g matterbridge-shelly --omit=dev
matterbridge -add matterbridge-shelly

On linux:

cd ~/Matterbridge
sudo npm install -g matterbridge-shelly --omit=dev
matterbridge -add matterbridge-shelly

Then start Matterbridge from a terminal

matterbridge

How to use it

You may need to set some config values in the frontend.

Changing configuration after the controller is already paired may cause the controller to see the device as new devices and reset their configuration. You may need to wait a few minutes that the controller reads again all endpoints.

Wait that the plugin has been configured before changing the config.

username

If your devices are password protected put here the username. It must be unique for all the devices.

It is only used for gen 1 devices. Gen 2+ devices have always admin.

password

If your devices are password protected put here the password. It must be unique for all the devices.

caBundlePath

Optional path to a PEM file containing the CA certificates used to verify your devices' server certificates. The file must be accessible to the Matterbridge process. Defaults to an empty string, which uses the runtime's default trusted CAs when verification is enabled. It must be unique for all the devices.

Use this when your devices use certificates issued by a private CA and rejectUnauthorized is true. This is a CA certificate bundle, not a client certificate or private key; it does not enable mutual TLS.

rejectUnauthorized

Controls server certificate verification for HTTPS and WSS connections to devices on port 443. Defaults to false, allowing connections without verifying the server certificate, including self-signed certificates. Connections remain encrypted, but the server's identity is not verified. It must be unique for all the devices.

Set to true to verify the certificate's hostname, validity, and trust chain. If your devices use a private CA, also set caBundlePath to its PEM bundle. These settings apply to the plugin's device connections with https and wss only; HTTP and WS connections on other ports are unaffected.

switchList

The devices in the list will be exposed as switches (don't use it for Alexa).

lightList

The devices in the list will be exposed as lights.

inputContactList

The devices in the list will expose the Input component as a contact sensor.

inputMomentaryList

The devices in the list will expose the Input component as a momentary switch.

In Matter a momentary switch is button that can be pressed or released.

inputLatchingList

The devices in the list will expose the Input component as a latching switch (latching switches are not supported by all controllers).

In Matter a latching switch is a switch that keeps its position open or closed.

blackList

If the blackList is defined the devices included in the list will not be exposed to Matter.

For shelly wifi devices use the device name (i.e. the name defined in the device web UI), the device id (i.e. shellyplus2pm-5443B23D81F8) or the device mac (i.e. 5443B23D81F8).

For shelly BLU devices use the device name (i.e. the name defined in the device gateway web UI) or the device mac addr (i.e. 7c:c6:b6:65:2d:87).

whiteList

If the whiteList is defined only the devices included in the list are exposed to Matter.

For shelly wifi devices use the device name (i.e. the name defined in the device web UI), the device id (i.e. shellyplus2pm-5443B23D81F8) or the device mac (i.e. 5443B23D81F8).

For shelly BLU devices use the device name (i.e. the name defined in the device gateway web UI) or the device mac addr (i.e. 7c:c6:b6:65:2d:87).

entityBlackList

The components in the list will not be exposed for all devices. Use the component name (i.e. Temperature).

The WebSocket component name is Ws (previously WS); update any manually configured WS blacklist entries to Ws. Its component ID remains ws.

For detailed examples, refer to the COMPONENTS.md documentation.

deviceEntityBlackList

The deviceEntityBlackList is a list of components that should not be exposed for a specific device.

In the first field, enter the device ID (e.g., shellyplus2pm-5443B23D81F8 for Wi-Fi Shelly devices or 7c:c6:b6:65:2d:87 for BLU Shelly devices). In the second field, list all the component names (e.g., Temperature) or component IDs (e.g., temperature:0) you want to exclude for that device.

For detailed examples, refer to the COMPONENTS.md documentation.

nocacheList

The devices in the list will not be loaded from the cache. Use the device id (e.g. shellyplus2pm-5443B23D81F8). This is only usefull if you change the device configuration from the device web ui or from the Shelly app (e.g. changing from color to white or from switch to cover or adding other BLU devices to a ble gateway) and don't want to wait the plugin to detect the change. In this case put the device id in the list and restart.

Manually add a device

If mDNS does not discover a device, use the plugin configuration’s Add device action. Enter the device IP address, or a full URL such as https://192.168.1.221:443 when a protocol or port is needed. Keep its IP address stable.

enableMdnsDiscover

Should always be enabled to discover new devices.

Once a device is discovered, it is added to the shelly storage.

Once all the devices are loaded and stored, it is possible to disable this setting to reduce the network traffic.

enableStorageDiscover

Should always be enabled to automatically add all the devices previously discovered.

resetStorageDiscover

Reset the storage on the next restart (it will clear the storage and the cache files).

enableBleDiscover

Should be enabled to discover the shelly BLU devices (it will register the BLU devices paired in each ble gateway, see https://github.com/Luligu/matterbridge-shelly/blob/dev/BLU.md for more informations).

failsafeCount

Enable the failsafe count of the devices registered. If the plugin registers less devices then the configured number, the plugin will go in error mode. This is to avoid to lose the controller configuration in case of network issues (default 0 = disabled).

postfix

Add this unique postfix (3 characters max) to each device serial to avoid collision with other instances (you may loose the configuration of the devices in your controller when changing this value or you may need to pair again the controller). Unless you have a complex setup with more then one controller and different instances of Matterbridge, don't use it.

debug

Should be enabled only if you want to debug some issue using the log. Only for development.

debugMdns

Should be enabled only if you want to debug some issue with mdns using the log. Only for development.

debugCoap

Should be enabled only if you want to debug some issue with CoIoT using the log. Only for development.

debugWs

Should be enabled only if you want to debug some issue with the WebSocket client or server using the log. Only for development.

debugUdp

Should be enabled only if you want to debug some issue with the RPC over UDP server using the log. Only for development.

unregisterOnShutdown

Should be enabled only if you want to remove the devices from the controllers on shutdown. Only for development.

Config file

These are the config values:

{
  "name": "matterbridge-shelly",
  "type": "DynamicPlatform",
  "username": "<USERNAME>",
  "password": "<PASSWORD>",
  "switchList": [],
  "lightList": [],
  "inputContactList": [],
  "inputMomentaryList": [],
  "inputLatchingList": [],
  "blackList": [],
  "whiteList": [],
  "entityBlackList": [],
  "deviceEntityBlackList": {},
  "nocacheList": [],
  "enableMdnsDiscover": true,
  "enableStorageDiscover": true,
  "resetStorageDiscover": false,
  "enableBleDiscover": true,
  "failsafeCount": 0,
  "postfix": "",
  "debug": false,
  "debugMdns": false,
  "debugCoap": false,
  "debugWs": false,
  "debugUdp": false,
  "unregisterOnShutdown": false
}

You can edit the config file from the frontend (best option) or

On windows:

cd $HOME\.matterbridge
notepad matterbridge-shelly.config.json

On linux:

cd ~/.matterbridge
nano matterbridge-shelly.config.json

Restart Matterbridge for the changes to take effect.

Development guide

Refer to the Matterbridge Development guide for other guidelines.

Repository toolchain

See TOOLCHAIN.md for compilers, linting, formatting, testing, and editor support.

Shared agent instructions

See SHARED-AGENTS.md for shared guidance, rules, skills, and configuration for coding agents.

See .agents/README.md for the shared instructions layout and versioning.

Shared dev container support

See .devcontainer/README.md for the shared development container setup and usage.

Contributing

See CONTRIBUTING.md for contribution guidelines.

Style guide

See STYLEGUIDE.md for code style, naming, documentation, and testing conventions.

Changelog

See CHANGELOG.md for release history and notable changes.

Issues and feature requests

Report bugs and suggest improvements on GitHub Issues.

License

Licensed under the Apache License 2.0.

Support the project

If you find this project useful, please consider giving it a star on GitHub and sponsoring it. Your support helps maintain and improve the project.

"Buy Me A Coffee"

About

Matterbridge shelly plugin

Resources

Code of conduct

Contributing

Stars

142 stars

Watchers

9 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages