Skip to content

Commit

Permalink
Fixes and dependencies update (#283)
Browse files Browse the repository at this point in the history
* Avoid empty strings for info characteristics

* Typo

* Update deps

* Update deps

* Fix tests

* Bump version
  • Loading branch information
madchicken committed Aug 11, 2024
1 parent 8d7d0df commit 3b1e427
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 387 deletions.
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
"axios": "axios/dist/node/axios.cjs"
}
};
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-zigbee-nt",
"version": "2.5.10",
"version": "2.6.0",
"description": "ZigBee New Technology Platform plugin for HomeBridge",
"main": "dist/index.js",
"targets": {
Expand Down Expand Up @@ -57,7 +57,7 @@
"body-parser": "1.19.0",
"dayjs": "1.10.5",
"emotion": "11.0.0",
"evergreen-ui": "6.6.3",
"evergreen-ui": "6.13.3",
"express": "4.19.2",
"fakegato-history": "0.6.1",
"http2": "3.3.7",
Expand All @@ -70,13 +70,13 @@
"react-query": "3.17.2",
"react-router": "5.2.0",
"react-router-dom": "5.2.0",
"serialport": "9.0.6",
"serialport": "12.0.0",
"serve-static": "1.14.1",
"uri-js": "4.4.1",
"winston": "3.3.3",
"ws": "^7.5.0",
"zigbee-herdsman": "0.14.45",
"zigbee-herdsman-converters": "14.0.569"
"zigbee-herdsman": "0.14.117",
"zigbee-herdsman-converters": "14.0.694"
},
"devDependencies": {
"@emotion/eslint-plugin": "^11.2.0",
Expand All @@ -93,7 +93,6 @@
"@types/react-dom": "17.0.0",
"@types/react-router": "^5.1.8",
"@types/react-router-dom": "^5.1.6",
"@types/serialport": "^8.0.1",
"@types/serve-static": "^1.13.9",
"@types/ws": "^7.4.0",
"@typescript-eslint/eslint-plugin": "^4.15.2",
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/platform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import Device from 'zigbee-herdsman/dist/controller/model/device';
import { ZigbeeNTHomebridgePlatform } from '../platform';
import { ZigBeeNTPlatformConfig } from '../types';
import { log } from '../utils/tests/null-logger';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { ZigBeeClient } from '../zigbee/zig-bee-client';
import { findByDevice } from 'zigbee-herdsman-converters';

// Mocks
Expand Down
7 changes: 7 additions & 0 deletions src/__tests__/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,11 @@ describe('Device Registry', () => {
const ctor = getAccessoryInstance('0x84fd27fffe6fab53');
expect(ctor).toBeInstanceOf(IkeaSignalRepeater);
});

it('should recognize SONOFF ZBMINI-L', function () {
registerSupportedDevices();
const ctor = getAccessoryInstance('0x00124b0026b753c7');
expect(ctor).toBeInstanceOf(ConfigurableAccessory);
});

});
3 changes: 2 additions & 1 deletion src/__tests__/test.db
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
{"id":6,"type":"Router","ieeeAddr":"0x00158d01028e2d8d","nwkAddr":43733,"manufId":4151,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.lock.v1","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":10,"inClusterList":[],"outClusterList":[],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"interviewCompleted":true,"meta":{},"lastSeen":null}
{"id":7,"type":"Group","groupID":901,"members":[],"meta":{}}
{"id":8,"type":"Router","ieeeAddr":"0x84fd27fffe6fab53","nwkAddr":34504,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"TRADFRI Signal Repeater","epList":[11,13],"endpoints":{"11":{"profId":49246,"epId":11,"devId":256,"inClusterList":[0,3,4,5,6,8,768],"outClusterList":[],"clusters":{"genBasic":{"attributes":{"modelId":"TRADFRI Signal Repeater","manufacturerName":"IKEA of Sweden","powerSource":1,"zclVersion":1,"appVersion":1,"stackVersion":2,"hwVersion":1,"dateCode":"20131206","swBuildId":"1.0.8"}}},"binds":[],"configuredReportings":[],"meta":{}},"13":{"profId":49246,"epId":13,"devId":256,"inClusterList":[4096],"outClusterList":[4096],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":1,"stackVersion":2,"hwVersion":1,"dateCode":"20131206","swBuildId":"1.0.8","zclVersion":1,"interviewCompleted":true,"meta":{},"lastSeen":1593706063667}
{"id":9,"type":"Router","ieeeAddr":"0x14b457fffe4f77ca","nwkAddr":6060,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"TRADFRI bulb E27 CWS opal 600lm","epList":[1],"endpoints":{"1":{"profId":49246,"epId":1,"devId":512,"inClusterList":[0,3,4,5,6,8,768,2821,4096],"outClusterList":[5,25,32,4096],"clusters":{"genBasic":{"attributes":{"modelId":"TRADFRI bulb E27 CWS opal 600lm","manufacturerName":"IKEA of Sweden","powerSource":1,"zclVersion":1,"appVersion":17,"stackVersion":87,"hwVersion":1,"dateCode":"20180410","swBuildId":"1.3.009"}},"lightingColorCtrl":{"attributes":{"colorCapabilities":8,"currentX":20103,"currentY":20743}},"genOnOff":{"attributes":{"onOff":0}},"genLevelCtrl":{"attributes":{"currentLevel":1}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":17,"stackVersion":87,"hwVersion":1,"dateCode":"20180410","swBuildId":"1.3.009","zclVersion":1,"interviewCompleted":true,"meta":{},"lastSeen":1631010389559}
{"id":9,"type":"Router","ieeeAddr":"0x14b457fffe4f77ca","nwkAddr":6060,"manufId":4476,"manufName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelId":"TRADFRI bulb E27 CWS opal 600lm","epList":[1],"endpoints":{"1":{"profId":49246,"epId":1,"devId":512,"inClusterList":[0,3,4,5,6,8,768,2821,4096],"outClusterList":[5,25,32,4096],"clusters":{"genBasic":{"attributes":{"modelId":"TRADFRI bulb E27 CWS opal 600lm","manufacturerName":"IKEA of Sweden","powerSource":1,"zclVersion":1,"appVersion":17,"stackVersion":87,"hwVersion":1,"dateCode":"20180410","swBuildId":"1.3.009"}},"lightingColorCtrl":{"attributes":{"colorCapabilities":8,"currentX":20103,"currentY":20743}},"genOnOff":{"attributes":{"onOff":0}},"genLevelCtrl":{"attributes":{"currentLevel":1}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":17,"stackVersion":87,"hwVersion":1,"dateCode":"20180410","swBuildId":"1.3.009","zclVersion":1,"interviewCompleted":true,"meta":{},"lastSeen":1631010389559}
{"id":10,"type":"EndDevice","ieeeAddr":"0x00124b0026b753c7","nwkAddr":49595,"manufId":4742,"manufName":"SONOFF","powerSource":"Mains (single phase)","modelId":"ZBMINI-L","epList":[11,242],"endpoints":{"11":{"profId":260,"epId":11,"devId":257,"inClusterList":[0,3,4,5,6,8,4096,64514],"outClusterList":[25],"clusters":{"genBasic":{"attributes":{"modelId":"LWA001","manufacturerName":"Philips","powerSource":1,"zclVersion":2,"appVersion":2,"stackVersion":1,"hwVersion":1,"dateCode":"20200124","swBuildId":"1.65.9_hB3217DF4"}},"genLevelCtrl":{"attributes":{"currentLevel":254}},"genOnOff":{"attributes":{"onOff":0}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":2,"stackVersion":1,"hwVersion":1,"dateCode":"20200124","swBuildId":"1.65.9_hB3217DF4","zclVersion":2,"interviewCompleted":true,"meta":{},"lastSeen":1610401986901,"defaultSendRequestWhen":"immediate"}
6 changes: 3 additions & 3 deletions src/accessories/zig-bee-accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export abstract class ZigBeeAccessory {
const Characteristic = platform.Characteristic;
this.accessory
.getService(this.platform.Service.AccessoryInformation)
.setCharacteristic(Characteristic.Manufacturer, device.manufacturerName)
.setCharacteristic(Characteristic.Model, device.modelID)
.setCharacteristic(Characteristic.Manufacturer, `${device.manufacturerName}`)
.setCharacteristic(Characteristic.Model, `${device.modelID}`)
.setCharacteristic(Characteristic.SerialNumber, device.ieeeAddr)
.setCharacteristic(Characteristic.SoftwareRevision, `${device.softwareBuildID}`)
.setCharacteristic(Characteristic.HardwareRevision, `${device.hardwareVersion}`)
Expand All @@ -80,7 +80,7 @@ export abstract class ZigBeeAccessory {
}

/**
* Perform initialization of the accessory. By default is creates services exposed by the
* Perform initialization of the accessory. By default, it creates services exposed by the
* accessory by invoking {@link ZigBeeAccessory.getAvailableServices}
*/
public async initialize(): Promise<void> {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/find-serial-port.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import serialport from 'serialport';
import SerialPort from 'serialport';

export async function findSerialPort(): Promise<string> {
try {
const ports = await serialport.list();
const ports = await SerialPort.SerialPort.list();
const port = ports.find(item => item.manufacturer === 'Texas Instruments');
if (port) {
return port.path;
Expand Down
Loading

0 comments on commit 3b1e427

Please sign in to comment.