homebridge-slwf-01pro 0.3.2 → 0.4.0

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,71 @@ This package is a maintained fork of [`homebridge-esphome-ac`](https://github.co
7
7
 
8
8
  ---
9
9
 
10
+ ## [0.4.0] — 2026-05-06
11
+
12
+ Naming cleanup. User-visible "ESPHome AC" / "ESPHomeAC" branding is now consistently **SLWF-01Pro**; technical references to the underlying ESPHome protocol (native API, mDNS service, Climate entity type) remain accurate where they describe the wire format the plugin speaks.
13
+
14
+ ### Breaking
15
+
16
+ - **No config breakage.** Platform identifier (`SLWFOnePro`) and npm name (`homebridge-slwf-01pro`) are unchanged from 0.3.x. Existing configs and HomeKit pairings continue to work.
17
+ - Internal class `ESPHomeAC` in `index.js` renamed to `SLWFOnePro`. Visible only in stack traces.
18
+
19
+ ### Changed
20
+
21
+ - **`package.json` `displayName`** simplified from "Homebridge SLWF-01Pro / ESPHome AC" to **"Homebridge SLWF-01Pro"**. Cleaner in the Homebridge UI plugin browser and matches the npm package name.
22
+ - **`package.json` `description`** rewritten to lead with SLWF-01Pro and the SMLIGHT brand; ESPHome native API mentioned as the underlying protocol, not the headline product.
23
+ - **`package.json` `keywords`** pruned: dropped `homebridge-esphome`, `homebridge-esphome-ac`, `esphome-ac` (upstream-related, not relevant for this fork's npm discoverability); kept `slwf`, `slwf-01pro`, `smlight`, AC-brand names; added `air-conditioner`.
24
+ - **`config.schema.json`** copy refreshed:
25
+ - `headerDisplay` linked to the SMLIGHT product page; dropped "ESPHome `Climate` entities" framing in favour of "SLWF-01Pro Wi-Fi AC dongle"
26
+ - `footerDisplay` mentions ESPHome native API as the underlying protocol (correct framing for users who want to use the plugin with non-SLWF ESPHome devices)
27
+ - `debug.description` simplified: "device state-change chatter" instead of "ESPHome state-change chatter"
28
+ - `autoDiscover.title` changed to "Auto-discover SLWF-01Pro devices via mDNS"; description still references the actual `_esphomelib._tcp` mDNS service since that's the literal technical fact
29
+ - `port` and `encryptionKey` titles simplified ("Native API port", "API encryption key (base64)")
30
+ - Per-device toggles unchanged
31
+ - **Log strings**:
32
+ - "Creating new ESPHome AC accessory" → "Creating new SLWF-01Pro accessory"
33
+ - "ESPHome device …reconnected" → "Device …reconnected"
34
+ - "No ESPHome devices configured…" → "No SLWF-01Pro / ESPHome devices configured…"
35
+ - "Browsing mDNS for ESPHome devices" / "Discovered N ESPHome devices" — kept (factually accurate; the mDNS service is `_esphomelib._tcp`).
36
+ - **Accessory metadata** (Apple Home → ⓘ on each AC):
37
+ - Manufacturer fallback: `'ESPHome'` → `'SMLIGHT'` (only used when the device doesn't report its own manufacturer; SMLIGHT is the actual hardware vendor)
38
+ - Model fallback: `'ESPHome AC'` → `'SLWF-01Pro'`
39
+ - Real `deviceInfo.manufacturer` / `deviceInfo.model` from ESPHome still take precedence — these are only fallbacks when the device YAML doesn't provide them.
40
+ - **`config-sample.json`** `name` field updated from `"ESPHomeAC"` to `"SLWF-01Pro"`.
41
+
42
+ ### Internal
43
+
44
+ - All `[ESPHomeAC]` log prefixes will become `[SLWF-01Pro]` (or whatever you set in the `name` config field) once your `config.json`'s `name` is updated. Existing `name: "ESPHomeAC"` configs continue to work — the prefix just keeps the legacy value until you change it.
45
+ - 120 unit tests still pass.
46
+
47
+ ---
48
+
49
+ ## [0.3.3] — 2026-05-06
50
+
51
+ Fix the "config validation failed, you can still save your changes" warning shown by the Homebridge UI when editing the plugin's settings.
52
+
53
+ ### Fixed
54
+
55
+ - **`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:
56
+ - Removed all `"required": false` annotations (redundant — JSON Schema treats unlisted properties as optional by default).
57
+ - Replaced per-device `"required": true` on `name`/`host` with the parent-level `"required": ["name", "host"]` array on the device item schema.
58
+ - Added `minLength: 1` on required string fields so empty values are explicitly rejected (matches what the form validator was already enforcing).
59
+ - **The `Devices` array's items had `"title": "Devices"` (plural)**, which the UI rendered as the same title for every entry; changed to `"Device"` (singular).
60
+
61
+ ### Added
62
+
63
+ - **`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.
64
+ - 120 unit tests now pass (up from 100).
65
+ - **`ajv` and `ajv-formats` as devDependencies** — vendored only for the test suite, not shipped in the runtime tarball.
66
+
67
+ ### Why the warning matters
68
+
69
+ `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).
70
+
71
+ 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.
72
+
73
+ ---
74
+
10
75
  ## [0.3.2] — 2026-05-06
11
76
 
12
77
  Config-schema polish + a regression-prevention test suite for the Homebridge UI form.
@@ -6,11 +6,11 @@
6
6
  "pin": "031-45-154"
7
7
  },
8
8
 
9
- "description": "Sample config for the homebridge-SLWF-01Pro fork. Pick auto-discovery OR manual devices, or both.",
9
+ "description": "Sample config for homebridge-slwf-01pro. Pick auto-discovery, manual devices, or both.",
10
10
  "platforms": [
11
11
  {
12
12
  "platform": "SLWFOnePro",
13
- "name": "SLWFOnePro",
13
+ "name": "SLWF-01Pro",
14
14
  "debug": false,
15
15
  "autoDiscover": true,
16
16
  "discoveryTimeout": 5,
@@ -2,30 +2,27 @@
2
2
  "pluginAlias": "SLWFOnePro",
3
3
  "pluginType": "platform",
4
4
  "singular": true,
5
- "headerDisplay": "Homebridge plugin for the **SMLIGHT SLWF-01Pro** Wi-Fi dongle and other ESPHome `Climate` entities. Supports mDNS auto-discovery, multi-entity bundling (humidity / outdoor temperature / power sensors, Beeper / Display switches, DRY / FAN_ONLY mode tiles).",
6
- "footerDisplay": "Maintained fork by [@nookied](https://github.com/nookied/homebridge-SLWF-01Pro). Based on `homebridge-esphome-ac` by [@nitaybz](https://github.com/nitaybz/homebridge-esphome-ac).",
5
+ "headerDisplay": "Homebridge plugin for the **[SMLIGHT SLWF-01Pro](https://smartlight.me/smart-home-devices/wifi-devices/wifi-dongle-air-conditioners-midea-idea-electrolux-for-home-assistant)** Wi-Fi AC dongle. Supports mDNS auto-discovery on the local network and multi-entity bundling (humidity / outdoor temperature / power sensors, Beeper / Display switches, DRY / FAN_ONLY mode tiles).",
6
+ "footerDisplay": "Maintained by [@nookied](https://github.com/nookied/homebridge-SLWF-01Pro). Speaks the [ESPHome native API](https://esphome.io/components/api.html), so any ESPHome Climate device on the local network is also supported.",
7
7
  "schema": {
8
8
  "type": "object",
9
9
  "properties": {
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
- "description": "Surface ESPHome state-change chatter to the main log (otherwise sent to log.debug).",
17
+ "description": "Surface device 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
- "title": "Auto-discover ESPHome devices via mDNS",
25
- "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.",
22
+ "title": "Auto-discover SLWF-01Pro devices via mDNS",
23
+ "description": "Browses the local network for ESPHome `_esphomelib._tcp` services and adds any device that exposes a Climate entity. Only works for unencrypted devices. Manually configured devices in the list below take precedence and are required for any device with the ESPHome API encryption key set.",
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,107 @@
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
- "title": "ESPHome native API port",
88
+ "title": "Native API port",
89
+ "description": "ESPHome's native API port. Default 6053; rarely needs changing.",
100
90
  "type": "integer",
101
91
  "default": 6053,
102
92
  "minimum": 1,
103
- "maximum": 65535,
104
- "required": false
93
+ "maximum": 65535
105
94
  },
106
95
  "encryptionKey": {
107
- "title": "ESPHome API Noise encryption key (base64)",
108
- "type": "string",
109
- "required": false
96
+ "title": "API encryption key (base64)",
97
+ "description": "If your device's ESPHome YAML has `api.encryption.key:` set, paste the same base64 key here. Leave empty if encryption isn't enabled.",
98
+ "type": "string"
110
99
  },
111
100
  "disableHumiditySensor": {
112
101
  "title": "Hide Humidity sensor for this device",
113
102
  "type": "boolean",
114
- "default": false,
115
- "required": false
103
+ "default": false
116
104
  },
117
105
  "disableOutdoorTempSensor": {
118
106
  "title": "Hide Outdoor Temperature for this device",
119
107
  "type": "boolean",
120
- "default": false,
121
- "required": false
108
+ "default": false
122
109
  },
123
110
  "disablePowerSensor": {
124
111
  "title": "Hide Power Usage for this device",
125
112
  "type": "boolean",
126
- "default": false,
127
- "required": false
113
+ "default": false
128
114
  },
129
115
  "disableBeeperSwitch": {
130
116
  "title": "Hide Beeper switch for this device",
131
117
  "type": "boolean",
132
- "default": false,
133
- "required": false
118
+ "default": false
134
119
  },
135
120
  "disableDisplaySwitch": {
136
121
  "title": "Hide Display Toggle for this device",
137
122
  "type": "boolean",
138
- "default": false,
139
- "required": false
123
+ "default": false
140
124
  },
141
125
  "disableDryMode": {
142
126
  "title": "Hide DRY mode switch for this device",
143
127
  "type": "boolean",
144
- "default": false,
145
- "required": false
128
+ "default": false
146
129
  },
147
130
  "disableFanOnlyMode": {
148
131
  "title": "Hide FAN_ONLY mode switch for this device",
149
132
  "type": "boolean",
150
- "default": false,
151
- "required": false
133
+ "default": false
152
134
  }
153
135
  }
154
136
  }
@@ -184,7 +166,7 @@
184
166
  "key": "devices",
185
167
  "type": "array",
186
168
  "title": "Manual device list",
187
- "description": "Optional. Required for encrypted ESPHome devices. Per-device toggles override the globals.",
169
+ "description": "Optional. Required for any device with the ESPHome API encryption key set (mDNS doesn't broadcast it, so auto-discovery alone won't work for those). Per-device toggles override the globals.",
188
170
  "orderable": false,
189
171
  "buttonText": "Add Device",
190
172
  "expandable": true,
package/index.js CHANGED
@@ -1,10 +1,10 @@
1
- const ESPHome = require('./lib/esphome');
1
+ const Esphome = require('./lib/esphome');
2
2
 
3
3
  const PLUGIN_NAME = 'homebridge-slwf-01pro';
4
4
  const PLATFORM_NAME = 'SLWFOnePro';
5
5
  const ACCESSORY_SCHEMA_VERSION = 2;
6
6
 
7
- class ESPHomeAC {
7
+ class SLWFOnePro {
8
8
  constructor(log, config, api) {
9
9
  this.api = api;
10
10
  this.log = log;
@@ -36,7 +36,7 @@ class ESPHomeAC {
36
36
  };
37
37
 
38
38
  this.api.on('didFinishLaunching', () => {
39
- Promise.resolve(ESPHome.init.call(this)).catch(err => {
39
+ Promise.resolve(Esphome.init.call(this)).catch(err => {
40
40
  this.log.error(`Plugin initialization failed: ${err.message || err}`);
41
41
  });
42
42
  });
@@ -55,5 +55,5 @@ class ESPHomeAC {
55
55
  }
56
56
 
57
57
  module.exports = (api) => {
58
- api.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, ESPHomeAC, true);
58
+ api.registerPlatform(PLUGIN_NAME, PLATFORM_NAME, SLWFOnePro, true);
59
59
  };
@@ -93,8 +93,8 @@ class DeviceAccessory {
93
93
  }
94
94
  this.host = device.host;
95
95
  this.serial = this.deviceInfo.macAddress || this.id;
96
- this.manufacturer = this.deviceInfo.manufacturer || 'ESPHome';
97
- this.model = this.deviceInfo.model || climate.name || 'ESPHome AC';
96
+ this.manufacturer = this.deviceInfo.manufacturer || 'SMLIGHT';
97
+ this.model = this.deviceInfo.model || climate.name || 'SLWF-01Pro';
98
98
  this.firmwareRevision = sanitizeFirmwareRevision(this.deviceInfo.esphomeVersion);
99
99
 
100
100
  this.state = climate.state || {};
@@ -109,7 +109,7 @@ class DeviceAccessory {
109
109
  this.accessory = platform.accessories.find(acc => acc.UUID === this.UUID);
110
110
 
111
111
  if (!this.accessory) {
112
- this.log(`Creating new ESPHome AC accessory: "${this.name}"`);
112
+ this.log(`Creating new SLWF-01Pro accessory: "${this.name}"`);
113
113
  this.accessory = new this.api.platformAccessory(this.name, this.UUID);
114
114
  this.accessory.context.schemaVersion = ACCESSORY_SCHEMA_VERSION;
115
115
  this.accessory.context.deviceId = this.id;
@@ -118,7 +118,7 @@ class DeviceAccessory {
118
118
  platform.accessories.push(this.accessory);
119
119
  this.api.registerPlatformAccessories(platform.PLUGIN_NAME, platform.PLATFORM_NAME, [this.accessory]);
120
120
  } else {
121
- this.log(`ESPHome device "${this.name}" reconnected.`);
121
+ this.log(`Device "${this.name}" reconnected.`);
122
122
  this.accessory.context.schemaVersion = ACCESSORY_SCHEMA_VERSION;
123
123
  this.accessory.context.host = this.host;
124
124
  if (PRIMARY_MODES.includes(this.state.mode)) {
package/lib/esphome.js CHANGED
@@ -112,7 +112,7 @@ async function init() {
112
112
 
113
113
  if (allDevices.length === 0) {
114
114
  if (manualDevices.length === 0 && (!platform.autoDiscover || discoverySucceeded)) {
115
- platform.log('No ESPHome devices configured and none discovered. Plugin will idle.');
115
+ platform.log('No SLWF-01Pro / ESPHome devices configured and none discovered. Plugin will idle.');
116
116
  pruneOrphanedAccessories(platform, []);
117
117
  } else {
118
118
  platform.log.error('Auto-discovery returned no devices and no manual devices configured — keeping cached accessories. Will retry on next restart.');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-slwf-01pro",
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",
3
+ "description": "Homebridge plugin for the SMLIGHT SLWF-01Pro Wi-Fi AC dongle. Auto-discovery, multi-entity bundling, and full Midea-protocol support over the ESPHome native API.",
4
+ "version": "0.4.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/nookied/homebridge-SLWF-01Pro.git"
@@ -9,20 +9,19 @@
9
9
  "homepage": "https://github.com/nookied/homebridge-SLWF-01Pro#readme",
10
10
  "license": "MIT",
11
11
  "preferGlobal": true,
12
- "displayName": "Homebridge SLWF-01Pro / ESPHome AC",
12
+ "displayName": "Homebridge SLWF-01Pro",
13
13
  "keywords": [
14
14
  "homebridge-plugin",
15
- "homebridge-esphome",
16
- "homebridge-esphome-ac",
17
- "esphome",
18
- "esphome-ac",
19
- "climate",
20
15
  "slwf",
21
16
  "slwf-01pro",
17
+ "smlight",
22
18
  "midea",
23
19
  "electrolux",
24
20
  "beko",
25
- "neoclima"
21
+ "neoclima",
22
+ "air-conditioner",
23
+ "climate",
24
+ "esphome"
26
25
  ],
27
26
  "bugs": {
28
27
  "url": "https://github.com/nookied/homebridge-SLWF-01Pro/issues"
@@ -45,6 +44,8 @@
45
44
  "fakegato-history": "^0.6.7"
46
45
  },
47
46
  "devDependencies": {
47
+ "ajv": "^8.20.0",
48
+ "ajv-formats": "^3.0.1",
48
49
  "eslint": "^8.46.0",
49
50
  "jest": "^29.7.0"
50
51
  },