homebridge-weatherlink-cloud 0.1.0 → 0.1.3
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 +42 -0
- package/index.js +21 -41
- package/package.json +15 -15
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginAlias": "WeatherLinkCloud",
|
|
3
|
+
"pluginType": "platform",
|
|
4
|
+
"singular": true,
|
|
5
|
+
"headerDisplay": "Pulls current conditions from the WeatherLink v2 cloud API and exposes them to HomeKit. Get your API Key and Secret from the lower-left of your account page at weatherlink.com.",
|
|
6
|
+
"schema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"name": {
|
|
10
|
+
"title": "Name",
|
|
11
|
+
"type": "string",
|
|
12
|
+
"default": "WeatherLink",
|
|
13
|
+
"required": true
|
|
14
|
+
},
|
|
15
|
+
"apiKey": {
|
|
16
|
+
"title": "API Key",
|
|
17
|
+
"description": "The v2 API key (sent as the api-key query parameter).",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"required": true
|
|
20
|
+
},
|
|
21
|
+
"apiSecret": {
|
|
22
|
+
"title": "API Secret",
|
|
23
|
+
"description": "The v2 API secret (sent as the X-Api-Secret header).",
|
|
24
|
+
"type": "string",
|
|
25
|
+
"required": true
|
|
26
|
+
},
|
|
27
|
+
"stationId": {
|
|
28
|
+
"title": "Station ID",
|
|
29
|
+
"description": "Numeric station ID from GET /v2/stations.",
|
|
30
|
+
"type": "integer",
|
|
31
|
+
"required": true
|
|
32
|
+
},
|
|
33
|
+
"pollMinutes": {
|
|
34
|
+
"title": "Poll interval (minutes)",
|
|
35
|
+
"description": "Match your weatherlink.com tier: ~15 (free) or ~5 (Pro). Polling faster than the data refreshes just wastes API calls.",
|
|
36
|
+
"type": "integer",
|
|
37
|
+
"default": 15,
|
|
38
|
+
"minimum": 1
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
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,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-weatherlink-cloud",
|
|
3
3
|
"displayName": "WeatherLink Cloud",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.3",
|
|
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
|
-
|
|
11
|
-
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/mediatecture/homebridge-weatherlink-cloud.git"
|
|
12
12
|
},
|
|
13
13
|
"bugs": {
|
|
14
|
-
|
|
14
|
+
"url": "https://github.com/mediatecture/homebridge-weatherlink-cloud/issues"
|
|
15
15
|
},
|
|
16
16
|
"engines": {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
"homebridge": "^1.6.0 || ^2.0.0",
|
|
18
|
+
"node": "^18 || ^20 || ^22 || ^24"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
"homebridge-plugin",
|
|
22
|
+
"weatherlink",
|
|
23
|
+
"davis",
|
|
24
|
+
"vantage-vue",
|
|
25
|
+
"weather"
|
|
26
26
|
],
|
|
27
27
|
"files": [
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
"index.js",
|
|
29
|
+
"config.schema.json"
|
|
30
30
|
]
|
|
31
|
-
}
|
|
31
|
+
}
|