Add SmokeDetectorAccessory

This commit is contained in:
2025-03-03 14:40:36 +01:00
parent 99bd9361cd
commit 6634f66820
2 changed files with 204 additions and 9 deletions
+44 -9
View File
@@ -11,7 +11,10 @@ import { environmentSensorAccessory } from './environmentSensorAccessory'
import { doorWindowSensorAccessory } from './doorWindowSensorAccessory'
import { motionSensorAccessory } from './motionSensorAccessory'
import { cameraAccessory } from './cameraAccessory'
//import { activityAccessory } from './activityAccessory'
import { thermostatAccessory } from './thermostatAccessory'
import { smokeDetectorAccessory } from './smokeDetectorAccessory'
import { securitySystemAccessory } from './securitySystemAccessory'
import { httpServer } from './httpServer'
export class domoticaPlatform implements DynamicPlatformPlugin {
@@ -113,15 +116,15 @@ export class domoticaPlatform implements DynamicPlatformPlugin {
this.log.debug('cameraAccessory.discoverDevices Error ->' + error)
})
this.discoveryStarted('activityAccessory')
activityAccessory.discoverDevices(this)
.then((devices) => {
this.processDiscoveredDevices(devices)
this.discoveryCompleted('activityAccessory')
})
.catch((error) => {
this.log.debug('activityAccessory.discoverDevices Error ->' + error)
})
// this.discoveryStarted('activityAccessory')
// activityAccessory.discoverDevices(this)
// .then((devices) => {
// this.processDiscoveredDevices(devices)
// this.discoveryCompleted('activityAccessory')
// })
// .catch((error) => {
// this.log.debug('activityAccessory.discoverDevices Error ->' + error)
// })
this.discoveryStarted('thermostatAccessory')
thermostatAccessory.discoverDevices(this)
@@ -132,6 +135,26 @@ export class domoticaPlatform implements DynamicPlatformPlugin {
.catch((error) => {
this.log.debug('thermostatAccessory.discoverDevices Error ->' + error)
})
this.discoveryStarted('smokeDetectorAccessory')
smokeDetectorAccessory.discoverDevices(this)
.then((devices) => {
this.processDiscoveredDevices(devices)
this.discoveryCompleted('smokeDetectorAccessory')
})
.catch((error) => {
this.log.debug('smokeDetectorAccessory.discoverDevices Error ->' + error)
})
this.discoveryStarted('securitySystemAccessory')
securitySystemAccessory.discoverDevices(this)
.then((devices) => {
this.processDiscoveredDevices(devices)
this.discoveryCompleted('securitySystemAccessory')
})
.catch((error) => {
this.log.debug('securitySystemAccessory.discoverDevices Error ->' + error)
})
}
processDiscoveredDevices(domoticaDevices: device[]) {
@@ -164,8 +187,14 @@ export class domoticaPlatform implements DynamicPlatformPlugin {
this.accessories.push(new motionSensorAccessory(this, existingAccessory))
} else if (existingAccessory.context.device.type == 'Camera') {
this.accessories.push(new cameraAccessory(this, existingAccessory))
// } else if (existingAccessory.context.device.type == 'Activity') {
// this.accessories.push(new activityAccessory(this, existingAccessory))
} else if (existingAccessory.context.device.type == 'Thermostat') {
this.accessories.push(new thermostatAccessory(this, existingAccessory))
} else if (existingAccessory.context.device.type == 'SmokeDetector') {
this.accessories.push(new smokeDetectorAccessory(this, existingAccessory))
} else if (existingAccessory.context.device.type == 'SecuritySystem') {
this.accessories.push(new securitySystemAccessory(this, existingAccessory))
}
} else {
this.log.info('+ ' + device.type + ': ' + device.deviceName)
@@ -187,8 +216,14 @@ export class domoticaPlatform implements DynamicPlatformPlugin {
this.accessories.push(new motionSensorAccessory(this, accessory))
} else if (accessory.context.device.type == 'Camera') {
this.accessories.push(new cameraAccessory(this, accessory))
// } else if (accessory.context.device.type == 'Activity') {
// this.accessories.push(new activityAccessory(this, accessory))
} else if (accessory.context.device.type == 'Thermostat') {
this.accessories.push(new thermostatAccessory(this, accessory))
} else if (accessory.context.device.type == 'SmokeDetector') {
this.accessories.push(new smokeDetectorAccessory(this, accessory))
} else if (accessory.context.device.type == 'SecuritySystem') {
this.accessories.push(new securitySystemAccessory(this, accessory))
}
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory])