homebridge-unifi-access 1.4.0 → 1.6.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.
@@ -1,4 +1,4 @@
1
- /* Copyright(C) 2017-2024, HJD (https://github.com/hjdhjd). All rights reserved.
1
+ /* Copyright(C) 2017-2025, HJD (https://github.com/hjdhjd). All rights reserved.
2
2
  *
3
3
  * ui.mjs: Homebridge UniFi Access webUI.
4
4
  */
@@ -17,7 +17,7 @@ const firstRunIsRequired = () => {
17
17
  }
18
18
 
19
19
  return true;
20
- }
20
+ };
21
21
 
22
22
  // Initialize our first run screen with any information from our existing configuration.
23
23
  const firstRunOnStart = () => {
@@ -48,12 +48,13 @@ const firstRunOnSubmit = async () => {
48
48
  return false;
49
49
  }
50
50
 
51
- const udaDevices = await homebridge.request("/getDevices", { address: address, username: username, password: password });
51
+ const udaDevices = await homebridge.request("/getDevices", { address: address, password: password, username: username });
52
52
 
53
53
  // Couldn't connect to the Access controller for some reason.
54
54
  if(!udaDevices?.length) {
55
55
 
56
- tdLoginError.innerHTML = "Unable to login to the UniFi Access controller.<br>Please check your controller address, username, and password.<br><code class=\"text-danger\">" + (await homebridge.request("/getErrorMessage")) + "</code>";
56
+ tdLoginError.innerHTML = "Unable to login to the UniFi Access controller.<br>" +
57
+ "Please check your controller address, username, and password.<br><code class=\"text-danger\">" + (await homebridge.request("/getErrorMessage")) + "</code>";
57
58
  homebridge.hideSpinner();
58
59
 
59
60
  return false;
@@ -84,17 +85,19 @@ const getDevices = async (controller) => {
84
85
  }
85
86
 
86
87
  // Retrieve the current list of devices from the Access controller.
87
- let devices = await homebridge.request("/getDevices", { address: controller.address, username: controller.username, password: controller.password });
88
+ let devices = await homebridge.request("/getDevices", { address: controller.address, password: controller.password, username: controller.username });
88
89
 
89
90
  // Since the controller JSON doesn't have the same properties as the device JSON, let's make the controller JSON emulate the properties we care about.
90
91
  if(devices?.length) {
91
92
 
93
+ /* eslint-disable camelcase */
92
94
  devices[0].display_model = "controller";
93
95
  devices[0].ip = devices[0].host.ip;
94
96
  devices[0].is_online = true;
95
97
  devices[0].mac = devices[0].host.mac;
96
98
  devices[0].model = devices[0].host.device_type;
97
99
  devices[0].unique_id = devices[0].host.mac;
100
+ /* eslint-enable camelcase */
98
101
  }
99
102
 
100
103
  // Add the fields that the webUI framework is looking for to render.
@@ -114,7 +117,8 @@ const isController = (device) => device.modelKey === "controller";
114
117
  const showSidebarDevices = (controller, devices) => {
115
118
 
116
119
  // Workaround for the time being to reduce the number of models we see to just the currently supported ones.
117
- const modelKeys = [...new Set(devices.filter(device => ["controller"].includes(device.display_model) || device.capabilities.includes("is_hub")).map(device => device.display_model))]
120
+ const modelKeys =
121
+ [...new Set(devices.filter(device => ["controller"].includes(device.display_model) || device.capabilities.includes("is_hub")).map(device => device.display_model))];
118
122
 
119
123
  // Start with a clean slate.
120
124
  ui.featureOptions.devicesTable.innerHTML = "";
@@ -229,7 +233,7 @@ const showAccessDetails = (device) => {
229
233
  document.getElementById("device_model").classList.remove("text-center");
230
234
  document.getElementById("device_model").colSpan = 1;
231
235
  document.getElementById("device_model").style.fontWeight = "normal";
232
- document.getElementById("device_model").innerHTML = "N/A"
236
+ document.getElementById("device_model").innerHTML = "N/A";
233
237
  document.getElementById("device_mac").innerHTML = "N/A";
234
238
  document.getElementById("device_address").innerHTML = "N/A";
235
239
  document.getElementById("device_online").innerHTML = "N/A";
@@ -1,4 +1,4 @@
1
- /* Copyright(C) 2017-2024, HJD (https://github.com/hjdhjd). All rights reserved.
1
+ /* Copyright(C) 2017-2025, HJD (https://github.com/hjdhjd). All rights reserved.
2
2
  *
3
3
  * server.js: homebridge-unifi-access webUI server API.
4
4
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-unifi-access",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "displayName": "Homebridge UniFi Access",
5
5
  "description": "Homebridge UniFi Access plugin providing complete HomeKit integration for the UniFi Access ecosystem with full support for most features including autoconfiguration, motion detection, multiple controllers, and realtime updates.",
6
6
  "author": {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "type": "module",
20
20
  "engines": {
21
- "homebridge": ">=1.6.0",
21
+ "homebridge": ">=1.8.0 || >=2.0.0",
22
22
  "node": ">=18"
23
23
  },
24
24
  "keywords": [
@@ -49,23 +49,23 @@
49
49
  "build-ui": "shx mkdir -p homebridge-ui/public/lib && shx cp \"node_modules/homebridge-plugin-utils/dist/ui/**/*.@(js|mjs){,.map}\" homebridge-ui/public/lib",
50
50
  "clean": "shx rm -rf dist homebridge-ui/public/lib",
51
51
  "prelint": "npm run build-ui",
52
- "lint": "eslint --max-warnings=${ESLINT_MAX_WARNINGS:-\"-1\"} eslint.config.mjs src/**.ts homebridge-ui/*.js homebridge-ui/public/**/*.mjs",
52
+ "lint": "eslint --max-warnings=${ESLINT_MAX_WARNINGS:-\"-1\"} eslint.config.mjs src homebridge-ui/*.js homebridge-ui/public/**.mjs",
53
53
  "postpublish": "npm run clean",
54
54
  "prepublishOnly": "npm run lint && npm run build"
55
55
  },
56
56
  "main": "dist/index.js",
57
57
  "dependencies": {
58
- "@homebridge/plugin-ui-utils": "1.0.3",
59
- "homebridge-plugin-utils": "1.7.0",
60
- "unifi-access": "1.1.0"
58
+ "@homebridge/plugin-ui-utils": "2.0.2",
59
+ "homebridge-plugin-utils": "1.15.3",
60
+ "unifi-access": "^1.2.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@stylistic/eslint-plugin": "2.6.1",
64
- "@types/node": "22.1.0",
65
- "eslint": "9.8.0",
66
- "homebridge": "1.8.4",
67
- "shx": "^0.3.4",
68
- "typescript": "5.5.4",
69
- "typescript-eslint": "^8.0.0"
63
+ "@stylistic/eslint-plugin": "4.2.0",
64
+ "@types/node": "22.15.2",
65
+ "eslint": "9.25.1",
66
+ "homebridge": "1.9.0",
67
+ "shx": "^0.4.0",
68
+ "typescript": "5.8.3",
69
+ "typescript-eslint": "^8.31.0"
70
70
  }
71
71
  }