homebridge-weatherlink-cloud 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.schema.json +12 -0
- package/index.js +21 -41
- package/package.json +3 -3
package/config.schema.json
CHANGED
|
@@ -36,6 +36,18 @@
|
|
|
36
36
|
"type": "integer",
|
|
37
37
|
"default": 15,
|
|
38
38
|
"minimum": 1
|
|
39
|
+
},
|
|
40
|
+
"manufacturer": {
|
|
41
|
+
"title": "Manufacturer",
|
|
42
|
+
"description": "Shown in the Home app accessory tails. Defaults to Davis Instruments.",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"default": "Davis Instruments"
|
|
45
|
+
},
|
|
46
|
+
"model": {
|
|
47
|
+
"title": "Model",
|
|
48
|
+
"description": "Shown in the Home app accessory details. Defaults to Vantage Vue.",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"default": "Vantage Vue"
|
|
39
51
|
}
|
|
40
52
|
}
|
|
41
53
|
}
|
package/index.js
CHANGED
|
@@ -1,24 +1,3 @@
|
|
|
1
|
-
// homebridge-weatherlink-cloud — starter skeleton
|
|
2
|
-
//
|
|
3
|
-
// A Homebridge dynamic platform plugin that polls the WeatherLink v2 cloud
|
|
4
|
-
// API and exposes your Vantage Vue readings to HomeKit.
|
|
5
|
-
//
|
|
6
|
-
// Pairs with a minimal package.json (see notes at bottom of this file).
|
|
7
|
-
//
|
|
8
|
-
// config.json example:
|
|
9
|
-
// {
|
|
10
|
-
// "platforms": [
|
|
11
|
-
// {
|
|
12
|
-
// "platform": "WeatherLinkCloud",
|
|
13
|
-
// "name": "WeatherLink",
|
|
14
|
-
// "apiKey": "YOUR_V2_API_KEY",
|
|
15
|
-
// "apiSecret": "YOUR_V2_API_SECRET",
|
|
16
|
-
// "stationId": 123456,
|
|
17
|
-
// "pollMinutes": 15
|
|
18
|
-
// }
|
|
19
|
-
// ]
|
|
20
|
-
// }
|
|
21
|
-
|
|
22
1
|
'use strict';
|
|
23
2
|
|
|
24
3
|
const https = require('https');
|
|
@@ -80,6 +59,10 @@ class WeatherLinkCloudPlatform {
|
|
|
80
59
|
this.tempAcc = this.getOrCreate('outTemp', 'Outdoor Temperature', Service.TemperatureSensor);
|
|
81
60
|
this.humAcc = this.getOrCreate('outHum', 'Outdoor Humidity', Service.HumiditySensor);
|
|
82
61
|
|
|
62
|
+
// Indoor readings come from the console's own barometer/inside sensor block.
|
|
63
|
+
this.tempInAcc = this.getOrCreate('inTemp', 'Indoor Temperature', Service.TemperatureSensor);
|
|
64
|
+
this.humInAcc = this.getOrCreate('inHum', 'Indoor Humidity', Service.HumiditySensor);
|
|
65
|
+
|
|
83
66
|
// Wind / rain / pressure / UV have NO native HomeKit service.
|
|
84
67
|
// Options to surface them:
|
|
85
68
|
// - Eve custom characteristics (shown in the Eve app, ignored by Home app)
|
|
@@ -133,12 +116,14 @@ class WeatherLinkCloudPlatform {
|
|
|
133
116
|
// against your own dump — they live in °F and %.
|
|
134
117
|
|
|
135
118
|
const sensors = (data && data.sensors) || [];
|
|
136
|
-
let tempF, hum;
|
|
119
|
+
let tempF, hum, tempInF, humIn;
|
|
137
120
|
|
|
138
121
|
for (const s of sensors) {
|
|
139
122
|
const d = (s.data && s.data[0]) || {};
|
|
140
|
-
if (typeof d.temp === 'number') tempF = d.temp;
|
|
141
|
-
if (typeof d.hum === 'number') hum = d.hum;
|
|
123
|
+
if (typeof d.temp === 'number') tempF = d.temp; // outdoor temp, °F
|
|
124
|
+
if (typeof d.hum === 'number') hum = d.hum; // outdoor RH, %
|
|
125
|
+
if (typeof d.temp_in === 'number') tempInF = d.temp_in; // indoor temp, °F
|
|
126
|
+
if (typeof d.hum_in === 'number') humIn = d.hum_in; // indoor RH, %
|
|
142
127
|
// Other fields you'll likely find here once you dump the payload:
|
|
143
128
|
// d.wind_speed_last, d.wind_dir_last, d.rainfall_daily,
|
|
144
129
|
// d.bar_sea_level, d.uv_index, d.solar_rad ...
|
|
@@ -155,21 +140,16 @@ class WeatherLinkCloudPlatform {
|
|
|
155
140
|
.getService(Service.HumiditySensor)
|
|
156
141
|
.updateCharacteristic(Characteristic.CurrentRelativeHumidity, hum);
|
|
157
142
|
}
|
|
143
|
+
if (typeof tempInF === 'number') {
|
|
144
|
+
const tempInC = ((tempInF - 32) * 5) / 9;
|
|
145
|
+
this.tempInAcc
|
|
146
|
+
.getService(Service.TemperatureSensor)
|
|
147
|
+
.updateCharacteristic(Characteristic.CurrentTemperature, tempInC);
|
|
148
|
+
}
|
|
149
|
+
if (typeof humIn === 'number') {
|
|
150
|
+
this.humInAcc
|
|
151
|
+
.getService(Service.HumiditySensor)
|
|
152
|
+
.updateCharacteristic(Characteristic.CurrentRelativeHumidity, humIn);
|
|
153
|
+
}
|
|
158
154
|
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// --- Minimal package.json to sit beside this file -------------------------
|
|
162
|
-
// {
|
|
163
|
-
// "name": "homebridge-weatherlink-cloud",
|
|
164
|
-
// "version": "0.1.0",
|
|
165
|
-
// "main": "index.js",
|
|
166
|
-
// "engines": { "homebridge": ">=1.6.0", "node": ">=18" },
|
|
167
|
-
// "keywords": ["homebridge-plugin"]
|
|
168
|
-
// }
|
|
169
|
-
//
|
|
170
|
-
// Dev loop:
|
|
171
|
-
// 1. mkdir homebridge-weatherlink-cloud && cd it; add index.js + package.json
|
|
172
|
-
// 2. npm install -g . (or `npm link`) into your Homebridge install
|
|
173
|
-
// 3. add the platform block to Homebridge config.json
|
|
174
|
-
// 4. restart Homebridge, watch the logs, dump the payload, map fields
|
|
175
|
-
// --------------------------------------------------------------------------
|
|
155
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-weatherlink-cloud",
|
|
3
3
|
"displayName": "WeatherLink Cloud",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "Exposes Davis WeatherLink (v2 cloud API) weather data to HomeKit via Homebridge.",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"author": "
|
|
8
|
+
"author": "Niels Wouters",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+https://github.com/mediatecture/homebridge-weatherlink-cloud.git"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"engines": {
|
|
17
17
|
"homebridge": "^1.6.0 || ^2.0.0",
|
|
18
|
-
"node": "^18 || ^20 || ^22"
|
|
18
|
+
"node": "^18 || ^20 || ^22 || ^24"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"homebridge-plugin",
|