Skip to content

Commit

Permalink
Merge pull request #46 from Luligu/dev
Browse files Browse the repository at this point in the history
Release 0.9.7
  • Loading branch information
Luligu authored Sep 9, 2024
2 parents 80a71f6 + 9bfacc2 commit 93bb15b
Show file tree
Hide file tree
Showing 22 changed files with 2,897 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-matterbridge-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ jobs:
run: npm -v

- name: Install matterbridge
run: npm install -g matterbridge
run: npm install -g matterbridge --verbose

- name: Install dependencies
run: npm install
run: npm ci

- name: Lint the project
run: npm run lint
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-matterbridge-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: npm install -g matterbridge

- name: Install dependencies
run: npm install
run: npm ci

- name: Lint the project
run: npm run lint
Expand Down
26 changes: 24 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,34 @@ If you like this project and find it useful, please consider giving it a star on

### Breaking Changes

- Unless you are using docker (in that case all is already updated when you pull the image), please update Matterbridge to 1.5.4 to work with matterbridge-shelly >= 0.9.5. This is a one time issue due to the update to matter.js 0.10.0.
- Unless you are using docker (in that case all is already updated when you pull the image), please update Matterbridge to 1.5.4 to work with matterbridge-shelly >= 0.9.5. This is a one time issue due to the update to matter.js 0.10.0.

## [0.9.6] - 2024-09-06
## [0.9.7] - 2024-09-09

### Added

- [config]: Added option "postfix" to postfix the matter serial number to avoid eventual collisions with other devices on the network (default empty string).
- [config]: Added option "failsafeCount" to avoid to start the bridge when some network issue prevents to load all devices (default 0 = disabled).
- [matterbridge]: Added a check of the current Matterbridge version (required v1.5.4).

### Verified

- [shelly]: Verified shellyprodm1pm with firmware v. 1.4.2 and added Jest test (this device needs to be calibrated to enable level control).
- [shelly]: Verified shelly1g3 with firmware v. 1.4.2 and added Jest test.
- [shelly]: Verified shelly1pmg3 with firmware v. 1.4.2 and added Jest test.
- [shelly]: Verified shellyi4g3 with firmware v. 1.4.2 and added Jest test.


### Changed

- [package]: Updated dependencies.

<a href="https://www.buymeacoffee.com/luligugithub">
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
</a>

## [0.9.6] - 2024-09-06

### Verified

- [shelly]: Verified shellyplusplugs with firmware v. 1.4.2 and added Jest test.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ A shelly device gen. 1 or 2 or 3 or BLU.

For 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" (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 poit 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.
- 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 poit 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.

For wifi battery-powered devices:

- Gen. 1: only for the first time, when you want to register them: check that enableMdnsDiscover and enableStorageDiscover are flagged in the plugin configuration. Restart matterbridge (the mdns discovery is active for the first 10 minutes) and awake each device you want to register pressing the device button.

- Gen. 2/3: 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" (e.g. ws://192.168.1.100:8485). You can find the matterbridge ipv4Address address in the frontend or in the log. Then, only for the first time, when you want to register them: check that enableMdnsDiscover and enableStorageDiscover are flagged in the plugin configuration. Restart matterbridge (the mdns discovery is active for the first 10 minutes) and awake each device you want to register pressing the device button.
- Gen. 2/3: 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. Then, only for the first time, when you want to register them: check that enableMdnsDiscover and enableStorageDiscover are flagged in the plugin configuration. Restart matterbridge (the mdns discovery is active for the first 10 minutes) and awake each device you want to register pressing the device button.

For BLU devices:

Expand Down
10 changes: 10 additions & 0 deletions matterbridge-shelly.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@
"type": "boolean",
"default": true
},
"failsafeCount": {
"description": "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 loose the controller configuration in case of network issues (default 0 = disabled).",
"type": "number",
"default": 0
},
"postfix": {
"description": "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).",
"type": "string",
"default": ""
},
"debug": {
"description": "Enable the debug for the plugin (development only)",
"type": "boolean",
Expand Down
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matterbridge-shelly",
"version": "0.9.6",
"version": "0.9.7",
"description": "Matterbridge shelly plugin",
"author": "https://github.com/Luligu",
"license": "Apache-2.0",
Expand Down Expand Up @@ -48,7 +48,7 @@
"scripts": {
"build": "tsc",
"watch": "tsc --watch",
"start:frontend": "matterbridge",
"start": "matterbridge",
"start:bridge": "matterbridge -bridge",
"start:childbridge": "matterbridge -childbridge",
"test": "node --no-warnings --experimental-vm-modules node_modules/jest/bin/jest.js",
Expand Down Expand Up @@ -123,8 +123,5 @@
"ts-jest": "29.2.5",
"typescript": "5.5.4",
"typescript-eslint": "8.3.0"
},
"xxxoverrides": {
"eslint": "latest"
}
}
9 changes: 8 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ describe('initializePlugin', () => {
let mockConfig: PlatformConfig;

beforeEach(() => {
mockMatterbridge = { matterbridgePluginDirectory: 'temp', addBridgedDevice: jest.fn() } as unknown as Matterbridge;
mockMatterbridge = {
addBridgedDevice: jest.fn(),
matterbridgeDirectory: '',
matterbridgePluginDirectory: 'temp',
systemInformation: { ipv4Address: undefined },
matterbridgeVersion: '1.5.4',
removeAllBridgedDevices: jest.fn(),
} as unknown as Matterbridge;
mockLog = { fatal: jest.fn(), error: jest.fn(), warn: jest.fn(), notice: jest.fn(), info: jest.fn(), debug: jest.fn() } as unknown as AnsiLogger;
mockConfig = {
'name': 'matterbridge-shelly',
Expand Down
4 changes: 2 additions & 2 deletions src/mdnsScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ export class MdnsScanner extends EventEmitter {
}

this.scanner.on('response', async (response: ResponsePacket, rinfo: RemoteInfo) => {
let port = 0;
let port = 80; // shellymotionsensor, shellymotion2 send A record before SRV
let gen = 1;
this.devices.set(rinfo.address, rinfo.address);
if (debug) this.log.debug(`Mdns response from ${ign} ${rinfo.address} ${rinfo.family} ${rinfo.port} ${db}`);
if (debug) this.log.debug(`Mdns response from ${ign} ${rinfo.address} family ${rinfo.family} port ${rinfo.port} ${db}`);
if (debug) this.log.debug(`--- response.answers ---`);
for (const a of response.answers) {
if (debug && a.type === 'PTR') {
Expand Down
Loading

0 comments on commit 93bb15b

Please sign in to comment.