@switchbot/homebridge-switchbot 4.3.2-beta.8 → 5.0.0-beta.0
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/.github/copilot-instructions.md +328 -0
- package/.github/workflows/beta-release.yml +8 -12
- package/.github/workflows/release.yml +57 -21
- package/README.md +13 -10
- package/config.schema.json +1 -12
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +15847 -0
- package/coverage/coverage-final.json +42 -0
- package/coverage/docs/assets/dmt/dmt-component-data.js.html +85 -0
- package/coverage/docs/assets/dmt/dmt-components.js.html +286 -0
- package/coverage/docs/assets/dmt/index.html +131 -0
- package/coverage/docs/assets/hierarchy.js.html +85 -0
- package/coverage/docs/assets/icons.js.html +136 -0
- package/coverage/docs/assets/index.html +146 -0
- package/coverage/docs/assets/main.js.html +265 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +191 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/device/blindtilt.ts.html +3238 -0
- package/coverage/src/device/bot.ts.html +2803 -0
- package/coverage/src/device/ceilinglight.ts.html +2338 -0
- package/coverage/src/device/colorbulb.ts.html +2824 -0
- package/coverage/src/device/contact.ts.html +1465 -0
- package/coverage/src/device/curtain.ts.html +2869 -0
- package/coverage/src/device/device.ts.html +2500 -0
- package/coverage/src/device/fan.ts.html +2242 -0
- package/coverage/src/device/hub.ts.html +1408 -0
- package/coverage/src/device/humidifier.ts.html +2116 -0
- package/coverage/src/device/index.html +416 -0
- package/coverage/src/device/iosensor.ts.html +1375 -0
- package/coverage/src/device/lightstrip.ts.html +2617 -0
- package/coverage/src/device/lock.ts.html +1963 -0
- package/coverage/src/device/meter.ts.html +1372 -0
- package/coverage/src/device/meterplus.ts.html +1384 -0
- package/coverage/src/device/meterpro.ts.html +1618 -0
- package/coverage/src/device/motion.ts.html +1264 -0
- package/coverage/src/device/plug.ts.html +1372 -0
- package/coverage/src/device/relayswitch.ts.html +2284 -0
- package/coverage/src/device/robotvacuumcleaner.ts.html +1810 -0
- package/coverage/src/device/waterdetector.ts.html +1294 -0
- package/coverage/src/homebridge-ui/index.html +116 -0
- package/coverage/src/homebridge-ui/server.ts.html +229 -0
- package/coverage/src/index.html +161 -0
- package/coverage/src/index.ts.html +124 -0
- package/coverage/src/irdevice/airconditioner.ts.html +1687 -0
- package/coverage/src/irdevice/airpurifier.ts.html +844 -0
- package/coverage/src/irdevice/camera.ts.html +475 -0
- package/coverage/src/irdevice/fan.ts.html +766 -0
- package/coverage/src/irdevice/index.html +251 -0
- package/coverage/src/irdevice/irdevice.ts.html +1117 -0
- package/coverage/src/irdevice/light.ts.html +826 -0
- package/coverage/src/irdevice/other.ts.html +2458 -0
- package/coverage/src/irdevice/tv.ts.html +1222 -0
- package/coverage/src/irdevice/vacuumcleaner.ts.html +466 -0
- package/coverage/src/irdevice/waterheater.ts.html +469 -0
- package/coverage/src/platform.ts.html +8776 -0
- package/coverage/src/settings.ts.html +934 -0
- package/coverage/src/utils.ts.html +2092 -0
- package/dist/{device → devices-hap}/airpurifier.d.ts +3 -3
- package/dist/devices-hap/airpurifier.d.ts.map +1 -0
- package/dist/devices-hap/airpurifier.js.map +1 -0
- package/dist/{device → devices-hap}/blindtilt.d.ts +3 -3
- package/dist/devices-hap/blindtilt.d.ts.map +1 -0
- package/dist/{device → devices-hap}/blindtilt.js +6 -1
- package/dist/devices-hap/blindtilt.js.map +1 -0
- package/dist/{device → devices-hap}/bot.d.ts +3 -3
- package/dist/devices-hap/bot.d.ts.map +1 -0
- package/dist/devices-hap/bot.js.map +1 -0
- package/dist/{device → devices-hap}/ceilinglight.d.ts +3 -3
- package/dist/devices-hap/ceilinglight.d.ts.map +1 -0
- package/dist/devices-hap/ceilinglight.js.map +1 -0
- package/dist/{device → devices-hap}/colorbulb.d.ts +3 -3
- package/dist/devices-hap/colorbulb.d.ts.map +1 -0
- package/dist/devices-hap/colorbulb.js.map +1 -0
- package/dist/{device → devices-hap}/contact.d.ts +3 -3
- package/dist/devices-hap/contact.d.ts.map +1 -0
- package/dist/devices-hap/contact.js.map +1 -0
- package/dist/{device → devices-hap}/curtain.d.ts +3 -3
- package/dist/devices-hap/curtain.d.ts.map +1 -0
- package/dist/{device → devices-hap}/curtain.js +32 -8
- package/dist/devices-hap/curtain.js.map +1 -0
- package/dist/{device → devices-hap}/device.d.ts +3 -3
- package/dist/devices-hap/device.d.ts.map +1 -0
- package/dist/{device → devices-hap}/device.js +10 -4
- package/dist/devices-hap/device.js.map +1 -0
- package/dist/{device → devices-hap}/fan.d.ts +3 -3
- package/dist/devices-hap/fan.d.ts.map +1 -0
- package/dist/devices-hap/fan.js.map +1 -0
- package/dist/{device → devices-hap}/hub.d.ts +5 -5
- package/dist/devices-hap/hub.d.ts.map +1 -0
- package/dist/{device → devices-hap}/hub.js +2 -1
- package/dist/devices-hap/hub.js.map +1 -0
- package/dist/{device → devices-hap}/humidifier.d.ts +3 -3
- package/dist/devices-hap/humidifier.d.ts.map +1 -0
- package/dist/devices-hap/humidifier.js.map +1 -0
- package/dist/{device → devices-hap}/iosensor.d.ts +3 -3
- package/dist/devices-hap/iosensor.d.ts.map +1 -0
- package/dist/devices-hap/iosensor.js.map +1 -0
- package/dist/{device → devices-hap}/lightstrip.d.ts +3 -3
- package/dist/devices-hap/lightstrip.d.ts.map +1 -0
- package/dist/devices-hap/lightstrip.js.map +1 -0
- package/dist/{device → devices-hap}/lock.d.ts +3 -3
- package/dist/devices-hap/lock.d.ts.map +1 -0
- package/dist/devices-hap/lock.js.map +1 -0
- package/dist/{device → devices-hap}/meter.d.ts +3 -3
- package/dist/devices-hap/meter.d.ts.map +1 -0
- package/dist/devices-hap/meter.js.map +1 -0
- package/dist/{device → devices-hap}/meterplus.d.ts +3 -3
- package/dist/devices-hap/meterplus.d.ts.map +1 -0
- package/dist/devices-hap/meterplus.js.map +1 -0
- package/dist/{device → devices-hap}/meterpro.d.ts +3 -3
- package/dist/devices-hap/meterpro.d.ts.map +1 -0
- package/dist/{device → devices-hap}/meterpro.js +16 -3
- package/dist/devices-hap/meterpro.js.map +1 -0
- package/dist/{device → devices-hap}/motion.d.ts +3 -3
- package/dist/devices-hap/motion.d.ts.map +1 -0
- package/dist/devices-hap/motion.js.map +1 -0
- package/dist/{device → devices-hap}/plug.d.ts +3 -3
- package/dist/devices-hap/plug.d.ts.map +1 -0
- package/dist/devices-hap/plug.js.map +1 -0
- package/dist/{device → devices-hap}/relayswitch.d.ts +3 -3
- package/dist/devices-hap/relayswitch.d.ts.map +1 -0
- package/dist/devices-hap/relayswitch.js.map +1 -0
- package/dist/{device → devices-hap}/robotvacuumcleaner.d.ts +3 -3
- package/dist/devices-hap/robotvacuumcleaner.d.ts.map +1 -0
- package/dist/devices-hap/robotvacuumcleaner.js.map +1 -0
- package/dist/{device → devices-hap}/waterdetector.d.ts +3 -3
- package/dist/devices-hap/waterdetector.d.ts.map +1 -0
- package/dist/devices-hap/waterdetector.js.map +1 -0
- package/dist/devices-matter/BaseMatterAccessory.d.ts +63 -0
- package/dist/devices-matter/BaseMatterAccessory.d.ts.map +1 -0
- package/dist/devices-matter/BaseMatterAccessory.js +100 -0
- package/dist/devices-matter/BaseMatterAccessory.js.map +1 -0
- package/dist/devices-matter/ColorLightAccessory.d.ts +18 -0
- package/dist/devices-matter/ColorLightAccessory.d.ts.map +1 -0
- package/dist/devices-matter/ColorLightAccessory.js +96 -0
- package/dist/devices-matter/ColorLightAccessory.js.map +1 -0
- package/dist/devices-matter/ColorTemperatureLightAccessory.d.ts +16 -0
- package/dist/devices-matter/ColorTemperatureLightAccessory.d.ts.map +1 -0
- package/dist/devices-matter/ColorTemperatureLightAccessory.js +83 -0
- package/dist/devices-matter/ColorTemperatureLightAccessory.js.map +1 -0
- package/dist/devices-matter/ContactSensorAccessory.d.ts +10 -0
- package/dist/devices-matter/ContactSensorAccessory.d.ts.map +1 -0
- package/dist/devices-matter/ContactSensorAccessory.js +31 -0
- package/dist/devices-matter/ContactSensorAccessory.js.map +1 -0
- package/dist/devices-matter/DimmableLightAccessory.d.ts +56 -0
- package/dist/devices-matter/DimmableLightAccessory.d.ts.map +1 -0
- package/dist/devices-matter/DimmableLightAccessory.js +170 -0
- package/dist/devices-matter/DimmableLightAccessory.js.map +1 -0
- package/dist/devices-matter/DoorLockAccessory.d.ts +12 -0
- package/dist/devices-matter/DoorLockAccessory.d.ts.map +1 -0
- package/dist/devices-matter/DoorLockAccessory.js +47 -0
- package/dist/devices-matter/DoorLockAccessory.js.map +1 -0
- package/dist/devices-matter/ExtendedColorLightAccessory.d.ts +19 -0
- package/dist/devices-matter/ExtendedColorLightAccessory.d.ts.map +1 -0
- package/dist/devices-matter/ExtendedColorLightAccessory.js +108 -0
- package/dist/devices-matter/ExtendedColorLightAccessory.js.map +1 -0
- package/dist/devices-matter/FanAccessory.d.ts +14 -0
- package/dist/devices-matter/FanAccessory.d.ts.map +1 -0
- package/dist/devices-matter/FanAccessory.js +73 -0
- package/dist/devices-matter/FanAccessory.js.map +1 -0
- package/dist/devices-matter/HumiditySensorAccessory.d.ts +10 -0
- package/dist/devices-matter/HumiditySensorAccessory.d.ts.map +1 -0
- package/dist/devices-matter/HumiditySensorAccessory.js +33 -0
- package/dist/devices-matter/HumiditySensorAccessory.js.map +1 -0
- package/dist/devices-matter/LeakSensorAccessory.d.ts +10 -0
- package/dist/devices-matter/LeakSensorAccessory.d.ts.map +1 -0
- package/dist/devices-matter/LeakSensorAccessory.js +30 -0
- package/dist/devices-matter/LeakSensorAccessory.js.map +1 -0
- package/dist/devices-matter/LightSensorAccessory.d.ts +10 -0
- package/dist/devices-matter/LightSensorAccessory.d.ts.map +1 -0
- package/dist/devices-matter/LightSensorAccessory.js +33 -0
- package/dist/devices-matter/LightSensorAccessory.js.map +1 -0
- package/dist/devices-matter/OccupancySensorAccessory.d.ts +10 -0
- package/dist/devices-matter/OccupancySensorAccessory.d.ts.map +1 -0
- package/dist/devices-matter/OccupancySensorAccessory.js +43 -0
- package/dist/devices-matter/OccupancySensorAccessory.js.map +1 -0
- package/dist/devices-matter/OnOffLightAccessory.d.ts +36 -0
- package/dist/devices-matter/OnOffLightAccessory.d.ts.map +1 -0
- package/dist/devices-matter/OnOffLightAccessory.js +117 -0
- package/dist/devices-matter/OnOffLightAccessory.js.map +1 -0
- package/dist/devices-matter/OnOffOutletAccessory.d.ts +12 -0
- package/dist/devices-matter/OnOffOutletAccessory.d.ts.map +1 -0
- package/dist/devices-matter/OnOffOutletAccessory.js +43 -0
- package/dist/devices-matter/OnOffOutletAccessory.js.map +1 -0
- package/dist/devices-matter/OnOffSwitchAccessory.d.ts +12 -0
- package/dist/devices-matter/OnOffSwitchAccessory.d.ts.map +1 -0
- package/dist/devices-matter/OnOffSwitchAccessory.js +43 -0
- package/dist/devices-matter/OnOffSwitchAccessory.js.map +1 -0
- package/dist/devices-matter/RoboticVacuumAccessory.d.ts +66 -0
- package/dist/devices-matter/RoboticVacuumAccessory.d.ts.map +1 -0
- package/dist/devices-matter/RoboticVacuumAccessory.js +402 -0
- package/dist/devices-matter/RoboticVacuumAccessory.js.map +1 -0
- package/dist/devices-matter/SmokeCOAlarmAccessory.d.ts +11 -0
- package/dist/devices-matter/SmokeCOAlarmAccessory.d.ts.map +1 -0
- package/dist/devices-matter/SmokeCOAlarmAccessory.js +49 -0
- package/dist/devices-matter/SmokeCOAlarmAccessory.js.map +1 -0
- package/dist/devices-matter/TemperatureSensorAccessory.d.ts +10 -0
- package/dist/devices-matter/TemperatureSensorAccessory.d.ts.map +1 -0
- package/dist/devices-matter/TemperatureSensorAccessory.js +33 -0
- package/dist/devices-matter/TemperatureSensorAccessory.js.map +1 -0
- package/dist/devices-matter/ThermostatAccessory.d.ts +17 -0
- package/dist/devices-matter/ThermostatAccessory.d.ts.map +1 -0
- package/dist/devices-matter/ThermostatAccessory.js +87 -0
- package/dist/devices-matter/ThermostatAccessory.js.map +1 -0
- package/dist/devices-matter/VenetianBlindAccessory.d.ts +17 -0
- package/dist/devices-matter/VenetianBlindAccessory.d.ts.map +1 -0
- package/dist/devices-matter/VenetianBlindAccessory.js +100 -0
- package/dist/devices-matter/VenetianBlindAccessory.js.map +1 -0
- package/dist/devices-matter/WindowBlindAccessory.d.ts +15 -0
- package/dist/devices-matter/WindowBlindAccessory.d.ts.map +1 -0
- package/dist/devices-matter/WindowBlindAccessory.js +81 -0
- package/dist/devices-matter/WindowBlindAccessory.js.map +1 -0
- package/dist/devices-matter/custom/PowerStripAccessory.d.ts +97 -0
- package/dist/devices-matter/custom/PowerStripAccessory.d.ts.map +1 -0
- package/dist/devices-matter/custom/PowerStripAccessory.js +265 -0
- package/dist/devices-matter/custom/PowerStripAccessory.js.map +1 -0
- package/dist/devices-matter/custom/index.d.ts +8 -0
- package/dist/devices-matter/custom/index.d.ts.map +1 -0
- package/dist/devices-matter/custom/index.js +8 -0
- package/dist/devices-matter/custom/index.js.map +1 -0
- package/dist/devices-matter/index.d.ts +29 -0
- package/dist/devices-matter/index.d.ts.map +1 -0
- package/dist/devices-matter/index.js +28 -0
- package/dist/devices-matter/index.js.map +1 -0
- package/dist/homebridge-ui/public/index.html +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +2 -2
- package/dist/index.test.js.map +1 -1
- package/dist/irdevice/airconditioner.d.ts +3 -3
- package/dist/irdevice/airconditioner.d.ts.map +1 -1
- package/dist/irdevice/airconditioner.js.map +1 -1
- package/dist/irdevice/airpurifier.d.ts +3 -3
- package/dist/irdevice/airpurifier.d.ts.map +1 -1
- package/dist/irdevice/airpurifier.js.map +1 -1
- package/dist/irdevice/camera.d.ts +3 -3
- package/dist/irdevice/camera.d.ts.map +1 -1
- package/dist/irdevice/camera.js.map +1 -1
- package/dist/irdevice/fan.d.ts +3 -3
- package/dist/irdevice/fan.d.ts.map +1 -1
- package/dist/irdevice/fan.js.map +1 -1
- package/dist/irdevice/irdevice.d.ts +3 -3
- package/dist/irdevice/irdevice.d.ts.map +1 -1
- package/dist/irdevice/irdevice.js.map +1 -1
- package/dist/irdevice/light.d.ts +3 -3
- package/dist/irdevice/light.d.ts.map +1 -1
- package/dist/irdevice/light.js.map +1 -1
- package/dist/irdevice/other.d.ts +3 -3
- package/dist/irdevice/other.d.ts.map +1 -1
- package/dist/irdevice/other.js.map +1 -1
- package/dist/irdevice/tv.d.ts +3 -3
- package/dist/irdevice/tv.d.ts.map +1 -1
- package/dist/irdevice/tv.js.map +1 -1
- package/dist/irdevice/vacuumcleaner.d.ts +3 -3
- package/dist/irdevice/vacuumcleaner.d.ts.map +1 -1
- package/dist/irdevice/vacuumcleaner.js.map +1 -1
- package/dist/irdevice/waterheater.d.ts +3 -3
- package/dist/irdevice/waterheater.d.ts.map +1 -1
- package/dist/irdevice/waterheater.js.map +1 -1
- package/dist/{platform.d.ts → platform-hap.d.ts} +2 -2
- package/dist/platform-hap.d.ts.map +1 -0
- package/dist/{platform.js → platform-hap.js} +32 -31
- package/dist/{platform.js.map → platform-hap.js.map} +1 -1
- package/dist/platform-matter.d.ts +75 -0
- package/dist/platform-matter.d.ts.map +1 -0
- package/dist/platform-matter.js +362 -0
- package/dist/platform-matter.js.map +1 -0
- package/dist/verifyconfig.test.d.ts +2 -0
- package/dist/verifyconfig.test.d.ts.map +1 -0
- package/dist/verifyconfig.test.js +167 -0
- package/dist/verifyconfig.test.js.map +1 -0
- package/docs/index.html +20 -11
- package/docs/variables/default.html +1 -1
- package/package.json +10 -10
- package/src/{device → devices-hap}/airpurifier.ts +2 -2
- package/src/{device → devices-hap}/blindtilt.ts +7 -3
- package/src/{device → devices-hap}/bot.ts +2 -2
- package/src/{device → devices-hap}/ceilinglight.ts +2 -2
- package/src/{device → devices-hap}/colorbulb.ts +2 -2
- package/src/{device → devices-hap}/contact.ts +2 -2
- package/src/{device → devices-hap}/curtain.ts +32 -10
- package/src/{device → devices-hap}/device.ts +12 -6
- package/src/{device → devices-hap}/fan.ts +2 -2
- package/src/{device → devices-hap}/hub.ts +7 -6
- package/src/{device → devices-hap}/humidifier.ts +2 -2
- package/src/{device → devices-hap}/iosensor.ts +2 -2
- package/src/{device → devices-hap}/lightstrip.ts +2 -2
- package/src/{device → devices-hap}/lock.ts +2 -2
- package/src/{device → devices-hap}/meter.ts +2 -2
- package/src/{device → devices-hap}/meterplus.ts +2 -2
- package/src/{device → devices-hap}/meterpro.ts +18 -5
- package/src/{device → devices-hap}/motion.ts +2 -2
- package/src/{device → devices-hap}/plug.ts +2 -2
- package/src/{device → devices-hap}/relayswitch.ts +2 -2
- package/src/{device → devices-hap}/robotvacuumcleaner.ts +2 -2
- package/src/{device → devices-hap}/waterdetector.ts +2 -2
- package/src/devices-matter/BaseMatterAccessory.ts +131 -0
- package/src/devices-matter/ColorLightAccessory.ts +113 -0
- package/src/devices-matter/ColorTemperatureLightAccessory.ts +98 -0
- package/src/devices-matter/ContactSensorAccessory.ts +37 -0
- package/src/devices-matter/DimmableLightAccessory.ts +196 -0
- package/src/devices-matter/DoorLockAccessory.ts +56 -0
- package/src/devices-matter/ExtendedColorLightAccessory.ts +127 -0
- package/src/devices-matter/FanAccessory.ts +87 -0
- package/src/devices-matter/HumiditySensorAccessory.ts +39 -0
- package/src/devices-matter/LeakSensorAccessory.ts +36 -0
- package/src/devices-matter/LightSensorAccessory.ts +39 -0
- package/src/devices-matter/OccupancySensorAccessory.ts +52 -0
- package/src/devices-matter/OnOffLightAccessory.ts +133 -0
- package/src/devices-matter/OnOffOutletAccessory.ts +52 -0
- package/src/devices-matter/OnOffSwitchAccessory.ts +52 -0
- package/src/devices-matter/RoboticVacuumAccessory.ts +484 -0
- package/src/devices-matter/SmokeCOAlarmAccessory.ts +59 -0
- package/src/devices-matter/TemperatureSensorAccessory.ts +39 -0
- package/src/devices-matter/ThermostatAccessory.ts +105 -0
- package/src/devices-matter/VenetianBlindAccessory.ts +118 -0
- package/src/devices-matter/WindowBlindAccessory.ts +94 -0
- package/src/devices-matter/custom/PowerStripAccessory.ts +309 -0
- package/src/devices-matter/custom/index.ts +8 -0
- package/src/devices-matter/index.ts +29 -0
- package/src/homebridge-ui/public/index.html +1 -1
- package/src/index.test.ts +2 -2
- package/src/index.ts +7 -2
- package/src/irdevice/airconditioner.ts +2 -2
- package/src/irdevice/airpurifier.ts +2 -2
- package/src/irdevice/camera.ts +2 -2
- package/src/irdevice/fan.ts +2 -2
- package/src/irdevice/irdevice.ts +2 -2
- package/src/irdevice/light.ts +2 -2
- package/src/irdevice/other.ts +2 -2
- package/src/irdevice/tv.ts +2 -2
- package/src/irdevice/vacuumcleaner.ts +2 -2
- package/src/irdevice/waterheater.ts +2 -2
- package/src/{platform.ts → platform-hap.ts} +31 -30
- package/src/platform-matter.ts +450 -0
- package/src/verifyconfig.test.ts +197 -0
- package/tsconfig.json +2 -1
- package/typedoc.json +1 -0
- package/.github/workflows/build.yml +0 -18
- package/.github/workflows/changerelease.yml +0 -11
- package/.github/workflows/labeler.yml +0 -16
- package/.github/workflows/release-drafter.yml +0 -14
- package/dist/device/airpurifier.d.ts.map +0 -1
- package/dist/device/airpurifier.js.map +0 -1
- package/dist/device/blindtilt.d.ts.map +0 -1
- package/dist/device/blindtilt.js.map +0 -1
- package/dist/device/bot.d.ts.map +0 -1
- package/dist/device/bot.js.map +0 -1
- package/dist/device/ceilinglight.d.ts.map +0 -1
- package/dist/device/ceilinglight.js.map +0 -1
- package/dist/device/colorbulb.d.ts.map +0 -1
- package/dist/device/colorbulb.js.map +0 -1
- package/dist/device/contact.d.ts.map +0 -1
- package/dist/device/contact.js.map +0 -1
- package/dist/device/curtain.d.ts.map +0 -1
- package/dist/device/curtain.js.map +0 -1
- package/dist/device/device.d.ts.map +0 -1
- package/dist/device/device.js.map +0 -1
- package/dist/device/fan.d.ts.map +0 -1
- package/dist/device/fan.js.map +0 -1
- package/dist/device/hub.d.ts.map +0 -1
- package/dist/device/hub.js.map +0 -1
- package/dist/device/humidifier.d.ts.map +0 -1
- package/dist/device/humidifier.js.map +0 -1
- package/dist/device/iosensor.d.ts.map +0 -1
- package/dist/device/iosensor.js.map +0 -1
- package/dist/device/lightstrip.d.ts.map +0 -1
- package/dist/device/lightstrip.js.map +0 -1
- package/dist/device/lock.d.ts.map +0 -1
- package/dist/device/lock.js.map +0 -1
- package/dist/device/meter.d.ts.map +0 -1
- package/dist/device/meter.js.map +0 -1
- package/dist/device/meterplus.d.ts.map +0 -1
- package/dist/device/meterplus.js.map +0 -1
- package/dist/device/meterpro.d.ts.map +0 -1
- package/dist/device/meterpro.js.map +0 -1
- package/dist/device/motion.d.ts.map +0 -1
- package/dist/device/motion.js.map +0 -1
- package/dist/device/plug.d.ts.map +0 -1
- package/dist/device/plug.js.map +0 -1
- package/dist/device/relayswitch.d.ts.map +0 -1
- package/dist/device/relayswitch.js.map +0 -1
- package/dist/device/robotvacuumcleaner.d.ts.map +0 -1
- package/dist/device/robotvacuumcleaner.js.map +0 -1
- package/dist/device/waterdetector.d.ts.map +0 -1
- package/dist/device/waterdetector.js.map +0 -1
- package/dist/platform.d.ts.map +0 -1
- /package/dist/{device → devices-hap}/airpurifier.js +0 -0
- /package/dist/{device → devices-hap}/bot.js +0 -0
- /package/dist/{device → devices-hap}/ceilinglight.js +0 -0
- /package/dist/{device → devices-hap}/colorbulb.js +0 -0
- /package/dist/{device → devices-hap}/contact.js +0 -0
- /package/dist/{device → devices-hap}/fan.js +0 -0
- /package/dist/{device → devices-hap}/humidifier.js +0 -0
- /package/dist/{device → devices-hap}/iosensor.js +0 -0
- /package/dist/{device → devices-hap}/lightstrip.js +0 -0
- /package/dist/{device → devices-hap}/lock.js +0 -0
- /package/dist/{device → devices-hap}/meter.js +0 -0
- /package/dist/{device → devices-hap}/meterplus.js +0 -0
- /package/dist/{device → devices-hap}/motion.js +0 -0
- /package/dist/{device → devices-hap}/plug.js +0 -0
- /package/dist/{device → devices-hap}/relayswitch.js +0 -0
- /package/dist/{device → devices-hap}/robotvacuumcleaner.js +0 -0
- /package/dist/{device → devices-hap}/waterdetector.js +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { API, DynamicPlatformPlugin, Logging, SerializedMatterAccessory } from 'homebridge';
|
|
2
|
+
import type { SwitchBotPlatformConfig } from './settings.js';
|
|
3
|
+
/**
|
|
4
|
+
* MatterPlatform
|
|
5
|
+
* Demonstrates all available Matter device types in Homebridge
|
|
6
|
+
*
|
|
7
|
+
* Organized by official Matter Specification v1.4.1 categories
|
|
8
|
+
*/
|
|
9
|
+
export declare class SwitchBotMatterPlatform implements DynamicPlatformPlugin {
|
|
10
|
+
readonly log: Logging;
|
|
11
|
+
readonly config: SwitchBotPlatformConfig;
|
|
12
|
+
readonly api: API;
|
|
13
|
+
readonly matterAccessories: Map<string, SerializedMatterAccessory>;
|
|
14
|
+
constructor(log: Logging, config: SwitchBotPlatformConfig, api: API);
|
|
15
|
+
/**
|
|
16
|
+
* Required for DynamicPlatformPlugin
|
|
17
|
+
* Called when homebridge restores cached accessories from disk at startup
|
|
18
|
+
*/
|
|
19
|
+
configureAccessory(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Called when homebridge restores cached Matter accessories from disk at startup.
|
|
22
|
+
*
|
|
23
|
+
* This is where you can access the `accessory.context` object to retrieve
|
|
24
|
+
* any custom data you stored when the accessory was originally registered.
|
|
25
|
+
*/
|
|
26
|
+
configureMatterAccessory(accessory: SerializedMatterAccessory): void;
|
|
27
|
+
/**
|
|
28
|
+
* Register all Matter accessories
|
|
29
|
+
*/
|
|
30
|
+
private registerMatterAccessories;
|
|
31
|
+
/**
|
|
32
|
+
* Remove accessories that are disabled in config
|
|
33
|
+
*/
|
|
34
|
+
private removeDisabledAccessories;
|
|
35
|
+
/**
|
|
36
|
+
* Section 4: Lighting Devices (Matter Spec § 4)
|
|
37
|
+
*/
|
|
38
|
+
private registerSection4Lighting;
|
|
39
|
+
/**
|
|
40
|
+
* Section 5: Smart Plugs/Actuators (Matter Spec § 5)
|
|
41
|
+
*/
|
|
42
|
+
private registerSection5SmartPlugs;
|
|
43
|
+
/**
|
|
44
|
+
* Section 6: Switches & Controllers (Matter Spec § 6)
|
|
45
|
+
*/
|
|
46
|
+
private registerSection6Switches;
|
|
47
|
+
/**
|
|
48
|
+
* Section 7: Sensors (Matter Spec § 7)
|
|
49
|
+
*/
|
|
50
|
+
private registerSection7Sensors;
|
|
51
|
+
/**
|
|
52
|
+
* Section 8: Closure Devices (Matter Spec § 8)
|
|
53
|
+
*/
|
|
54
|
+
private registerSection8Closure;
|
|
55
|
+
/**
|
|
56
|
+
* Section 9: HVAC (Matter Spec § 9)
|
|
57
|
+
*/
|
|
58
|
+
private registerSection9HVAC;
|
|
59
|
+
/**
|
|
60
|
+
* Section 12: Robotic Devices (Matter Spec § 12)
|
|
61
|
+
* ⚠️ IMPORTANT: RVC devices use a DIFFERENT PROCESS (same code) than other devices!
|
|
62
|
+
* When this runs, you'll see separate commissioning codes in the logs for the robot vacuum.
|
|
63
|
+
* Use those codes to pair the vacuum as a separate bridge in your Home app.
|
|
64
|
+
*/
|
|
65
|
+
private registerSection12Robotic;
|
|
66
|
+
/**
|
|
67
|
+
* Custom Devices
|
|
68
|
+
*
|
|
69
|
+
* This section demonstrates custom device implementations that go beyond
|
|
70
|
+
* the standard Matter device types. These examples show advanced patterns
|
|
71
|
+
* like managing multiple logical components within a single device.
|
|
72
|
+
*/
|
|
73
|
+
private registerCustomDevices;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=platform-matter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-matter.d.ts","sourceRoot":"","sources":["../src/platform-matter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,GAAG,EACH,qBAAqB,EACrB,OAAO,EAEP,yBAAyB,EAC1B,MAAM,YAAY,CAAA;AAEnB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AA2B5D;;;;;GAKG;AACH,qBAAa,uBAAwB,YAAW,qBAAqB;aASjD,GAAG,EAAE,OAAO;aACZ,MAAM,EAAE,uBAAuB;aAC/B,GAAG,EAAE,GAAG;IAL1B,SAAgB,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAAY;gBAGnE,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,uBAAuB,EAC/B,GAAG,EAAE,GAAG;IA0B1B;;;OAGG;IACH,kBAAkB;IAMlB;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,yBAAyB;IAK7D;;OAEG;YACW,yBAAyB;IAuBvC;;OAEG;YACW,yBAAyB;IAqCvC;;OAEG;YACW,wBAAwB;IA8CtC;;OAEG;YACW,0BAA0B;IAsBxC;;OAEG;YACW,wBAAwB;IAsBtC;;OAEG;YACW,uBAAuB;IA0DrC;;OAEG;YACW,uBAAuB;IAkCrC;;OAEG;YACW,oBAAoB;IA4BlC;;;;;OAKG;YACW,wBAAwB;IAsBtC;;;;;;OAMG;YACW,qBAAqB;CAqBpC"}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { ColorLightAccessory, ColorTemperatureLightAccessory, ContactSensorAccessory, DimmableLightAccessory, DoorLockAccessory, ExtendedColorLightAccessory, FanAccessory, HumiditySensorAccessory, LeakSensorAccessory, LightSensorAccessory, OccupancySensorAccessory, OnOffLightAccessory, OnOffOutletAccessory, OnOffSwitchAccessory, PowerStripAccessory, RoboticVacuumAccessory, SmokeCOAlarmAccessory, TemperatureSensorAccessory, ThermostatAccessory, VenetianBlindAccessory, WindowBlindAccessory, } from './devices-matter/index.js';
|
|
2
|
+
import { PLATFORM_NAME, PLUGIN_NAME } from './settings.js';
|
|
3
|
+
/**
|
|
4
|
+
* MatterPlatform
|
|
5
|
+
* Demonstrates all available Matter device types in Homebridge
|
|
6
|
+
*
|
|
7
|
+
* Organized by official Matter Specification v1.4.1 categories
|
|
8
|
+
*/
|
|
9
|
+
export class SwitchBotMatterPlatform {
|
|
10
|
+
log;
|
|
11
|
+
config;
|
|
12
|
+
api;
|
|
13
|
+
// Track restored HAP cached accessories (required for DynamicPlatformPlugin)
|
|
14
|
+
// This is commented out here as this plugin does not have any HAP accessories
|
|
15
|
+
// public readonly accessories: Map<string, PlatformAccessory> = new Map()
|
|
16
|
+
// Track restored Matter cached accessories
|
|
17
|
+
matterAccessories = new Map();
|
|
18
|
+
constructor(log, config, api) {
|
|
19
|
+
this.log = log;
|
|
20
|
+
this.config = config;
|
|
21
|
+
this.api = api;
|
|
22
|
+
this.log.debug('Finished initializing platform:', this.config.name);
|
|
23
|
+
// Does the user have a version of Homebridge that is compatible with matter?
|
|
24
|
+
if (!this.api.isMatterAvailable?.()) {
|
|
25
|
+
this.log.warn('Matter is not available in this version of Homebridge. Please update Homebridge to use this plugin.');
|
|
26
|
+
}
|
|
27
|
+
// Check if the user has matter enabled, this means:
|
|
28
|
+
// - If the plugin is running on the main bridge, then the user must have enabled matter in the Homebridge settings page in the UI
|
|
29
|
+
// - If the plugin is running on a child bridge, then the user must have enabled matter on the plugin bridge settings section in the UI
|
|
30
|
+
// In reality, only the below check is needed, but they are both included here for completeness
|
|
31
|
+
// Remember to use a '?.' optional chaining operator in case the user is running an older version of Homebridge that does not have these APIs
|
|
32
|
+
if (!this.api.isMatterEnabled?.()) {
|
|
33
|
+
this.log.warn('Matter is not enabled in Homebridge. Please enable Matter in the Homebridge settings to use this plugin.');
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
// Register Matter accessories when Homebridge has finished launching
|
|
37
|
+
this.api.on('didFinishLaunching', () => {
|
|
38
|
+
this.log.debug('Executed didFinishLaunching callback');
|
|
39
|
+
this.registerMatterAccessories();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Required for DynamicPlatformPlugin
|
|
44
|
+
* Called when homebridge restores cached accessories from disk at startup
|
|
45
|
+
*/
|
|
46
|
+
configureAccessory( /* accessory: PlatformAccessory */) {
|
|
47
|
+
// Note this is not used for Matter accessories - use configureMatterAccessory instead
|
|
48
|
+
// This plugin does not have any hap accessories, so here we can comment this out
|
|
49
|
+
// this.accessories.set(accessory.UUID, accessory)
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Called when homebridge restores cached Matter accessories from disk at startup.
|
|
53
|
+
*
|
|
54
|
+
* This is where you can access the `accessory.context` object to retrieve
|
|
55
|
+
* any custom data you stored when the accessory was originally registered.
|
|
56
|
+
*/
|
|
57
|
+
configureMatterAccessory(accessory) {
|
|
58
|
+
this.log.debug('Loading cached Matter accessory:', accessory.displayName);
|
|
59
|
+
this.matterAccessories.set(accessory.uuid, accessory);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Register all Matter accessories
|
|
63
|
+
*/
|
|
64
|
+
async registerMatterAccessories() {
|
|
65
|
+
this.log.info('═'.repeat(80));
|
|
66
|
+
this.log.info('Homebridge Matter Plugin');
|
|
67
|
+
this.log.info('═'.repeat(80));
|
|
68
|
+
// Remove accessories that are disabled in config
|
|
69
|
+
await this.removeDisabledAccessories();
|
|
70
|
+
// Register devices by Matter specification sections
|
|
71
|
+
await this.registerSection4Lighting();
|
|
72
|
+
await this.registerSection5SmartPlugs();
|
|
73
|
+
await this.registerSection6Switches();
|
|
74
|
+
await this.registerSection7Sensors();
|
|
75
|
+
await this.registerSection8Closure();
|
|
76
|
+
await this.registerSection9HVAC();
|
|
77
|
+
await this.registerSection12Robotic();
|
|
78
|
+
await this.registerCustomDevices();
|
|
79
|
+
this.log.info('═'.repeat(80));
|
|
80
|
+
this.log.info('Finished registering Matter accessories');
|
|
81
|
+
this.log.info('═'.repeat(80));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Remove accessories that are disabled in config
|
|
85
|
+
*/
|
|
86
|
+
async removeDisabledAccessories() {
|
|
87
|
+
const configMap = [
|
|
88
|
+
{ enabled: this.config.enableOnOffLight, uuid: this.api.matter.uuid.generate('matter-onoff-light'), name: 'On/Off Light' },
|
|
89
|
+
{ enabled: this.config.enableDimmableLight, uuid: this.api.matter.uuid.generate('matter-dimmable-light'), name: 'Dimmable Light' },
|
|
90
|
+
{ enabled: this.config.enableColourTemperatureLight, uuid: this.api.matter.uuid.generate('matter-colour-temp-light'), name: 'Colour Temperature Light' },
|
|
91
|
+
{ enabled: this.config.enableColourLight, uuid: this.api.matter.uuid.generate('matter-colour-light'), name: 'Colour Light (HS)' },
|
|
92
|
+
{ enabled: this.config.enableExtendedColourLight, uuid: this.api.matter.uuid.generate('matter-extended-colour-light'), name: 'Extended Colour Light' },
|
|
93
|
+
{ enabled: this.config.enableOnOffOutlet, uuid: this.api.matter.uuid.generate('matter-onoff-outlet'), name: 'On/Off Outlet' },
|
|
94
|
+
{ enabled: this.config.enableOnOffSwitch, uuid: this.api.matter.uuid.generate('matter-onoff-switch'), name: 'On/Off Switch' },
|
|
95
|
+
{ enabled: this.config.enableTemperatureSensor, uuid: this.api.matter.uuid.generate('matter-temperature-sensor'), name: 'Temperature Sensor' },
|
|
96
|
+
{ enabled: this.config.enableHumiditySensor, uuid: this.api.matter.uuid.generate('matter-humidity-sensor'), name: 'Humidity Sensor' },
|
|
97
|
+
{ enabled: this.config.enableLightSensor, uuid: this.api.matter.uuid.generate('matter-light-sensor'), name: 'Light Sensor' },
|
|
98
|
+
{ enabled: this.config.enableOccupancySensor, uuid: this.api.matter.uuid.generate('matter-occupancy-sensor'), name: 'Occupancy Sensor' },
|
|
99
|
+
{ enabled: this.config.enableContactSensor, uuid: this.api.matter.uuid.generate('matter-contact-sensor'), name: 'Contact Sensor' },
|
|
100
|
+
{ enabled: this.config.enableLeakSensor, uuid: this.api.matter.uuid.generate('matter-leak-sensor'), name: 'Leak Sensor' },
|
|
101
|
+
{ enabled: this.config.enableSmokeSensor, uuid: this.api.matter.uuid.generate('matter-smoke-sensor'), name: 'Smoke Sensor' },
|
|
102
|
+
{ enabled: this.config.enableDoorLock, uuid: this.api.matter.uuid.generate('matter-door-lock'), name: 'Door Lock' },
|
|
103
|
+
{ enabled: this.config.enableWindowBlind, uuid: this.api.matter.uuid.generate('matter-window-blind'), name: 'Window Blind' },
|
|
104
|
+
{ enabled: this.config.enableVenetianBlind, uuid: this.api.matter.uuid.generate('matter-venetian-blind'), name: 'Venetian Blind' },
|
|
105
|
+
{ enabled: this.config.enableThermostat, uuid: this.api.matter.uuid.generate('matter-thermostat'), name: 'Thermostat' },
|
|
106
|
+
{ enabled: this.config.enableFan, uuid: this.api.matter.uuid.generate('matter-fan'), name: 'Fan' },
|
|
107
|
+
{ enabled: this.config.enableRobotVacuum, uuid: this.api.matter.uuid.generate('matter-robot-vacuum'), name: 'Robot Vacuum' },
|
|
108
|
+
{ enabled: this.config.enablePowerStrip, uuid: this.api.matter.uuid.generate('matter-power-strip'), name: 'Power Strip' },
|
|
109
|
+
];
|
|
110
|
+
for (const { enabled, uuid, name } of configMap) {
|
|
111
|
+
if (enabled === false) {
|
|
112
|
+
const existingAccessory = this.matterAccessories.get(uuid);
|
|
113
|
+
if (existingAccessory) {
|
|
114
|
+
this.log.info(`Removing accessory '${name}' (disabled in config)`);
|
|
115
|
+
await this.api.matter.unregisterPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [existingAccessory]);
|
|
116
|
+
this.matterAccessories.delete(uuid);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Section 4: Lighting Devices (Matter Spec § 4)
|
|
123
|
+
*/
|
|
124
|
+
async registerSection4Lighting() {
|
|
125
|
+
this.log.info('═'.repeat(80));
|
|
126
|
+
this.log.info('Section 4: Lighting Devices (Matter Spec § 4)');
|
|
127
|
+
this.log.info('═'.repeat(80));
|
|
128
|
+
const accessories = [];
|
|
129
|
+
// On/Off Light
|
|
130
|
+
if (this.config.enableOnOffLight !== false) {
|
|
131
|
+
const device = new OnOffLightAccessory(this.api, this.log);
|
|
132
|
+
accessories.push(device.toAccessory());
|
|
133
|
+
}
|
|
134
|
+
// Dimmable Light
|
|
135
|
+
if (this.config.enableDimmableLight !== false) {
|
|
136
|
+
const device = new DimmableLightAccessory(this.api, this.log);
|
|
137
|
+
accessories.push(device.toAccessory());
|
|
138
|
+
}
|
|
139
|
+
// Color Temperature Light
|
|
140
|
+
if (this.config.enableColourTemperatureLight !== false) {
|
|
141
|
+
const device = new ColorTemperatureLightAccessory(this.api, this.log);
|
|
142
|
+
accessories.push(device.toAccessory());
|
|
143
|
+
}
|
|
144
|
+
// Color Light (HS only)
|
|
145
|
+
if (this.config.enableColourLight !== false) {
|
|
146
|
+
const device = new ColorLightAccessory(this.api, this.log);
|
|
147
|
+
accessories.push(device.toAccessory());
|
|
148
|
+
}
|
|
149
|
+
// Extended Color Light (HS+CCT)
|
|
150
|
+
if (this.config.enableExtendedColourLight !== false) {
|
|
151
|
+
const device = new ExtendedColorLightAccessory(this.api, this.log);
|
|
152
|
+
accessories.push(device.toAccessory());
|
|
153
|
+
}
|
|
154
|
+
if (accessories.length > 0) {
|
|
155
|
+
this.log.info(`✓ Registered ${accessories.length} lighting device(s)`);
|
|
156
|
+
for (const acc of accessories) {
|
|
157
|
+
this.log.info(` - ${acc.displayName}`);
|
|
158
|
+
}
|
|
159
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Section 5: Smart Plugs/Actuators (Matter Spec § 5)
|
|
164
|
+
*/
|
|
165
|
+
async registerSection5SmartPlugs() {
|
|
166
|
+
this.log.info('═'.repeat(80));
|
|
167
|
+
this.log.info('Section 5: Smart Plugs/Actuators (Matter Spec § 5)');
|
|
168
|
+
this.log.info('═'.repeat(80));
|
|
169
|
+
const accessories = [];
|
|
170
|
+
// On/Off Outlet
|
|
171
|
+
if (this.config.enableOnOffOutlet !== false) {
|
|
172
|
+
const device = new OnOffOutletAccessory(this.api, this.log);
|
|
173
|
+
accessories.push(device.toAccessory());
|
|
174
|
+
}
|
|
175
|
+
if (accessories.length > 0) {
|
|
176
|
+
this.log.info(`✓ Registered ${accessories.length} smart plug/actuator device(s)`);
|
|
177
|
+
for (const acc of accessories) {
|
|
178
|
+
this.log.info(` - ${acc.displayName}`);
|
|
179
|
+
}
|
|
180
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Section 6: Switches & Controllers (Matter Spec § 6)
|
|
185
|
+
*/
|
|
186
|
+
async registerSection6Switches() {
|
|
187
|
+
this.log.info('═'.repeat(80));
|
|
188
|
+
this.log.info('Section 6: Switches & Controllers (Matter Spec § 6)');
|
|
189
|
+
this.log.info('═'.repeat(80));
|
|
190
|
+
const accessories = [];
|
|
191
|
+
// On/Off Switch
|
|
192
|
+
if (this.config.enableOnOffSwitch !== false) {
|
|
193
|
+
const device = new OnOffSwitchAccessory(this.api, this.log);
|
|
194
|
+
accessories.push(device.toAccessory());
|
|
195
|
+
}
|
|
196
|
+
if (accessories.length > 0) {
|
|
197
|
+
this.log.info(`✓ Registered ${accessories.length} switch/controller device(s)`);
|
|
198
|
+
for (const acc of accessories) {
|
|
199
|
+
this.log.info(` - ${acc.displayName}`);
|
|
200
|
+
}
|
|
201
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Section 7: Sensors (Matter Spec § 7)
|
|
206
|
+
*/
|
|
207
|
+
async registerSection7Sensors() {
|
|
208
|
+
this.log.info('═'.repeat(80));
|
|
209
|
+
this.log.info('Section 7: Sensors (Matter Spec § 7)');
|
|
210
|
+
this.log.info('═'.repeat(80));
|
|
211
|
+
const accessories = [];
|
|
212
|
+
// Contact Sensor
|
|
213
|
+
if (this.config.enableContactSensor !== false) {
|
|
214
|
+
const device = new ContactSensorAccessory(this.api, this.log);
|
|
215
|
+
accessories.push(device.toAccessory());
|
|
216
|
+
}
|
|
217
|
+
// Light Sensor
|
|
218
|
+
if (this.config.enableLightSensor !== false) {
|
|
219
|
+
const device = new LightSensorAccessory(this.api, this.log);
|
|
220
|
+
accessories.push(device.toAccessory());
|
|
221
|
+
}
|
|
222
|
+
// Occupancy Sensor
|
|
223
|
+
if (this.config.enableOccupancySensor !== false) {
|
|
224
|
+
const device = new OccupancySensorAccessory(this.api, this.log);
|
|
225
|
+
accessories.push(device.toAccessory());
|
|
226
|
+
}
|
|
227
|
+
// Temperature Sensor
|
|
228
|
+
if (this.config.enableTemperatureSensor !== false) {
|
|
229
|
+
const device = new TemperatureSensorAccessory(this.api, this.log);
|
|
230
|
+
accessories.push(device.toAccessory());
|
|
231
|
+
}
|
|
232
|
+
// Humidity Sensor
|
|
233
|
+
if (this.config.enableHumiditySensor !== false) {
|
|
234
|
+
const device = new HumiditySensorAccessory(this.api, this.log);
|
|
235
|
+
accessories.push(device.toAccessory());
|
|
236
|
+
}
|
|
237
|
+
// Smoke/CO Alarm
|
|
238
|
+
if (this.config.enableSmokeSensor !== false) {
|
|
239
|
+
const device = new SmokeCOAlarmAccessory(this.api, this.log);
|
|
240
|
+
accessories.push(device.toAccessory());
|
|
241
|
+
}
|
|
242
|
+
// Leak Sensor
|
|
243
|
+
if (this.config.enableLeakSensor !== false) {
|
|
244
|
+
const device = new LeakSensorAccessory(this.api, this.log);
|
|
245
|
+
accessories.push(device.toAccessory());
|
|
246
|
+
}
|
|
247
|
+
if (accessories.length > 0) {
|
|
248
|
+
this.log.info(`✓ Registered ${accessories.length} sensor device(s)`);
|
|
249
|
+
for (const acc of accessories) {
|
|
250
|
+
this.log.info(` - ${acc.displayName}`);
|
|
251
|
+
}
|
|
252
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Section 8: Closure Devices (Matter Spec § 8)
|
|
257
|
+
*/
|
|
258
|
+
async registerSection8Closure() {
|
|
259
|
+
this.log.info('═'.repeat(80));
|
|
260
|
+
this.log.info('Section 8: Closure Devices (Matter Spec § 8)');
|
|
261
|
+
this.log.info('═'.repeat(80));
|
|
262
|
+
const accessories = [];
|
|
263
|
+
// Door Lock
|
|
264
|
+
if (this.config.enableDoorLock !== false) {
|
|
265
|
+
const device = new DoorLockAccessory(this.api, this.log);
|
|
266
|
+
accessories.push(device.toAccessory());
|
|
267
|
+
}
|
|
268
|
+
// Window Blind
|
|
269
|
+
if (this.config.enableWindowBlind !== false) {
|
|
270
|
+
const device = new WindowBlindAccessory(this.api, this.log);
|
|
271
|
+
accessories.push(device.toAccessory());
|
|
272
|
+
}
|
|
273
|
+
// Venetian Blind
|
|
274
|
+
if (this.config.enableVenetianBlind !== false) {
|
|
275
|
+
const device = new VenetianBlindAccessory(this.api, this.log);
|
|
276
|
+
accessories.push(device.toAccessory());
|
|
277
|
+
}
|
|
278
|
+
if (accessories.length > 0) {
|
|
279
|
+
this.log.info(`✓ Registered ${accessories.length} closure device(s)`);
|
|
280
|
+
for (const acc of accessories) {
|
|
281
|
+
this.log.info(` - ${acc.displayName}`);
|
|
282
|
+
}
|
|
283
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Section 9: HVAC (Matter Spec § 9)
|
|
288
|
+
*/
|
|
289
|
+
async registerSection9HVAC() {
|
|
290
|
+
this.log.info('═'.repeat(80));
|
|
291
|
+
this.log.info('Section 9: HVAC (Matter Spec § 9)');
|
|
292
|
+
this.log.info('═'.repeat(80));
|
|
293
|
+
const accessories = [];
|
|
294
|
+
// Thermostat
|
|
295
|
+
if (this.config.enableThermostat !== false) {
|
|
296
|
+
const device = new ThermostatAccessory(this.api, this.log);
|
|
297
|
+
accessories.push(device.toAccessory());
|
|
298
|
+
}
|
|
299
|
+
// Fan
|
|
300
|
+
if (this.config.enableFan !== false) {
|
|
301
|
+
const device = new FanAccessory(this.api, this.log);
|
|
302
|
+
accessories.push(device.toAccessory());
|
|
303
|
+
}
|
|
304
|
+
if (accessories.length > 0) {
|
|
305
|
+
this.log.info(`✓ Registered ${accessories.length} HVAC device(s)`);
|
|
306
|
+
for (const acc of accessories) {
|
|
307
|
+
this.log.info(` - ${acc.displayName}`);
|
|
308
|
+
}
|
|
309
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Section 12: Robotic Devices (Matter Spec § 12)
|
|
314
|
+
* ⚠️ IMPORTANT: RVC devices use a DIFFERENT PROCESS (same code) than other devices!
|
|
315
|
+
* When this runs, you'll see separate commissioning codes in the logs for the robot vacuum.
|
|
316
|
+
* Use those codes to pair the vacuum as a separate bridge in your Home app.
|
|
317
|
+
*/
|
|
318
|
+
async registerSection12Robotic() {
|
|
319
|
+
this.log.info('═'.repeat(80));
|
|
320
|
+
this.log.info('Section 12: Robotic Devices (Matter Spec § 12)');
|
|
321
|
+
this.log.info('═'.repeat(80));
|
|
322
|
+
const accessories = [];
|
|
323
|
+
// Robot Vacuum
|
|
324
|
+
if (this.config.enableRobotVacuum !== false) {
|
|
325
|
+
const device = new RoboticVacuumAccessory(this.api, this.log);
|
|
326
|
+
accessories.push(device.toAccessory());
|
|
327
|
+
}
|
|
328
|
+
if (accessories.length > 0) {
|
|
329
|
+
this.log.info(`✓ Registered ${accessories.length} robot vacuum device(s)`);
|
|
330
|
+
for (const acc of accessories) {
|
|
331
|
+
this.log.info(` - ${acc.displayName} (standalone for Apple Home compatibility)`);
|
|
332
|
+
}
|
|
333
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Custom Devices
|
|
338
|
+
*
|
|
339
|
+
* This section demonstrates custom device implementations that go beyond
|
|
340
|
+
* the standard Matter device types. These examples show advanced patterns
|
|
341
|
+
* like managing multiple logical components within a single device.
|
|
342
|
+
*/
|
|
343
|
+
async registerCustomDevices() {
|
|
344
|
+
this.log.info('═'.repeat(80));
|
|
345
|
+
this.log.info('Custom Devices');
|
|
346
|
+
this.log.info('═'.repeat(80));
|
|
347
|
+
const accessories = [];
|
|
348
|
+
// Power Strip (4 Outlets)
|
|
349
|
+
if (this.config.enablePowerStrip !== false) {
|
|
350
|
+
const device = new PowerStripAccessory(this.api, this.log);
|
|
351
|
+
accessories.push(device.toAccessory());
|
|
352
|
+
}
|
|
353
|
+
if (accessories.length > 0) {
|
|
354
|
+
this.log.info(`✓ Registered ${accessories.length} custom device(s)`);
|
|
355
|
+
for (const acc of accessories) {
|
|
356
|
+
this.log.info(` - ${acc.displayName}`);
|
|
357
|
+
}
|
|
358
|
+
await this.api.matter.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, accessories);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
//# sourceMappingURL=platform-matter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-matter.js","sourceRoot":"","sources":["../src/platform-matter.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,mBAAmB,EACnB,8BAA8B,EAC9B,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,EAC3B,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,mBAAmB,EACnB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,M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AC,EAAE,CAAC,CAAC,CAAA;QAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QAC/B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA;QAE7B,MAAM,WAAW,GAAoD,EAAE,CAAA;QAEvE,0BAA0B;QAC1B,IAAI,IAAI,CAAC,MAAM,CAAC,gBAAgB,KAAK,KAAK,EAAE,CAAC;YAC3C,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;YAC1D,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;QACxC,CAAC;QAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,WAAW,CAAC,MAAM,mBAAmB,CAAC,CAAA;YACpE,KAAK,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;gBAC9B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,CAAA;YACzC,CAAC;YACD,MAAM,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,2BAA2B,CAAC,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;QAC5F,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyconfig.test.d.ts","sourceRoot":"","sources":["../src/verifyconfig.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
// Create a minimal mock of the SwitchBotPlatform to test verifyConfig
|
|
3
|
+
class MockSwitchBotPlatform {
|
|
4
|
+
config;
|
|
5
|
+
errorLogCalls = [];
|
|
6
|
+
debugLogCalls = [];
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
errorLog(message) {
|
|
11
|
+
this.errorLogCalls.push(message);
|
|
12
|
+
}
|
|
13
|
+
debugLog(message) {
|
|
14
|
+
this.debugLogCalls.push(message);
|
|
15
|
+
}
|
|
16
|
+
debugWarnLog(message) {
|
|
17
|
+
this.debugLogCalls.push(`WARN: ${message}`);
|
|
18
|
+
}
|
|
19
|
+
debugErrorLog(message) {
|
|
20
|
+
this.debugLogCalls.push(`ERROR: ${message}`);
|
|
21
|
+
}
|
|
22
|
+
// Copy the exact verifyConfig method from the actual platform
|
|
23
|
+
async verifyConfig() {
|
|
24
|
+
this.debugLog('Verifying Config');
|
|
25
|
+
this.config = this.config || {};
|
|
26
|
+
this.config.options = this.config.options || {};
|
|
27
|
+
if (this.config.options) {
|
|
28
|
+
// Device Config
|
|
29
|
+
if (this.config.options.devices) {
|
|
30
|
+
for (const deviceConfig of this.config.options.devices) {
|
|
31
|
+
if (!deviceConfig.hide_device) {
|
|
32
|
+
if (!deviceConfig.deviceId) {
|
|
33
|
+
this.errorLog('The devices config section is missing the *Device ID* in the config. Please check your config.');
|
|
34
|
+
}
|
|
35
|
+
if (!deviceConfig.configDeviceType && deviceConfig.connectionType) {
|
|
36
|
+
this.errorLog('The devices config section is missing the *Device Type* in the config. Please check your config.');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// IR Device Config
|
|
42
|
+
if (this.config.options.irdevices) {
|
|
43
|
+
for (const irDeviceConfig of this.config.options.irdevices) {
|
|
44
|
+
if (!irDeviceConfig.hide_device) {
|
|
45
|
+
if (!irDeviceConfig.deviceId) {
|
|
46
|
+
this.errorLog('The devices config section is missing the *Device ID* in the config. Please check your config.');
|
|
47
|
+
}
|
|
48
|
+
if (!irDeviceConfig.deviceId && !irDeviceConfig.configRemoteType) {
|
|
49
|
+
this.errorLog('The devices config section is missing the *Device Type* in the config. Please check your config.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!this.config.credentials && !this.config.options) {
|
|
56
|
+
this.debugWarnLog('Missing Credentials');
|
|
57
|
+
}
|
|
58
|
+
else if (this.config.credentials && !this.config.credentials.notice) {
|
|
59
|
+
if (!this.config.credentials?.token) {
|
|
60
|
+
this.debugErrorLog('Missing token');
|
|
61
|
+
this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
|
|
62
|
+
}
|
|
63
|
+
if (this.config.credentials?.token) {
|
|
64
|
+
if (!this.config.credentials?.secret) {
|
|
65
|
+
this.debugErrorLog('Missing secret');
|
|
66
|
+
this.debugWarnLog('Cloud Enabled SwitchBot Devices & IR Devices will not work');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
describe('verifyConfig fix for reboot loop', () => {
|
|
73
|
+
it('should log error instead of throwing when device config is missing deviceId', async () => {
|
|
74
|
+
const config = {
|
|
75
|
+
platform: 'SwitchBot',
|
|
76
|
+
name: 'SwitchBot',
|
|
77
|
+
credentials: {
|
|
78
|
+
token: 'test-token',
|
|
79
|
+
secret: 'test-secret',
|
|
80
|
+
},
|
|
81
|
+
options: {
|
|
82
|
+
devices: [
|
|
83
|
+
{
|
|
84
|
+
logging: 'standard',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
const platform = new MockSwitchBotPlatform(config);
|
|
90
|
+
// This should NOT throw an error anymore - it should log instead
|
|
91
|
+
await expect(platform.verifyConfig()).resolves.not.toThrow();
|
|
92
|
+
// Verify that the error was logged instead of thrown
|
|
93
|
+
expect(platform.errorLogCalls).toContain('The devices config section is missing the *Device ID* in the config. Please check your config.');
|
|
94
|
+
});
|
|
95
|
+
it('should log error instead of throwing when device config is missing configDeviceType with connectionType', async () => {
|
|
96
|
+
const config = {
|
|
97
|
+
platform: 'SwitchBot',
|
|
98
|
+
name: 'SwitchBot',
|
|
99
|
+
credentials: {
|
|
100
|
+
token: 'test-token',
|
|
101
|
+
secret: 'test-secret',
|
|
102
|
+
},
|
|
103
|
+
options: {
|
|
104
|
+
devices: [
|
|
105
|
+
{
|
|
106
|
+
deviceId: 'test-device-id',
|
|
107
|
+
connectionType: 'BLE',
|
|
108
|
+
// Missing configDeviceType
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
const platform = new MockSwitchBotPlatform(config);
|
|
114
|
+
// This should NOT throw an error anymore - it should log instead
|
|
115
|
+
await expect(platform.verifyConfig()).resolves.not.toThrow();
|
|
116
|
+
// Verify that the error was logged instead of thrown
|
|
117
|
+
expect(platform.errorLogCalls).toContain('The devices config section is missing the *Device Type* in the config. Please check your config.');
|
|
118
|
+
});
|
|
119
|
+
it('should not log error when device config has hide_device set to true', async () => {
|
|
120
|
+
const config = {
|
|
121
|
+
platform: 'SwitchBot',
|
|
122
|
+
name: 'SwitchBot',
|
|
123
|
+
credentials: {
|
|
124
|
+
token: 'test-token',
|
|
125
|
+
secret: 'test-secret',
|
|
126
|
+
},
|
|
127
|
+
options: {
|
|
128
|
+
devices: [
|
|
129
|
+
{
|
|
130
|
+
hide_device: true,
|
|
131
|
+
// Missing deviceId but hidden
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
const platform = new MockSwitchBotPlatform(config);
|
|
137
|
+
// Should not throw or log errors because device is hidden
|
|
138
|
+
await expect(platform.verifyConfig()).resolves.not.toThrow();
|
|
139
|
+
expect(platform.errorLogCalls).toHaveLength(0);
|
|
140
|
+
});
|
|
141
|
+
it('should handle valid device config without errors', async () => {
|
|
142
|
+
const config = {
|
|
143
|
+
platform: 'SwitchBot',
|
|
144
|
+
name: 'SwitchBot',
|
|
145
|
+
credentials: {
|
|
146
|
+
token: 'test-token',
|
|
147
|
+
secret: 'test-secret',
|
|
148
|
+
},
|
|
149
|
+
options: {
|
|
150
|
+
devices: [
|
|
151
|
+
{
|
|
152
|
+
deviceId: 'test-device-id',
|
|
153
|
+
configDeviceType: 'Bot',
|
|
154
|
+
logging: 'standard',
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
const platform = new MockSwitchBotPlatform(config);
|
|
160
|
+
// Should not throw or log device config errors with valid config
|
|
161
|
+
await expect(platform.verifyConfig()).resolves.not.toThrow();
|
|
162
|
+
// Should not have device config errors
|
|
163
|
+
expect(platform.errorLogCalls.filter(msg => msg.includes('missing the *Device ID*') ||
|
|
164
|
+
msg.includes('missing the *Device Type*'))).toHaveLength(0);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
//# sourceMappingURL=verifyconfig.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifyconfig.test.js","sourceRoot":"","sources":["../src/verifyconfig.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAM,MAAM,QAAQ,CAAA;AAGjD,sEAAsE;AACtE,MAAM,qBAAqB;IACzB,MAAM,CAAyB;IAC/B,aAAa,GAAa,EAAE,CAAA;IAC5B,aAAa,GAAa,EAAE,CAAA;IAE5B,YAAY,MAA+B;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,QAAQ,CAAC,OAAe;QACtB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAClC,CAAC;IAED,QAAQ,CAAC,OAAe;QACtB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAClC,CAAC;IAED,YAAY,CAAC,OAAe;QAC1B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,OAAO,EAAE,CAAC,CAAA;IAC7C,CAAC;IAED,aAAa,CAAC,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