homebridge-bedjet 0.3.4 → 0.3.5
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 +5 -5
- package/dist/accessory.js +10 -2
- package/homebridge-ui/public/index.html +14 -6
- package/package.json +1 -1
- package/src/accessory.ts +10 -2
- package/src/bedjet/types.ts +1 -1
package/config.schema.json
CHANGED
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"description": "Mode to activate when the BedJet is turned on from HomeKit"
|
|
47
47
|
},
|
|
48
48
|
"defaultTemperature": {
|
|
49
|
-
"title": "Default Temperature °
|
|
49
|
+
"title": "Default Temperature °F (when turned on)",
|
|
50
50
|
"type": "number",
|
|
51
|
-
"minimum":
|
|
52
|
-
"maximum":
|
|
53
|
-
"multipleOf":
|
|
54
|
-
"description": "Target temperature to set when turned on. Range:
|
|
51
|
+
"minimum": 66,
|
|
52
|
+
"maximum": 109,
|
|
53
|
+
"multipleOf": 1,
|
|
54
|
+
"description": "Target temperature to set when turned on, in °F. Range: 66–109°F. Leave blank to keep the BedJet's last-used temperature."
|
|
55
55
|
},
|
|
56
56
|
"defaultFanSpeed": {
|
|
57
57
|
"title": "Default Fan Speed % (when turned on)",
|
package/dist/accessory.js
CHANGED
|
@@ -171,8 +171,16 @@ class BedJetAccessory {
|
|
|
171
171
|
await this.bedjet.setOperatingMode(mode);
|
|
172
172
|
if (applyDefaults) {
|
|
173
173
|
if (config.defaultTemperature !== undefined) {
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
// Config stores °F (values > 43 are unambiguously Fahrenheit).
|
|
175
|
+
// Old configs stored °C (≤ 43) — leave those as-is for backward compat.
|
|
176
|
+
let tempC = config.defaultTemperature;
|
|
177
|
+
if (tempC > 43) {
|
|
178
|
+
tempC = (tempC - 32) * 5 / 9;
|
|
179
|
+
}
|
|
180
|
+
// Clamp to BedJet V3 valid range 19–43 °C, rounded to nearest 0.5
|
|
181
|
+
tempC = Math.max(19, Math.min(43, Math.round(tempC * 2) / 2));
|
|
182
|
+
this.setPending(tempC, 'pendingTemp', 'pendingTempTimer', 5000);
|
|
183
|
+
await this.bedjet.setTemperature(tempC);
|
|
176
184
|
}
|
|
177
185
|
if (config.defaultFanSpeed !== undefined) {
|
|
178
186
|
this.setPending(config.defaultFanSpeed, 'pendingFanSpeed', 'pendingFanSpeedTimer', 5000);
|
|
@@ -362,19 +362,27 @@
|
|
|
362
362
|
modeField.appendChild(modeSelect);
|
|
363
363
|
row.appendChild(modeField);
|
|
364
364
|
|
|
365
|
-
// Temperature
|
|
365
|
+
// Temperature — stored and entered in °F.
|
|
366
|
+
// Old configs may have stored °C (≤ 43); convert those to °F for display.
|
|
367
|
+
var tempF = null;
|
|
368
|
+
if (currentTemp != null) {
|
|
369
|
+
tempF = currentTemp > 43
|
|
370
|
+
? Math.round(currentTemp) // already °F
|
|
371
|
+
: Math.round(currentTemp * 9 / 5 + 32); // was °C — convert for display
|
|
372
|
+
}
|
|
373
|
+
|
|
366
374
|
var tempField = document.createElement('div');
|
|
367
375
|
tempField.className = 'field';
|
|
368
376
|
var tempLabel = document.createElement('label');
|
|
369
|
-
tempLabel.textContent = 'Temp °
|
|
377
|
+
tempLabel.textContent = 'Temp °F';
|
|
370
378
|
var tempInput = document.createElement('input');
|
|
371
379
|
tempInput.type = 'number';
|
|
372
380
|
tempInput.className = 'field-temp';
|
|
373
|
-
tempInput.min = '
|
|
374
|
-
tempInput.max = '
|
|
375
|
-
tempInput.step = '
|
|
381
|
+
tempInput.min = '66';
|
|
382
|
+
tempInput.max = '109';
|
|
383
|
+
tempInput.step = '1';
|
|
376
384
|
tempInput.placeholder = 'Optional';
|
|
377
|
-
if (
|
|
385
|
+
if (tempF !== null) tempInput.value = tempF;
|
|
378
386
|
tempField.appendChild(tempLabel);
|
|
379
387
|
tempField.appendChild(tempInput);
|
|
380
388
|
row.appendChild(tempField);
|
package/package.json
CHANGED
package/src/accessory.ts
CHANGED
|
@@ -222,8 +222,16 @@ export class BedJetAccessory {
|
|
|
222
222
|
|
|
223
223
|
if (applyDefaults) {
|
|
224
224
|
if (config.defaultTemperature !== undefined) {
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
// Config stores °F (values > 43 are unambiguously Fahrenheit).
|
|
226
|
+
// Old configs stored °C (≤ 43) — leave those as-is for backward compat.
|
|
227
|
+
let tempC = config.defaultTemperature;
|
|
228
|
+
if (tempC > 43) {
|
|
229
|
+
tempC = (tempC - 32) * 5 / 9;
|
|
230
|
+
}
|
|
231
|
+
// Clamp to BedJet V3 valid range 19–43 °C, rounded to nearest 0.5
|
|
232
|
+
tempC = Math.max(19, Math.min(43, Math.round(tempC * 2) / 2));
|
|
233
|
+
this.setPending(tempC, 'pendingTemp', 'pendingTempTimer', 5000);
|
|
234
|
+
await this.bedjet.setTemperature(tempC);
|
|
227
235
|
}
|
|
228
236
|
if (config.defaultFanSpeed !== undefined) {
|
|
229
237
|
this.setPending(config.defaultFanSpeed, 'pendingFanSpeed', 'pendingFanSpeedTimer', 5000);
|
package/src/bedjet/types.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface BedJetConfig {
|
|
|
27
27
|
address: string; // BLE MAC e.g. "AA:BB:CC:DD:EE:FF"
|
|
28
28
|
scanTimeout?: number; // seconds (default 30)
|
|
29
29
|
defaultMode?: DefaultMode; // mode to activate when turned on from HomeKit
|
|
30
|
-
defaultTemperature?: number; // °C
|
|
30
|
+
defaultTemperature?: number; // °F (values >43 treated as °F; ≤43 treated as °C for backward compat)
|
|
31
31
|
defaultFanSpeed?: number; // percent 5–100, applied on turn-on
|
|
32
32
|
}
|
|
33
33
|
|