matterbridge-example-dynamic-platform 1.2.3-rc.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -1
- package/README.md +2 -1
- package/dist/platform.js +22 -10
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -13,10 +13,11 @@ If you like this project and find it useful, please consider giving it a star on
|
|
13
13
|
### Added
|
14
14
|
|
15
15
|
- [platform]: Added a cover device with both lift and tilt (supported by the Home app).
|
16
|
+
- [platform]: Added evse (EV charger) device type (not supported by the Home app).
|
16
17
|
|
17
18
|
### Changed
|
18
19
|
|
19
|
-
- [package]: Require matterbridge 3.0.
|
20
|
+
- [package]: Require matterbridge 3.0.5.
|
20
21
|
- [package]: Updated package.
|
21
22
|
- [package]: Updated dependencies.
|
22
23
|
|
package/README.md
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
Matterbridge dynamic platform example plugin is a template to develop your own plugin using the dynamic platform.
|
18
18
|
|
19
|
-
It exposes
|
19
|
+
It exposes 41 virtual devices:
|
20
20
|
|
21
21
|
- a switch with onOff cluster
|
22
22
|
- a light with onOff
|
@@ -59,6 +59,7 @@ It exposes 40 virtual devices:
|
|
59
59
|
- an extractor Hood device (supported by SmartThings, Alexa and Home Assistant)
|
60
60
|
- a cooktop device (supported by SmartThings, Alexa and Home Assistant)
|
61
61
|
- a water heater device (supported by SmartThings and Home Assistant)
|
62
|
+
- a car charger device (supported by Home Assistant)
|
62
63
|
|
63
64
|
All these devices continuously change state and position. The plugin also shows how to use all the command handlers (you can control all the devices), how to subscribe to attributes and how to trigger events.
|
64
65
|
|
package/dist/platform.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { MatterbridgeEndpoint, MatterbridgeDynamicPlatform, airQualitySensor, bridgedNode, colorTemperatureLight, coverDevice, dimmableLight, doorLockDevice, fanDevice, flowSensor, humiditySensor, onOffLight, onOffOutlet, onOffSwitch, powerSource, rainSensor, smokeCoAlarm, temperatureSensor, thermostatDevice, waterFreezeDetector, waterLeakDetector, airPurifier, pumpDevice, waterValve, genericSwitch, airConditioner, laundryWasher, cooktop, extractorHood, microwaveOven, oven, refrigerator, dishwasher, laundryDryer, onOffMountedSwitch, dimmableMountedSwitch, extendedColorLight, RoboticVacuumCleaner, WaterHeater, } from 'matterbridge';
|
1
|
+
import { MatterbridgeEndpoint, MatterbridgeDynamicPlatform, airQualitySensor, bridgedNode, colorTemperatureLight, coverDevice, dimmableLight, doorLockDevice, fanDevice, flowSensor, humiditySensor, onOffLight, onOffOutlet, onOffSwitch, powerSource, rainSensor, smokeCoAlarm, temperatureSensor, thermostatDevice, waterFreezeDetector, waterLeakDetector, airPurifier, pumpDevice, waterValve, genericSwitch, airConditioner, laundryWasher, cooktop, extractorHood, microwaveOven, oven, refrigerator, dishwasher, laundryDryer, onOffMountedSwitch, dimmableMountedSwitch, extendedColorLight, RoboticVacuumCleaner, WaterHeater, Evse, } from 'matterbridge';
|
2
2
|
import { isValidBoolean, isValidNumber } from 'matterbridge/utils';
|
3
3
|
import { LocationTag } from 'matterbridge/matter';
|
4
|
-
import { PowerSource, BooleanState, OnOff, LevelControl, AirQuality, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, FlowMeasurement, ColorControl, DoorLock, FanControl, FormaldehydeConcentrationMeasurement, NitrogenDioxideConcentrationMeasurement, OzoneConcentrationMeasurement, Pm10ConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm25ConcentrationMeasurement, RadonConcentrationMeasurement, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, TemperatureMeasurement, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, WindowCovering, } from 'matterbridge/matter/clusters';
|
4
|
+
import { PowerSource, BooleanState, OnOff, LevelControl, AirQuality, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, FlowMeasurement, ColorControl, DoorLock, FanControl, FormaldehydeConcentrationMeasurement, NitrogenDioxideConcentrationMeasurement, OzoneConcentrationMeasurement, Pm10ConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm25ConcentrationMeasurement, RadonConcentrationMeasurement, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, TemperatureMeasurement, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, WindowCovering, EnergyEvseMode, } from 'matterbridge/matter/clusters';
|
5
5
|
import { Appliances } from './appliances.js';
|
6
6
|
export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatform {
|
7
7
|
switch;
|
@@ -35,7 +35,8 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
35
35
|
momentarySwitch;
|
36
36
|
latchingSwitch;
|
37
37
|
vacuum;
|
38
|
-
|
38
|
+
waterHeater;
|
39
|
+
evse;
|
39
40
|
switchInterval;
|
40
41
|
lightInterval;
|
41
42
|
outletInterval;
|
@@ -58,8 +59,8 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
58
59
|
fanModeLookup = ['Off', 'Low', 'Medium', 'High', 'On', 'Auto', 'Smart'];
|
59
60
|
constructor(matterbridge, log, config) {
|
60
61
|
super(matterbridge, log, config);
|
61
|
-
if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.0.
|
62
|
-
throw new Error(`This plugin requires Matterbridge version >= "3.0.
|
62
|
+
if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.0.5')) {
|
63
|
+
throw new Error(`This plugin requires Matterbridge version >= "3.0.5". Please update Matterbridge from ${this.matterbridge.matterbridgeVersion} to the latest version in the frontend.`);
|
63
64
|
}
|
64
65
|
this.log.info('Initializing platform:', this.config.name);
|
65
66
|
if (config.whiteList === undefined)
|
@@ -966,11 +967,22 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
966
967
|
this.bridgedDevices.set(robot.deviceName ?? '', robot);
|
967
968
|
}
|
968
969
|
}
|
969
|
-
|
970
|
-
this.setSelectDevice(
|
971
|
-
if (this.validateDevice(
|
972
|
-
await this.registerDevice(
|
973
|
-
this.bridgedDevices.set(
|
970
|
+
this.waterHeater = new WaterHeater('Water Heater', '3456177820');
|
971
|
+
this.setSelectDevice(this.waterHeater.serialNumber ?? '', this.waterHeater.deviceName ?? '', undefined, 'hub');
|
972
|
+
if (this.validateDevice(this.waterHeater.deviceName ?? '')) {
|
973
|
+
await this.registerDevice(this.waterHeater);
|
974
|
+
this.bridgedDevices.set(this.waterHeater.deviceName ?? '', this.waterHeater);
|
975
|
+
}
|
976
|
+
this.evse = new Evse('Evse', '3456127820', 1, [
|
977
|
+
{ label: 'On demand', mode: 1, modeTags: [{ value: EnergyEvseMode.ModeTag.Manual }] },
|
978
|
+
{ label: 'Scheduled', mode: 2, modeTags: [{ value: EnergyEvseMode.ModeTag.TimeOfUse }] },
|
979
|
+
{ label: 'Solar Charging', mode: 3, modeTags: [{ value: EnergyEvseMode.ModeTag.SolarCharging }] },
|
980
|
+
{ label: 'Solar Charging Scheduled', mode: 4, modeTags: [{ value: EnergyEvseMode.ModeTag.SolarCharging }, { value: EnergyEvseMode.ModeTag.TimeOfUse }] },
|
981
|
+
]);
|
982
|
+
this.setSelectDevice(this.evse.serialNumber ?? '', this.evse.deviceName ?? '', undefined, 'hub');
|
983
|
+
if (this.validateDevice(this.evse.deviceName ?? '')) {
|
984
|
+
await this.registerDevice(this.evse);
|
985
|
+
this.bridgedDevices.set(this.evse.deviceName ?? '', this.evse);
|
974
986
|
}
|
975
987
|
const laundryWasherDevice = new Appliances(laundryWasher, 'Laundry Washer', '1234567890');
|
976
988
|
this.setSelectDevice(laundryWasherDevice.serialNumber ?? '', laundryWasherDevice.deviceName ?? '', undefined, 'hub');
|
package/npm-shrinkwrap.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "matterbridge-example-dynamic-platform",
|
3
|
-
"version": "1.2.3
|
3
|
+
"version": "1.2.3",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "matterbridge-example-dynamic-platform",
|
9
|
-
"version": "1.2.3
|
9
|
+
"version": "1.2.3",
|
10
10
|
"license": "MIT",
|
11
11
|
"dependencies": {
|
12
12
|
"node-ansi-logger": "3.0.1",
|