diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c75e2b..157a26f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -219,3 +219,6 @@ * Added compatibility sensor for total precipitation * Changed precision of WeatherUnderground API to decimal * Fixed crash when OpenWeatherMap API returns no data + +## 3.2.3 +* Fixed apparent temperature and dew point not responding if lower than 0°C \ No newline at end of file diff --git a/accessories/currentConditions.js b/accessories/currentConditions.js index 793819e..9b81a1b 100644 --- a/accessories/currentConditions.js +++ b/accessories/currentConditions.js @@ -59,8 +59,7 @@ function CurrentConditionsWeatherAccessory(platform, stationIndex) // Temperature is an official homekit characteristic if (name === "Temperature") { - // Fix for negative temperatures, because they are not supported by homekit - this.CurrentConditionsService.getCharacteristic(Characteristic.CurrentTemperature).props.minValue = -50; + // Nothing } // Use separate services for these characteristics if compatiblity is "home" else if (this.config.compatibility === "home" && compatibility.types.includes(name)) @@ -120,11 +119,10 @@ CurrentConditionsWeatherAccessory.prototype = { debug("Service: %s", key); this[key].characteristics.forEach((characteristic) => { - if (characteristic.displayName === "Name") - { - debug(" - UUID: %s", characteristic.UUID); - debug(" - Value: %s", characteristic.value); - } + debug(" - Characteristic: %s", characteristic.displayName); + debug(" - UUID: %s", characteristic.UUID); + debug(" - Value: %s", characteristic.value); + debug(" - Props: %s", characteristic.props); }); } }); diff --git a/accessories/forecast.js b/accessories/forecast.js index 2ac2eb0..a389350 100644 --- a/accessories/forecast.js +++ b/accessories/forecast.js @@ -70,8 +70,7 @@ function ForecastWeatherAccessory(platform, stationIndex, day) // Temperature is an official homekit characteristic if (name === "TemperatureMax") { - // Fix for negative temperatures, because they are not supported by homekit - this.ForecastService.getCharacteristic(Characteristic.CurrentTemperature).props.minValue = -50; + // Nothing } // Use separate services for these characteristics if compatiblity is "home" else if (this.config.compatibility === "home" && compatibility.types.includes(name)) @@ -123,11 +122,10 @@ ForecastWeatherAccessory.prototype = { debug("Service: %s", key); this[key].characteristics.forEach((characteristic) => { - if (characteristic.displayName === "Name") - { - debug(" - UUID: %s", characteristic.UUID); - debug(" - Value: %s", characteristic.value); - } + debug(" - Characteristic: %s", characteristic.displayName); + debug(" - UUID: %s", characteristic.UUID); + debug(" - Value: %s", characteristic.value); + debug(" - Props: %s", characteristic.props); }); } }); diff --git a/package.json b/package.json index 2da04d3..aa52fa0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homebridge-weather-plus", - "version": "3.2.2", + "version": "3.2.3", "description": "A comprehensive weather plugin for homekit with current observations, forecasts and history.", "license": "MIT", "keywords": [ diff --git a/util/characteristics.js b/util/characteristics.js index 640b177..b09ac9a 100644 --- a/util/characteristics.js +++ b/util/characteristics.js @@ -45,16 +45,16 @@ function round(value, decimals) module.exports = function (Characteristic, units) { - units = // rainfail temperature visibility windspeed airpressure + units = // rainfail temperature visibility windspeed airpressure { - ca: 'ca' // mm celsius kilometers km/hour hPa - , imperial: 'imperial' // inches fahrenheit miles miles/hour hPa - , si: 'si' // mm celsius kilometers m/second hPa - , sitorr: 'sitorr' // mm celsius kilometers m/second mmhg - , uk: 'uk' // mm celsius miles miles/hour hPa - - , metric: 'si' - , us: 'imperial' + ca: 'ca', // mm celsius kilometers km/hour hPa + imperial: 'imperial', + us: 'imperial', // inches fahrenheit miles miles/hour hPa + si: 'si', + metric: 'si', // mm celsius kilometers m/second hPa + sitorr: 'sitorr', // mm celsius kilometers m/second mmhg + uk: 'uk' // mm celsius miles miles/hour hPa + }[units.toLowerCase()]; if (!units) units = 'si'; @@ -78,15 +78,15 @@ module.exports = function (Characteristic, units) { return (celsius * 1.8) + 32; }; - var temperatureProps = (max, min) => + var temperatureProps = (min, max) => { var range = (units !== 'imperial') ? {unit: Characteristic.Units.CELSIUS, maxValue: max, minValue: min} : {unit: 'fahrenheit', maxValue: c2f(max), minValue: c2f(min)}; return underscore.extend( { - format: Characteristic.Formats.UINT8 - , minStep: 1 + format: Characteristic.Formats.FLOAT + , minStep: 0.1 , perms: [Characteristic.Perms.READ, Characteristic.Perms.NOTIFY] }, range); }; @@ -213,11 +213,11 @@ module.exports = function (Characteristic, units) CustomCharacteristic.DewPoint = function () { Characteristic.call(this, 'Dew Point', CustomUUID.DewPoint); - this.setProps(temperatureProps(50, -50)); + this.setProps(temperatureProps(-50, 100)); this.value = this.getDefaultValue(); }; inherits(CustomCharacteristic.DewPoint, Characteristic); - // Homekit converts temperature by itself accoding to the user device settings + // Homekit converts temperature by itself according to the user device settings CustomCharacteristic.ForecastDay = function () { @@ -369,7 +369,7 @@ module.exports = function (Characteristic, units) CustomCharacteristic.TemperatureMin = function () { Characteristic.call(this, 'Temperature Min', CustomUUID.TemperatureMin); - this.setProps(temperatureProps(50, -50)); + this.setProps(temperatureProps(-50, 100)); this.value = this.getDefaultValue(); }; inherits(CustomCharacteristic.TemperatureMin, Characteristic); @@ -378,7 +378,7 @@ module.exports = function (Characteristic, units) CustomCharacteristic.TemperatureApparent = function () { Characteristic.call(this, 'Apparent temperature', CustomUUID.TemperatureApparent); - this.setProps(temperatureProps(50, -50)); + this.setProps(temperatureProps(-50, 100)); this.value = this.getDefaultValue(); }; inherits(CustomCharacteristic.TemperatureApparent, Characteristic);