Add ThermostatAccessory

This commit is contained in:
2025-03-03 14:38:41 +01:00
parent 2620420ed5
commit 99bd9361cd
3 changed files with 228 additions and 5 deletions
+15 -5
View File
@@ -11,7 +11,7 @@ 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 { httpServer } from './httpServer'
export class domoticaPlatform implements DynamicPlatformPlugin {
@@ -122,6 +122,16 @@ export class domoticaPlatform implements DynamicPlatformPlugin {
.catch((error) => {
this.log.debug('activityAccessory.discoverDevices Error ->' + error)
})
this.discoveryStarted('thermostatAccessory')
thermostatAccessory.discoverDevices(this)
.then((devices) => {
this.processDiscoveredDevices(devices)
this.discoveryCompleted('thermostatAccessory')
})
.catch((error) => {
this.log.debug('thermostatAccessory.discoverDevices Error ->' + error)
})
}
processDiscoveredDevices(domoticaDevices: device[]) {
@@ -154,8 +164,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 if (existingAccessory.context.device.type == 'Thermostat') {
this.accessories.push(new thermostatAccessory(this, existingAccessory))
}
} else {
this.log.info('+ ' + device.type + ': ' + device.deviceName)
@@ -177,8 +187,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))
} else if (accessory.context.device.type == 'Thermostat') {
this.accessories.push(new thermostatAccessory(this, accessory))
}
this.api.registerPlatformAccessories(PLUGIN_NAME, PLATFORM_NAME, [accessory])