Skip to content

Commit

Permalink
Added rounding for non metric values in Apple Home app
Browse files Browse the repository at this point in the history
  • Loading branch information
naofireblade committed Nov 30, 2019
1 parent 5769bc3 commit 7b8cec3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,7 @@
* Updated readme

## 3.0.2
* Updated readme
* Updated readme

## 3.0.3
* Added rounding for non metric values in Apple Home app
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
This is a weather plugin for [homebridge](https://github.com/nfarina/homebridge) that features current observations, daily forecasts and history graphs for multiple locations and services. You can download it via [npm](https://www.npmjs.com/package/homebridge-weather-plus).

![Screenshots](https://user-images.githubusercontent.com/12081369/69379083-feb05300-0caf-11ea-9a0d-cf8e1879d007.png)

>Screenshots 2 and 3 are taken from the Elgato Eve app.
*Screenshots 2 and 3 are taken from the Elgato Eve app.*

If you like this plugin and find it useful, I would be forever grateful for your support:

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-weather-plus",
"version": "3.0.2",
"version": "3.0.3",
"description": "A comprehensive weather plugin for homekit with current observations, forecasts and history.",
"license": "MIT",
"keywords": [
Expand Down
8 changes: 4 additions & 4 deletions util/characteristics.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = function (Characteristic, units)
};
var rainfallValue = (val) =>
{
return (units !== 'imperial') ? val : (val / 25.4);
return (units !== 'imperial') ? val : Math.round(val / 25.4 * 100) / 100;
};

var c2f = (celsius) =>
Expand All @@ -88,7 +88,7 @@ module.exports = function (Characteristic, units)
};
var visibilityProps = (max) =>
{
var range = ((units === 'si') || (units == 'ca')) ? {unit: 'km', maxValue: max, minValue: 0}
var range = ((units === 'si') || (units === 'ca')) ? {unit: 'km', maxValue: max, minValue: 0}
: {unit: 'mi', maxValue: km2mi(max), minValue: 0};

return underscore.extend(
Expand All @@ -105,11 +105,11 @@ module.exports = function (Characteristic, units)

var mtos2kmh = (m) =>
{
return ((m * 3600) / 1000);
return (Math.round(m * 3.6 * 10) / 10);
};
var mtos2mih = (m) =>
{
return ((m * 3600) / 1609.34);
return (Math.round(((m * 3600) / 1609.34) * 10) / 10);
};
var windspeedProps = (max) =>
{
Expand Down

0 comments on commit 7b8cec3

Please sign in to comment.