homebridge-slwf-01pro 0.3.2 → 0.3.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/CHANGELOG.md CHANGED
@@ -7,6 +7,32 @@ This package is a maintained fork of [`homebridge-esphome-ac`](https://github.co
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.3.3] — 2026-05-06
11
+
12
+ Fix the "config validation failed, you can still save your changes" warning shown by the Homebridge UI when editing the plugin's settings.
13
+
14
+ ### Fixed
15
+
16
+ - **`config.schema.json` used the legacy per-property `"required": true/false` Homebridge convention**, which modern ajv (used by recent `homebridge-config-ui-x` versions) reports as a non-standard JSON Schema construct. Migrated to canonical JSON Schema:
17
+ - Removed all `"required": false` annotations (redundant — JSON Schema treats unlisted properties as optional by default).
18
+ - Replaced per-device `"required": true` on `name`/`host` with the parent-level `"required": ["name", "host"]` array on the device item schema.
19
+ - Added `minLength: 1` on required string fields so empty values are explicitly rejected (matches what the form validator was already enforcing).
20
+ - **The `Devices` array's items had `"title": "Devices"` (plural)**, which the UI rendered as the same title for every entry; changed to `"Device"` (singular).
21
+
22
+ ### Added
23
+
24
+ - **`test/unit/configSchemaValidation.test.js`** — runs the live `config.schema.json` through ajv against 20 sample configs, including the bundled `config-sample.json`, common partial configs, and explicit error cases (missing required fields, out-of-range numerics, wrong types). Catches schema regressions that would surface as validation warnings in the UI.
25
+ - 120 unit tests now pass (up from 100).
26
+ - **`ajv` and `ajv-formats` as devDependencies** — vendored only for the test suite, not shipped in the runtime tarball.
27
+
28
+ ### Why the warning matters
29
+
30
+ `homebridge-config-ui-x` validates saved config against the plugin's `config.schema.json` after every form save. When the schema is well-formed but uses non-standard JSON Schema constructs, ajv flags them and the UI shows the "config validation failed" warning even though the actual saved config is fine. The user could still save their changes, but the warning is alarming and obscures real validation problems (like a forgotten required field).
31
+
32
+ This release modernizes the schema to canonical JSON Schema syntax, eliminating the false-positive warning. The ajv-based test suite ensures we don't regress.
33
+
34
+ ---
35
+
10
36
  ## [0.3.2] — 2026-05-06
11
37
 
12
38
  Config-schema polish + a regression-prevention test suite for the Homebridge UI form.
@@ -10,22 +10,19 @@
10
10
  "name": {
11
11
  "title": "Plugin Name (for logs)",
12
12
  "type": "string",
13
- "default": "SLWFOnePro",
14
- "required": false
13
+ "default": "SLWFOnePro"
15
14
  },
16
15
  "debug": {
17
16
  "title": "Enable Debug Logs",
18
17
  "description": "Surface ESPHome state-change chatter to the main log (otherwise sent to log.debug).",
19
18
  "type": "boolean",
20
- "default": false,
21
- "required": false
19
+ "default": false
22
20
  },
23
21
  "autoDiscover": {
24
22
  "title": "Auto-discover ESPHome devices via mDNS",
25
23
  "description": "Browses _esphomelib._tcp on the local network and adds any ESPHome devices with a Climate entity. Only works for unencrypted ESPHome API. Manually configured devices in the list below take precedence and are required for encrypted devices.",
26
24
  "type": "boolean",
27
- "default": false,
28
- "required": false
25
+ "default": false
29
26
  },
30
27
  "discoveryTimeout": {
31
28
  "title": "Discovery timeout (seconds)",
@@ -33,122 +30,105 @@
33
30
  "default": 5,
34
31
  "minimum": 2,
35
32
  "maximum": 30,
36
- "required": false,
37
33
  "condition": { "functionBody": "return model.autoDiscover === true;" }
38
34
  },
39
35
  "disableHumiditySensor": {
40
36
  "title": "Hide Humidity sensor service (for ACs without a real humidity probe)",
41
37
  "type": "boolean",
42
- "default": false,
43
- "required": false
38
+ "default": false
44
39
  },
45
40
  "disableOutdoorTempSensor": {
46
41
  "title": "Hide Outdoor Temperature sensor service",
47
42
  "type": "boolean",
48
- "default": false,
49
- "required": false
43
+ "default": false
50
44
  },
