Add ActivityAccessory
This commit is contained in:
+15
@@ -11,6 +11,7 @@ import { environmentSensorAccessory } from './environmentSensorAccessory'
|
||||
import { doorWindowSensorAccessory } from './doorWindowSensorAccessory'
|
||||
import { motionSensorAccessory } from './motionSensorAccessory'
|
||||
import { cameraAccessory } from './cameraAccessory'
|
||||
import { activityAccessory } from './activityAccessory'
|
||||
import { httpServer } from './httpServer'
|
||||
|
||||
export class domoticaPlatform implements DynamicPlatformPlugin {
|
||||
@@ -111,6 +112,16 @@ export class domoticaPlatform implements DynamicPlatformPlugin {
|
||||
.catch((error) => {
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
||||
processDiscoveredDevices(domoticaDevices: device[]) {
|
||||
@@ -143,6 +154,8 @@ 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 {
|
||||
this.log.info('+ ' + device.type + ': ' + device.deviceName)
|
||||
@@ -164,6 +177,8 @@ 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))
|
||||
}
|
||||
|
||||
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory])
|
||||
|
||||
Reference in New Issue
Block a user