@gbridge0/homebridge-ambient-weather-sensors
Advanced tools
Comparing version 1.2.11 to 1.2.12
@@ -30,2 +30,5 @@ "use strict"; | ||
this.discoverDevices(); | ||
// Fetch data from AWN API and write to cache every 2 minutes | ||
this.log.info('AWPlatform: Setting up interval to fetch sensors from AWN API every 2 minutes'); | ||
setInterval(this.fetchDevicesFromAPI.bind(this), 2 * 60 * 1000); | ||
}); | ||
@@ -98,3 +101,3 @@ } | ||
async fetchDevicesFromAPI() { | ||
this.log.debug('----- Fetching sensors from ambientweather API -----'); | ||
this.log.info('AWS platform: --- Fetching sensors from ambientweather API -----'); | ||
try { | ||
@@ -185,5 +188,2 @@ const url = `https://rt.ambientweather.net/v1/devices?applicationKey=${this.config.applicationKey}&apiKey=${this.config.apiKey}`; | ||
} | ||
// load from remote API every 2 minutes | ||
this.log.debug('Setting up interval to fetch sensors from remote API every 2 minutes'); | ||
setInterval(this.fetchDevicesFromAPI.bind(this), 2 * 60 * 1000); | ||
} | ||
@@ -190,0 +190,0 @@ catch (error) { |
@@ -18,5 +18,2 @@ "use strict"; | ||
this.service.setCharacteristic(this.platform.Characteristic.Name, accessory.context.device.displayName); | ||
// create handlers for required characteristics | ||
// this.service.getCharacteristic(this.platform.Characteristic.CurrentTemperature) | ||
// .on('get', this.handleCurrentTemperatureGet.bind(this)); | ||
this.updateData(); | ||
@@ -39,3 +36,3 @@ setInterval(this.updateData.bind(this), 2 * 60 * 1000); | ||
updateData() { | ||
this.platform.log.debug('Updating CurrentTemperature Data'); | ||
this.platform.log.debug(`${this.accessory.context.device.displayName}: Updating CurrentTemperature Data`); | ||
const Devices = this.platform.fetchDevices(); | ||
@@ -47,5 +44,4 @@ if (Devices !== undefined && Devices !== null) { | ||
const value = sensor[0].value; | ||
this.platform.log.debug(`SET CurrentTemperature: ${value}`); | ||
this.platform.log.debug(`${this.accessory.context.device.displayName}: SET CurrentTemperature: ${value}`); | ||
this.service.getCharacteristic(this.platform.Characteristic.CurrentTemperature).updateValue(this.fahrenheitToCelsius(value)); | ||
//this.service.setCharacteristic(this.platform.Characteristic.CurrentTemperature, this.fahrenheitToCelsius(value)); | ||
} | ||
@@ -52,0 +48,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"name": "@gbridge0/homebridge-ambient-weather-sensors", | ||
"version": "1.2.11", | ||
"version": "1.2.12", | ||
"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
616662
594