51
45
  "disablePowerSensor": {
52
46
  "title": "Hide Power Usage characteristic (Eve.Energy)",
53
47
  "type": "boolean",
54
- "default": false,
55
- "required": false
48
+ "default": false
56
49
  },
57
50
  "disableBeeperSwitch": {
58
51
  "title": "Hide Beeper switch",
59
52
  "type": "boolean",
60
- "default": false,
61
- "required": false
53
+ "default": false
62
54
  },
63
55
  "disableDisplaySwitch": {
64
56
  "title": "Hide Display Toggle switch",
65
57
  "type": "boolean",
66
- "default": false,
67
- "required": false
58
+ "default": false
68
59
  },
69
60
  "disableDryMode": {
70
61
  "title": "Hide DRY mode switch",
71
62
  "type": "boolean",
72
- "default": false,
73
- "required": false
63
+ "default": false
74
64
  },
75
65
  "disableFanOnlyMode": {
76
66
  "title": "Hide FAN_ONLY mode switch",
77
67
  "type": "boolean",
78
- "default": false,
79
- "required": false
68
+ "default": false
80
69
  },
81
70
  "devices": {
82
71
  "type": "array",
83
- "required": false,
84
72
  "items": {
85
- "title": "Devices",
73
+ "title": "Device",
86
74
  "type": "object",
75
+ "required": ["name", "host"],
87
76
  "properties": {
88
77
  "name": {
89
78
  "title": "Display name in HomeKit",
90
79
  "type": "string",
91
- "required": true
80
+ "minLength": 1
92
81
  },
93
82
  "host": {
94
83
  "title": "Hostname or IP address",
95
84
  "type": "string",
96
- "required": true
85
+ "minLength": 1
97
86
  },
98
87
  "port": {
99
88
  "title": "ESPHome native API port",
100
89
  "type": "integer",
101
90
  "default": 6053,
102
91
  "minimum": 1,
103
- "maximum": 65535,
104
- "required": false
92
+ "maximum": 65535
105
93
  },
106
94
  "encryptionKey": {
107
95
  "title": "ESPHome API Noise encryption key (base64)",
108
- "type": "string",
109
- "required": false
96
+ "type": "string"
110
97
  },
111
98
  "disableHumiditySensor": {
112
99
  "title": "Hide Humidity sensor for this device",
113
100
  "type": "boolean",
114
- "default": false,
115
- "required": false
101
+ "default": false
116
102
  },
117
103
  "disableOutdoorTempSensor": {
118
104
  "title": "Hide Outdoor Temperature for this device",
119
105
  "type": "boolean",
120
- "default": false,
121
- "required": false
106
+ "default": false
122
107
  },
123
108
  "disablePowerSensor": {
124
109
  "title": "Hide Power Usage for this device",
125
110
  "type": "boolean",
126
- "default": false,
127
- "required": false
111
+ "default": false
128
112
  },
129
113
  "disableBeeperSwitch": {
130
114
  "title": "Hide Beeper switch for this device",
131
115
  "type": "boolean",
132
- "default": false,
133
- "required": false
116
+ "default": false
134
117
  },
135
118
  "disableDisplaySwitch": {
136
119
  "title": "Hide Display Toggle for this device",
137
120
  "type": "boolean",
138
- "default": false,
139
- "required": false
121
+ "default": false
140
122
  },
141
123
  "disableDryMode": {
142
124
  "title": "Hide DRY mode switch for this device",
143
125
  "type": "boolean",
144
- "default": false,
145
- "required": false
126
+ "default": false
146
127
  },
147
128
  "disableFanOnlyMode": {
148
129
  "title": "Hide FAN_ONLY mode switch for this device",
149
130
  "type": "boolean",
150
- "default": false,
151
- "required": false
131
+ "default": false
152
132
  }
153
133
  }
154
134
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-slwf-01pro",
3
3
  "description": "Homebridge plugin for the SMLIGHT SLWF-01Pro Wi-Fi dongle and other ESPHome Climate entities. Auto-discovery, multi-entity bundling, and full Midea-protocol AC support.",
4
- "version": "0.3.2",
4
+ "version": "0.3.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/nookied/homebridge-SLWF-01Pro.git"
@@ -45,6 +45,8 @@
45
45
  "fakegato-history": "^0.6.7"
46
46
  },
47
47
  "devDependencies": {
48
+ "ajv": "^8.20.0",
49
+ "ajv-formats": "^3.0.1",
48
50
  "eslint": "^8.46.0",
49
51
  "jest": "^29.7.0"
50
52
  },