@gbridge0/homebridge-ambient-weather-sensors
Advanced tools
Comparing version 1.2.12 to 1.2.13
@@ -8,8 +8,4 @@ import { PlatformAccessory } from 'homebridge'; | ||
constructor(platform: AmbientWeatherSensorsPlatform, accessory: PlatformAccessory); | ||
/** | ||
* Handle requests to get the current value of the "Current Temperature" characteristic | ||
*/ | ||
handleCurrentRelativeHumidityGet(): any; | ||
private updateData; | ||
} | ||
//# sourceMappingURL=humidityAccessory.d.ts.map |
@@ -19,19 +19,8 @@ "use strict"; | ||
this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.context.device.displayName); | ||
// this.updateData(); | ||
// setInterval(this.updateData.bind(this), 2 * 60 * 1000); | ||
} | ||
/** | ||
* Handle requests to get the current value of the "Current Temperature" characteristic | ||
*/ | ||
handleCurrentRelativeHumidityGet() { | ||
this.platform.log.debug('Triggered GET CurrentRelativeHumidity'); | ||
this.updateData(); | ||
// set this to a valid value for CurrentRelativeHumidity | ||
const currentValue = this.accessory.context.device.value; | ||
this.platform.log.debug(`CurrentHumidity: ${currentValue}`); | ||
return currentValue; | ||
setInterval(this.updateData.bind(this), 2 * 60 * 1000); | ||
} | ||
async updateData() { | ||
this.platform.log.debug('Updating CurrentHumidity Data'); | ||
const Devices = await this.platform.fetchDevices(); | ||
this.platform.log.debug(`${this.accessory.context.device.displayName}:Updating CurrentHumidity Data`); | ||
const Devices = this.platform.fetchDevices(); | ||
if (Devices !== undefined && Devices !== null) { | ||
@@ -42,4 +31,4 @@ const sensor = Devices.filter((o) => { | ||
const value = sensor[0].value; | ||
this.platform.log.debug(`SET CurrentHumidity: ${value}`); | ||
this.service.setCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, value); | ||
this.platform.log.debug(`${this.accessory.context.device.displayName}:SET CurrentHumidity: ${value}`); | ||
this.service.getCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity).updateValue(value); | ||
} | ||
@@ -46,0 +35,0 @@ } |
@@ -141,2 +141,7 @@ "use strict"; | ||
const Devices = await this.fetchDevicesFromAPI(); | ||
// before we continue, add 5 seconds delay. This is to create a 5 second gap | ||
// between future AWN API call and accessories data update. | ||
// Both of them are set to 2 minutes interval, so this increase the chance that | ||
// the API call will finish before the accessory data update. | ||
await this.sleep(5000); | ||
// remove any existing accessories that arent returned by the API | ||
@@ -143,0 +148,0 @@ this.deregisterAccessories(Devices); |
@@ -5,3 +5,3 @@ { | ||
"name": "@gbridge0/homebridge-ambient-weather-sensors", | ||
"version": "1.2.12", | ||
"version": "1.2.13", | ||
"description": "Utilizes the ambient weather API to retrie sensor information.", | ||
@@ -8,0 +8,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
616456
584