@mp-consulting/homebridge-daikin-cloud 1.3.5 → 1.3.7
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/LICENSE +39 -1
- package/README.md +5 -3
- package/dist/src/accessories/air-conditioning-accessory.d.ts +2 -2
- package/dist/src/accessories/air-conditioning-accessory.d.ts.map +1 -1
- package/dist/src/accessories/air-conditioning-accessory.js.map +1 -1
- package/dist/src/accessories/altherma-accessory.d.ts +2 -2
- package/dist/src/accessories/altherma-accessory.d.ts.map +1 -1
- package/dist/src/accessories/altherma-accessory.js.map +1 -1
- package/dist/src/accessories/base-accessory.d.ts +6 -6
- package/dist/src/accessories/base-accessory.d.ts.map +1 -1
- package/dist/src/accessories/base-accessory.js +15 -15
- package/dist/src/accessories/base-accessory.js.map +1 -1
- package/dist/src/api/daikin-api.d.ts +26 -26
- package/dist/src/api/daikin-api.d.ts.map +1 -1
- package/dist/src/api/daikin-api.js +68 -42
- package/dist/src/api/daikin-api.js.map +1 -1
- package/dist/src/api/daikin-cloud.repository.d.ts.map +1 -1
- package/dist/src/api/daikin-cloud.repository.js +22 -14
- package/dist/src/api/daikin-cloud.repository.js.map +1 -1
- package/dist/src/api/daikin-controller.d.ts +41 -47
- package/dist/src/api/daikin-controller.d.ts.map +1 -1
- package/dist/src/api/daikin-controller.js +40 -64
- package/dist/src/api/daikin-controller.js.map +1 -1
- package/dist/src/api/daikin-device.d.ts +36 -31
- package/dist/src/api/daikin-device.d.ts.map +1 -1
- package/dist/src/api/daikin-device.js +45 -31
- package/dist/src/api/daikin-device.js.map +1 -1
- package/dist/src/api/daikin-mobile-oauth.d.ts +20 -20
- package/dist/src/api/daikin-mobile-oauth.d.ts.map +1 -1
- package/dist/src/api/daikin-mobile-oauth.js +49 -44
- package/dist/src/api/daikin-mobile-oauth.js.map +1 -1
- package/dist/src/api/daikin-oauth.d.ts +32 -32
- package/dist/src/api/daikin-oauth.d.ts.map +1 -1
- package/dist/src/api/daikin-oauth.js +64 -56
- package/dist/src/api/daikin-oauth.js.map +1 -1
- package/dist/src/api/daikin-schemas.d.ts +476 -351
- package/dist/src/api/daikin-schemas.d.ts.map +1 -1
- package/dist/src/api/daikin-schemas.js +11 -42
- package/dist/src/api/daikin-schemas.js.map +1 -1
- package/dist/src/api/daikin-types.d.ts +5 -1
- package/dist/src/api/daikin-types.d.ts.map +1 -1
- package/dist/src/api/daikin-types.js.map +1 -1
- package/dist/src/api/daikin-websocket.d.ts +31 -32
- package/dist/src/api/daikin-websocket.d.ts.map +1 -1
- package/dist/src/api/daikin-websocket.js +55 -35
- package/dist/src/api/daikin-websocket.js.map +1 -1
- package/dist/src/api/index.d.ts +2 -1
- package/dist/src/api/index.d.ts.map +1 -1
- package/dist/src/api/index.js +3 -1
- package/dist/src/api/index.js.map +1 -1
- package/dist/src/api/token-storage.d.ts +21 -0
- package/dist/src/api/token-storage.d.ts.map +1 -0
- package/dist/src/api/token-storage.js +90 -0
- package/dist/src/api/token-storage.js.map +1 -0
- package/dist/src/config/config-manager.d.ts +33 -33
- package/dist/src/config/config-manager.d.ts.map +1 -1
- package/dist/src/config/config-manager.js +33 -33
- package/dist/src/config/config-manager.js.map +1 -1
- package/dist/src/constants/api.constants.d.ts +4 -0
- package/dist/src/constants/api.constants.d.ts.map +1 -1
- package/dist/src/constants/api.constants.js +5 -1
- package/dist/src/constants/api.constants.js.map +1 -1
- package/dist/src/constants/device.constants.d.ts +4 -0
- package/dist/src/constants/device.constants.d.ts.map +1 -1
- package/dist/src/constants/device.constants.js +5 -1
- package/dist/src/constants/device.constants.js.map +1 -1
- package/dist/src/device/accessory-factory.d.ts +10 -10
- package/dist/src/device/accessory-factory.d.ts.map +1 -1
- package/dist/src/device/accessory-factory.js +7 -7
- package/dist/src/device/accessory-factory.js.map +1 -1
- package/dist/src/device/capability-detector.d.ts +8 -8
- package/dist/src/device/capability-detector.d.ts.map +1 -1
- package/dist/src/device/capability-detector.js +6 -6
- package/dist/src/device/capability-detector.js.map +1 -1
- package/dist/src/device/capability-docs.d.ts +1 -9
- package/dist/src/device/capability-docs.d.ts.map +1 -1
- package/dist/src/device/capability-docs.js +19 -73
- package/dist/src/device/capability-docs.js.map +1 -1
- package/dist/src/device/profiles/device-profile.d.ts +1 -1
- package/dist/src/device/profiles/device-profile.d.ts.map +1 -1
- package/dist/src/device/profiles/device-profile.js +4 -4
- package/dist/src/device/profiles/device-profile.js.map +1 -1
- package/dist/src/features/base-feature.d.ts +2 -2
- package/dist/src/features/base-feature.d.ts.map +1 -1
- package/dist/src/features/base-feature.js +2 -3
- package/dist/src/features/base-feature.js.map +1 -1
- package/dist/src/features/feature-manager.d.ts +8 -16
- package/dist/src/features/feature-manager.d.ts.map +1 -1
- package/dist/src/features/feature-manager.js +5 -17
- package/dist/src/features/feature-manager.js.map +1 -1
- package/dist/src/features/modes/dry-operation-mode.feature.d.ts +1 -1
- package/dist/src/features/modes/dry-operation-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/dry-operation-mode.feature.js.map +1 -1
- package/dist/src/features/modes/econo-mode.feature.d.ts +1 -1
- package/dist/src/features/modes/econo-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/econo-mode.feature.js.map +1 -1
- package/dist/src/features/modes/fan-only-operation-mode.feature.d.ts +1 -1
- package/dist/src/features/modes/fan-only-operation-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/fan-only-operation-mode.feature.js.map +1 -1
- package/dist/src/features/modes/indoor-silent-mode.feature.d.ts +1 -1
- package/dist/src/features/modes/indoor-silent-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/indoor-silent-mode.feature.js.map +1 -1
- package/dist/src/features/modes/outdoor-silent-mode.feature.d.ts +1 -1
- package/dist/src/features/modes/outdoor-silent-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/outdoor-silent-mode.feature.js.map +1 -1
- package/dist/src/features/modes/powerful-mode.feature.d.ts +1 -1
- package/dist/src/features/modes/powerful-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/powerful-mode.feature.js.map +1 -1
- package/dist/src/features/modes/streamer-mode.feature.d.ts +1 -1
- package/dist/src/features/modes/streamer-mode.feature.d.ts.map +1 -1
- package/dist/src/features/modes/streamer-mode.feature.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/platform.d.ts +11 -8
- package/dist/src/platform.d.ts.map +1 -1
- package/dist/src/platform.js +64 -15
- package/dist/src/platform.js.map +1 -1
- package/dist/src/services/climate-control.service.d.ts +8 -2
- package/dist/src/services/climate-control.service.d.ts.map +1 -1
- package/dist/src/services/climate-control.service.js +59 -58
- package/dist/src/services/climate-control.service.js.map +1 -1
- package/dist/src/services/hot-water-tank.service.d.ts +6 -2
- package/dist/src/services/hot-water-tank.service.d.ts.map +1 -1
- package/dist/src/services/hot-water-tank.service.js +33 -31
- package/dist/src/services/hot-water-tank.service.js.map +1 -1
- package/dist/src/types/daikin-enums.js +12 -12
- package/dist/src/types/daikin-enums.js.map +1 -1
- package/dist/src/types/device-capabilities.d.ts +1 -1
- package/dist/src/types/device-capabilities.d.ts.map +1 -1
- package/dist/src/utils/log-context.d.ts +23 -23
- package/dist/src/utils/log-context.d.ts.map +1 -1
- package/dist/src/utils/log-context.js +28 -28
- package/dist/src/utils/log-context.js.map +1 -1
- package/dist/src/utils/strings.d.ts.map +1 -1
- package/dist/src/utils/strings.js.map +1 -1
- package/dist/src/utils/update-mapper.d.ts +16 -16
- package/dist/src/utils/update-mapper.d.ts.map +1 -1
- package/dist/src/utils/update-mapper.js +14 -14
- package/dist/src/utils/update-mapper.js.map +1 -1
- package/homebridge-ui/public/index.html +2 -2
- package/homebridge-ui/public/script.js +957 -898
- package/homebridge-ui/server.js +746 -678
- package/package.json +29 -27
- package/.claude/settings.json +0 -3
- package/.claude/settings.local.json +0 -29
- package/CHANGELOG.md +0 -103
- package/CLAUDE.md +0 -269
- package/config.md +0 -2
- package/dist/src/api/daikin-device-tracker.d.ts +0 -97
- package/dist/src/api/daikin-device-tracker.d.ts.map +0 -1
- package/dist/src/api/daikin-device-tracker.js +0 -136
- package/dist/src/api/daikin-device-tracker.js.map +0 -1
- package/dist/src/api/http-interceptor.d.ts +0 -99
- package/dist/src/api/http-interceptor.d.ts.map +0 -1
- package/dist/src/api/http-interceptor.js +0 -177
- package/dist/src/api/http-interceptor.js.map +0 -1
- package/dist/src/di/service-container.d.ts +0 -92
- package/dist/src/di/service-container.d.ts.map +0 -1
- package/dist/src/di/service-container.js +0 -156
- package/dist/src/di/service-container.js.map +0 -1
- package/dist/src/features/feature-registry.d.ts +0 -100
- package/dist/src/features/feature-registry.d.ts.map +0 -1
- package/dist/src/features/feature-registry.js +0 -142
- package/dist/src/features/feature-registry.js.map +0 -1
- package/dist/src/services/service-factory.d.ts +0 -46
- package/dist/src/services/service-factory.d.ts.map +0 -1
- package/dist/src/services/service-factory.js +0 -72
- package/dist/src/services/service-factory.js.map +0 -1
- package/dist/src/utils/error-handler.d.ts +0 -101
- package/dist/src/utils/error-handler.d.ts.map +0 -1
- package/dist/src/utils/error-handler.js +0 -251
- package/dist/src/utils/error-handler.js.map +0 -1
- package/dist/src/utils/retry.d.ts +0 -42
- package/dist/src/utils/retry.d.ts.map +0 -1
- package/dist/src/utils/retry.js +0 -70
- package/dist/src/utils/retry.js.map +0 -1
- package/docs/ARCHITECTURE.md +0 -645
- package/docs/IMPLEMENTATION_GUIDE.md +0 -899
- package/docs/IMPROVEMENTS_SUMMARY.md +0 -415
- package/docs/NEXT_STEPS.md +0 -368
- package/docs/Screenshot 2024-07-04 at 18.41.28.png +0 -0
- package/docs/TROUBLESHOOTING.md +0 -475
- package/docs/api-response-for-BRP069A8x.json +0 -520
- package/docs/api-response-for-BRP069C4x-2.json +0 -881
- package/docs/api-response-for-BRP069C4x.json +0 -916
- package/docs/api-response-for-altherma.json +0 -759
- package/docs/api-response-for-altherma2.json +0 -2735
- package/docs/api-response-with-multiple-devices-incl-heatpump.json +0 -2544
- package/docs/cr-insance-altherma-id-0.json +0 -834
- package/docs/mock-air-to-air-dx23.json +0 -759
- package/docs/mock-air-to-air-dx4.json +0 -1134
- package/docs/mock-airpurifier-with-humidifier.json +0 -732
- package/docs/mock-airpurifier.json +0 -450
- package/docs/mock-altherma-air-to-water-lan.json +0 -845
- package/docs/mock-altherma-air-to-water-wlan.json +0 -845
- package/docs/mock-d2cnd-gas-boiler.json +0 -649
- package/docs/setpointmode-vs-controlmode-vs-setpoints-vs-sensorydata.txt +0 -6
- package/images/fan-speed.jpeg +0 -0
- package/images/homekit-controls.jpeg +0 -0
- package/images/homekit-settings.jpeg +0 -0
- package/images/swing-mode.png +0 -0
- package/jest.config.ts +0 -13
- package/test/fixtures/altherma-crSense-2.ts +0 -834
- package/test/fixtures/altherma-fraction.ts +0 -718
- package/test/fixtures/altherma-heat-pump-2.ts +0 -479
- package/test/fixtures/altherma-heat-pump.ts +0 -757
- package/test/fixtures/altherma-miladcerkic-off.ts +0 -524
- package/test/fixtures/altherma-miladcerkic.ts +0 -524
- package/test/fixtures/altherma-v1ckoeln.ts +0 -644
- package/test/fixtures/altherma-with-embedded-id-zero.ts +0 -834
- package/test/fixtures/dx23-airco-2.ts +0 -343
- package/test/fixtures/dx23-airco.ts +0 -518
- package/test/fixtures/dx4-airco.ts +0 -914
- package/test/fixtures/unknown-jan.ts +0 -488
- package/test/fixtures/unknown-kitchen-guests.ts +0 -488
- package/test/helpers/test-isolation.ts +0 -228
- package/test/integration/air-conditioning.test.ts +0 -410
- package/test/integration/altherma.test.ts +0 -289
- package/test/integration/platform.test.ts +0 -118
- package/test/mocks/index.ts +0 -27
- package/test/test-gigya-auth.js +0 -443
- package/test/test-mobile-oauth.js +0 -175
- package/test/test-websocket-mobile.js +0 -123
- package/test/test-websocket.js +0 -116
- package/test/unit/api/__snapshots__/daikinCloud.test.ts.snap +0 -1320
- package/test/unit/api/daikin-api.test.ts +0 -384
- package/test/unit/api/daikin-oauth.test.ts +0 -214
- package/test/unit/api/daikinCloud.test.ts +0 -12
- package/test/unit/config/config-manager.test.ts +0 -271
- package/test/unit/device/daikin-device.test.ts +0 -79
- package/test/unit/services/hot-water-tank.service.test.ts +0 -123
- package/test/unit/utils/error-handler.test.ts +0 -274
- package/test/unit/utils/log-context.test.ts +0 -271
package/package.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"displayName": "Daikin Cloud",
|
|
3
3
|
"platformname": "daikincloud",
|
|
4
4
|
"name": "@mp-consulting/homebridge-daikin-cloud",
|
|
5
|
-
"version": "1.3.
|
|
5
|
+
"version": "1.3.7",
|
|
6
6
|
"description": "Integrate with the Daikin Cloud to control your Daikin air conditioning via the cloud",
|
|
7
|
-
"license": "Apache-2.0",
|
|
7
|
+
"license": "(Apache-2.0 AND MIT)",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git://github.com/mp-consulting/homebridge-daikin-cloud.git"
|
|
10
|
+
"url": "git+https://github.com/mp-consulting/homebridge-daikin-cloud.git"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/mp-consulting/homebridge-daikin-cloud/issues"
|
|
@@ -20,11 +20,13 @@
|
|
|
20
20
|
"customUi": true,
|
|
21
21
|
"customUiPath": "./homebridge-ui",
|
|
22
22
|
"scripts": {
|
|
23
|
-
"test": "
|
|
24
|
-
"test:
|
|
25
|
-
"
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"test:watch": "vitest",
|
|
25
|
+
"test:coverage": "vitest run --coverage",
|
|
26
|
+
"lint": "eslint . --max-warnings=0",
|
|
26
27
|
"watch": "npm run build && npm link && nodemon",
|
|
27
28
|
"build": "rimraf ./dist && tsc",
|
|
29
|
+
"prepublishOnly": "npm run lint && npm run build",
|
|
28
30
|
"release": "npm publish",
|
|
29
31
|
"release:beta": "npm publish --tag beta"
|
|
30
32
|
},
|
|
@@ -33,31 +35,31 @@
|
|
|
33
35
|
],
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"@homebridge/plugin-ui-utils": "^1.0.3",
|
|
36
|
-
"ws": "^8.19.0"
|
|
38
|
+
"ws": "^8.19.0",
|
|
39
|
+
"zod": "^3.23.8"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@types/node": "^
|
|
42
|
+
"@eslint/js": "^9.39.2",
|
|
43
|
+
"@types/node": "^24.0.0",
|
|
41
44
|
"@types/ws": "^8.18.1",
|
|
42
|
-
"@
|
|
43
|
-
"
|
|
44
|
-
"eslint": "^8.20.0",
|
|
45
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
46
|
+
"eslint": "^9.39.2",
|
|
45
47
|
"hap-nodejs": "^1.1.0",
|
|
46
|
-
"homebridge": "^
|
|
47
|
-
"homebridge-config-ui-x": "^
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
48
|
+
"homebridge": "^2.0.0-beta.55",
|
|
49
|
+
"homebridge-config-ui-x": "^5.15.0",
|
|
50
|
+
"nodemon": "^3.1.11",
|
|
51
|
+
"rimraf": "^6.1.0",
|
|
52
|
+
"typescript": "^5.9.3",
|
|
53
|
+
"typescript-eslint": "^8.53.1",
|
|
54
|
+
"vitest": "^4.0.18"
|
|
55
|
+
},
|
|
56
|
+
"funding": {
|
|
57
|
+
"type": "paypal",
|
|
58
|
+
"url": "https://paypal.me/mickaelpalma"
|
|
56
59
|
},
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
60
|
+
"files": [
|
|
61
|
+
"dist",
|
|
62
|
+
"homebridge-ui",
|
|
63
|
+
"config.schema.json"
|
|
62
64
|
]
|
|
63
65
|
}
|
package/.claude/settings.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"permissions": {
|
|
3
|
-
"allow": [
|
|
4
|
-
"Bash(node -c:*)",
|
|
5
|
-
"Bash(tree:*)",
|
|
6
|
-
"Bash(wc:*)",
|
|
7
|
-
"Bash(find:*)",
|
|
8
|
-
"Bash(git add:*)",
|
|
9
|
-
"Bash(git commit:*)",
|
|
10
|
-
"Bash(brew install:*)",
|
|
11
|
-
"Bash(brew link:*)",
|
|
12
|
-
"Bash(node --version)",
|
|
13
|
-
"Bash(npm --version:*)",
|
|
14
|
-
"Bash(~/.zshrc)",
|
|
15
|
-
"Bash(npm test:*)",
|
|
16
|
-
"Bash(npm run build:*)",
|
|
17
|
-
"Bash(brew --prefix:*)",
|
|
18
|
-
"Bash(echo:*)",
|
|
19
|
-
"Bash(brew list:*)",
|
|
20
|
-
"Bash(claude --version:*)",
|
|
21
|
-
"Bash(git reset:*)",
|
|
22
|
-
"Bash(git checkout:*)",
|
|
23
|
-
"Bash(npm run lint:*)",
|
|
24
|
-
"Bash(npm audit:*)",
|
|
25
|
-
"Bash(npm install:*)",
|
|
26
|
-
"Bash(npm uninstall:*)"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [1.3.5] - 2026-01-10
|
|
9
|
-
|
|
10
|
-
### Fixed
|
|
11
|
-
|
|
12
|
-
- **Device Visibility initialization**: Fixed "Token expired or invalid" error in Device Visibility section while Discovered Devices worked correctly. Settings.load() now waits for AuthMode initialization to complete before loading device toggles, ensuring the correct authentication token is used.
|
|
13
|
-
|
|
14
|
-
## [1.3.4] - 2026-01-10
|
|
15
|
-
|
|
16
|
-
### Fixed
|
|
17
|
-
|
|
18
|
-
- **UI error message display**: Device Visibility section now displays specific error messages from the backend instead of generic text. Users can now see helpful messages distinguishing between authentication failures and empty device lists, making troubleshooting easier.
|
|
19
|
-
|
|
20
|
-
## [1.3.3] - 2026-01-10
|
|
21
|
-
|
|
22
|
-
### Fixed
|
|
23
|
-
|
|
24
|
-
- **UI initialization race condition**: Fixed "Token expired or invalid" error on initial UI load. The device list now waits for `AuthMode` initialization to complete before fetching devices. Backend now gracefully falls back to active token if the requested mode's token is unavailable, ensuring device list loads even during initialization.
|
|
25
|
-
|
|
26
|
-
## [1.3.2] - 2026-01-10
|
|
27
|
-
|
|
28
|
-
### Fixed
|
|
29
|
-
|
|
30
|
-
- **UI JavaScript error**: Fixed "Can't find variable: AuthModeManager" error by correcting variable reference to `AuthMode`. This error prevented the device list from loading in the plugin UI.
|
|
31
|
-
|
|
32
|
-
## [1.3.1] - 2026-01-10
|
|
33
|
-
|
|
34
|
-
### Fixed
|
|
35
|
-
|
|
36
|
-
- **UI device list authentication**: Fixed `/devices/list` endpoint to use the token matching the configured `authMode` instead of always prioritizing mobile token. Previously, if both mobile_app and developer_portal tokens existed, the endpoint would always use the mobile token regardless of the configured authMode setting, causing authentication mismatches.
|
|
37
|
-
|
|
38
|
-
## [1.3.0] - 2026-01-10
|
|
39
|
-
|
|
40
|
-
### Added
|
|
41
|
-
|
|
42
|
-
- **Strict TypeScript checking**: Enabled `strict`, `noImplicitAny`, `strictNullChecks`, `strictFunctionTypes`, and `strictPropertyInitialization` for improved type safety
|
|
43
|
-
- **Runtime validation with Zod**: Added comprehensive validation schemas for API responses, WebSocket messages, and configuration
|
|
44
|
-
- Token set validation
|
|
45
|
-
- Device data validation
|
|
46
|
-
- Configuration validation with helpful error messages
|
|
47
|
-
- **Utility modules** for improved reliability:
|
|
48
|
-
- `retry.ts`: Exponential backoff retry logic with configurable options
|
|
49
|
-
- `daikin-device-tracker.ts`: Device state tracking with change detection and error history
|
|
50
|
-
- **Comprehensive documentation** in `docs/` folder:
|
|
51
|
-
- `ARCHITECTURE.md`: System architecture, component design, and extension guides
|
|
52
|
-
- `IMPLEMENTATION_GUIDE.md`: Step-by-step guide for future improvements
|
|
53
|
-
- `IMPROVEMENTS_SUMMARY.md`: Executive summary of completed work
|
|
54
|
-
- `NEXT_STEPS.md`: Quick-start guide for continuing development
|
|
55
|
-
- **Enhanced CLAUDE.md**: Project-specific development guidelines and workflows
|
|
56
|
-
|
|
57
|
-
### Changed
|
|
58
|
-
|
|
59
|
-
- Consolidated WebSocket update logic using UpdateMapper (removed 180+ lines of duplication)
|
|
60
|
-
- Updated GitHub Actions workflows from v2/v3 to v4 (removed deprecation warnings)
|
|
61
|
-
- Improved test coverage with strict TypeScript compatibility
|
|
62
|
-
|
|
63
|
-
### Fixed
|
|
64
|
-
|
|
65
|
-
- 2 implicit `any` type errors in daikin-cloud.repository.ts
|
|
66
|
-
- Test compatibility issues with strict TypeScript mode
|
|
67
|
-
- UpdateMapper type compatibility issue
|
|
68
|
-
|
|
69
|
-
### Security
|
|
70
|
-
|
|
71
|
-
- Verified token file permissions (already secure at mode 0o600)
|
|
72
|
-
- Updated CI/CD dependencies to latest versions
|
|
73
|
-
|
|
74
|
-
### Documentation
|
|
75
|
-
|
|
76
|
-
- Moved all architectural and implementation documentation to `docs/` folder
|
|
77
|
-
- Enhanced project documentation for maintainers and contributors
|
|
78
|
-
- Added code examples and usage patterns for utilities
|
|
79
|
-
|
|
80
|
-
## [1.2.5] - 2026-01-10
|
|
81
|
-
|
|
82
|
-
### Fixed
|
|
83
|
-
|
|
84
|
-
- Fix API request format for temperature control to match mobile app format
|
|
85
|
-
- Path parameter now sent in request body instead of URL, resolving 504 Gateway Timeout errors when setting temperature
|
|
86
|
-
|
|
87
|
-
## [1.2.4] - 2026-01-09
|
|
88
|
-
|
|
89
|
-
### Fixed
|
|
90
|
-
|
|
91
|
-
- Handle API gateway timeout errors (502, 503, 504) with automatic retry and exponential backoff
|
|
92
|
-
- Requests now retry up to 3 times before failing, resolving most transient Daikin API issues
|
|
93
|
-
|
|
94
|
-
## [1.2.3] - 2026-01-09
|
|
95
|
-
|
|
96
|
-
### Fixed
|
|
97
|
-
|
|
98
|
-
- Check getData value property instead of result object in service
|
|
99
|
-
- Enable skipped tests and fix test isolation
|
|
100
|
-
|
|
101
|
-
### Added
|
|
102
|
-
|
|
103
|
-
- Automatic token refresh with exponential backoff for 401 errors
|
package/CLAUDE.md
DELETED
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
# Claude Code Settings
|
|
2
|
-
|
|
3
|
-
## Project Overview
|
|
4
|
-
|
|
5
|
-
This is a Homebridge plugin for Daikin Cloud (Onecta) integration that allows controlling Daikin air conditioning units through Apple HomeKit. The plugin supports both Developer Portal and Mobile App authentication methods.
|
|
6
|
-
|
|
7
|
-
**Key Technologies:**
|
|
8
|
-
- TypeScript (target: ESNext)
|
|
9
|
-
- Homebridge Plugin API
|
|
10
|
-
- HAP-nodejs (HomeKit Accessory Protocol)
|
|
11
|
-
- Jest for testing
|
|
12
|
-
- ESLint for code quality
|
|
13
|
-
|
|
14
|
-
## Git Settings
|
|
15
|
-
|
|
16
|
-
- `coAuthoredBy`: false
|
|
17
|
-
|
|
18
|
-
## Git Commit Convention
|
|
19
|
-
|
|
20
|
-
Use conventional commits format for all commit messages:
|
|
21
|
-
|
|
22
|
-
```
|
|
23
|
-
<type>(<scope>): <description>
|
|
24
|
-
|
|
25
|
-
[optional body]
|
|
26
|
-
|
|
27
|
-
[optional footer]
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Types
|
|
31
|
-
- `feat`: New feature
|
|
32
|
-
- `fix`: Bug fix
|
|
33
|
-
- `docs`: Documentation changes
|
|
34
|
-
- `style`: Code style changes (formatting, semicolons, etc.)
|
|
35
|
-
- `refactor`: Code refactoring (no functional changes)
|
|
36
|
-
- `test`: Adding or updating tests
|
|
37
|
-
- `chore`: Maintenance tasks, dependencies, build changes
|
|
38
|
-
- `perf`: Performance improvements
|
|
39
|
-
- `ci`: CI/CD changes
|
|
40
|
-
|
|
41
|
-
### Scopes
|
|
42
|
-
Common scopes used in this project:
|
|
43
|
-
- `api`: Daikin API client, OAuth, WebSocket
|
|
44
|
-
- `service`: Climate control, hot water tank services
|
|
45
|
-
- `accessory`: Air conditioning, Altherma accessories
|
|
46
|
-
- `feature`: Feature modules (modes like powerful, econo, etc.)
|
|
47
|
-
- `device`: Device profiles, capability detection
|
|
48
|
-
- `config`: Configuration management
|
|
49
|
-
- `utils`: Utility functions
|
|
50
|
-
- `build`: Build system and TypeScript configuration
|
|
51
|
-
- `deps`: Dependency updates
|
|
52
|
-
|
|
53
|
-
### Examples
|
|
54
|
-
- `feat(api): add device capability detection`
|
|
55
|
-
- `fix(service): resolve temperature validation warning`
|
|
56
|
-
- `chore(deps): update dependencies`
|
|
57
|
-
- `refactor(features): extract feature modules from service`
|
|
58
|
-
- `test(utils): add comprehensive StructuredLogger tests`
|
|
59
|
-
|
|
60
|
-
## Code Style Guidelines
|
|
61
|
-
|
|
62
|
-
### TypeScript & Code Quality
|
|
63
|
-
|
|
64
|
-
1. **Indentation**: Use 4 spaces (enforced by ESLint)
|
|
65
|
-
2. **Quotes**: Use single quotes for strings
|
|
66
|
-
3. **Semicolons**: Optional but should be consistent
|
|
67
|
-
4. **Trailing commas**: Required in multiline objects/arrays
|
|
68
|
-
5. **Type safety**:
|
|
69
|
-
- `strict: true` in tsconfig
|
|
70
|
-
- `noImplicitAny: false` (be mindful of types)
|
|
71
|
-
- Prefer explicit types for public APIs
|
|
72
|
-
|
|
73
|
-
### ESLint Rules
|
|
74
|
-
The project uses `@typescript-eslint` with custom rules:
|
|
75
|
-
- No `console.log` - use Homebridge logger instead
|
|
76
|
-
- Prefer arrow callbacks
|
|
77
|
-
- Always use curly braces
|
|
78
|
-
- Enforce comma spacing
|
|
79
|
-
- No trailing spaces
|
|
80
|
-
|
|
81
|
-
### File Organization
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
src/
|
|
85
|
-
├── accessories/ # HAP accessories (air-conditioning, altherma)
|
|
86
|
-
├── api/ # Daikin API clients (OAuth, WebSocket, repository)
|
|
87
|
-
├── config/ # Configuration management
|
|
88
|
-
├── constants/ # Shared constants (API, auth, device, time)
|
|
89
|
-
├── device/ # Device profiles and capability detection
|
|
90
|
-
├── di/ # Dependency injection (service container)
|
|
91
|
-
├── features/ # Feature modules (modes as switches)
|
|
92
|
-
├── services/ # HAP services (climate control, hot water)
|
|
93
|
-
├── types/ # TypeScript type definitions
|
|
94
|
-
├── utils/ # Utility functions (logging, error handling)
|
|
95
|
-
├── index.ts # Plugin entry point
|
|
96
|
-
├── platform.ts # Main platform class
|
|
97
|
-
└── settings.ts # Plugin settings
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Test Organization
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
test/
|
|
104
|
-
├── fixtures/ # Test data (device responses)
|
|
105
|
-
├── mocks/ # Mock objects for testing
|
|
106
|
-
├── helpers/ # Test utilities
|
|
107
|
-
├── unit/ # Unit tests
|
|
108
|
-
│ ├── api/
|
|
109
|
-
│ ├── device/
|
|
110
|
-
│ ├── services/
|
|
111
|
-
│ └── utils/
|
|
112
|
-
└── integration/ # Integration tests
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Development Workflow
|
|
116
|
-
|
|
117
|
-
### Building and Testing
|
|
118
|
-
|
|
119
|
-
```bash
|
|
120
|
-
# Install dependencies
|
|
121
|
-
npm install
|
|
122
|
-
|
|
123
|
-
# Build TypeScript
|
|
124
|
-
npm run build
|
|
125
|
-
|
|
126
|
-
# Run linter
|
|
127
|
-
npm run lint
|
|
128
|
-
|
|
129
|
-
# Run tests
|
|
130
|
-
npm test
|
|
131
|
-
|
|
132
|
-
# Update test snapshots
|
|
133
|
-
npm run test:updateSnapshots
|
|
134
|
-
|
|
135
|
-
# Development with auto-rebuild
|
|
136
|
-
npm run watch
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Testing Guidelines
|
|
140
|
-
|
|
141
|
-
1. **Write tests for new features**: All new functionality should include unit tests
|
|
142
|
-
2. **Update snapshots carefully**: Review snapshot changes before committing
|
|
143
|
-
3. **Use fixtures**: Add device response fixtures in `test/fixtures/` for new device types
|
|
144
|
-
4. **Mock external dependencies**: Use mocks from `test/mocks/` for API calls
|
|
145
|
-
5. **Test coverage**: Aim for good coverage, especially for API and service layers
|
|
146
|
-
|
|
147
|
-
### Common Development Tasks
|
|
148
|
-
|
|
149
|
-
#### Adding a New Feature Mode
|
|
150
|
-
|
|
151
|
-
1. Create feature class in `src/features/modes/`
|
|
152
|
-
2. Extend `BaseFeature` class
|
|
153
|
-
3. Register in feature registry
|
|
154
|
-
4. Add configuration option in settings
|
|
155
|
-
5. Add tests in `test/unit/features/`
|
|
156
|
-
6. Update documentation
|
|
157
|
-
|
|
158
|
-
#### Adding Device Support
|
|
159
|
-
|
|
160
|
-
1. Add device response fixture in `test/fixtures/`
|
|
161
|
-
2. Update capability detector if needed
|
|
162
|
-
3. Create/update device profile in `src/device/profiles/`
|
|
163
|
-
4. Add integration test
|
|
164
|
-
5. Document in [README.md](README.md)
|
|
165
|
-
|
|
166
|
-
#### Fixing API Issues
|
|
167
|
-
|
|
168
|
-
1. Check error handling in `src/utils/error-handler.ts`
|
|
169
|
-
2. Review rate limiting in `src/api/daikin-cloud.repository.ts`
|
|
170
|
-
3. Update retry logic if needed
|
|
171
|
-
4. Add tests for error scenarios
|
|
172
|
-
|
|
173
|
-
## Homebridge-Specific Considerations
|
|
174
|
-
|
|
175
|
-
### Platform Plugin Structure
|
|
176
|
-
|
|
177
|
-
- **Platform**: [platform.ts](src/platform.ts) - Main entry point, manages accessories
|
|
178
|
-
- **Accessories**: [src/accessories/](src/accessories/) - HAP accessory implementations
|
|
179
|
-
- **Services**: [src/services/](src/services/) - HAP service wrappers
|
|
180
|
-
|
|
181
|
-
### HAP Service Types Used
|
|
182
|
-
|
|
183
|
-
- `HeaterCooler`: Main climate control
|
|
184
|
-
- `TemperatureSensor`: Room temperature
|
|
185
|
-
- `Switch`: Feature modes (powerful, econo, etc.)
|
|
186
|
-
- `Thermostat`: Altherma heating (optional)
|
|
187
|
-
|
|
188
|
-
### Configuration Schema
|
|
189
|
-
|
|
190
|
-
Configuration is managed via Homebridge UI:
|
|
191
|
-
- `homebridge-ui/` directory contains custom UI
|
|
192
|
-
- Config schema defined in `package.json`
|
|
193
|
-
- Validation in [src/config/config-manager.ts](src/config/config-manager.ts)
|
|
194
|
-
|
|
195
|
-
## API Integration Notes
|
|
196
|
-
|
|
197
|
-
### Authentication Methods
|
|
198
|
-
|
|
199
|
-
1. **Developer Portal** (OAuth 2.0):
|
|
200
|
-
- Client ID/Secret from Daikin Developer Portal
|
|
201
|
-
- 200 API calls/day limit
|
|
202
|
-
- Callback server for OAuth flow
|
|
203
|
-
|
|
204
|
-
2. **Mobile App** (Gigya):
|
|
205
|
-
- Email/password authentication
|
|
206
|
-
- 5000 API calls/day limit
|
|
207
|
-
- WebSocket support for real-time updates
|
|
208
|
-
|
|
209
|
-
### Rate Limiting
|
|
210
|
-
|
|
211
|
-
- Implemented in [daikin-cloud.repository.ts](src/api/daikin-cloud.repository.ts)
|
|
212
|
-
- Exponential backoff for retries
|
|
213
|
-
- Gateway timeout handling (502, 503, 504)
|
|
214
|
-
|
|
215
|
-
### WebSocket Support
|
|
216
|
-
|
|
217
|
-
- Only available in Mobile App mode
|
|
218
|
-
- Real-time device state updates
|
|
219
|
-
- Implemented in [daikin-websocket.ts](src/api/daikin-websocket.ts)
|
|
220
|
-
|
|
221
|
-
## Debugging Tips
|
|
222
|
-
|
|
223
|
-
### Enable Debug Logging
|
|
224
|
-
|
|
225
|
-
Set Homebridge debug mode:
|
|
226
|
-
```bash
|
|
227
|
-
homebridge -D
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### Common Issues
|
|
231
|
-
|
|
232
|
-
1. **Token expired**: Delete `~/.homebridge/.daikin-controller-cloud-tokenset`
|
|
233
|
-
2. **Device not found**: Check `excludedDevicesByDeviceId` in config
|
|
234
|
-
3. **WebSocket connection fails**: Verify Mobile App credentials
|
|
235
|
-
4. **Rate limit hit**: Increase `updateIntervalInMinutes`
|
|
236
|
-
|
|
237
|
-
### Useful Log Contexts
|
|
238
|
-
|
|
239
|
-
The codebase uses structured logging:
|
|
240
|
-
- Check [log-context.ts](src/utils/log-context.ts) for log formatting
|
|
241
|
-
- Error handling in [error-handler.ts](src/utils/error-handler.ts)
|
|
242
|
-
|
|
243
|
-
## Release Process
|
|
244
|
-
|
|
245
|
-
1. Update version in [package.json](package.json)
|
|
246
|
-
2. Update [README.md](README.md) if needed
|
|
247
|
-
3. Run tests: `npm test`
|
|
248
|
-
4. Build: `npm run build`
|
|
249
|
-
5. Commit with version bump: `chore: bump version to X.Y.Z`
|
|
250
|
-
6. Tag release: `git tag vX.Y.Z`
|
|
251
|
-
7. Push: `git push && git push --tags`
|
|
252
|
-
8. Publish: `npm run release` (or `npm run release:beta`)
|
|
253
|
-
|
|
254
|
-
## Important Constraints
|
|
255
|
-
|
|
256
|
-
### Do NOT
|
|
257
|
-
- Use `console.log` - always use Homebridge logger
|
|
258
|
-
- Commit without running tests and linter
|
|
259
|
-
- Add dependencies without considering bundle size
|
|
260
|
-
- Break backward compatibility without major version bump
|
|
261
|
-
- Hardcode sensitive data (credentials, tokens)
|
|
262
|
-
|
|
263
|
-
### DO
|
|
264
|
-
- Follow the established directory structure
|
|
265
|
-
- Add tests for new features
|
|
266
|
-
- Update documentation
|
|
267
|
-
- Use dependency injection via service container
|
|
268
|
-
- Handle errors gracefully with user-friendly messages
|
|
269
|
-
- Consider API rate limits in all API calls
|
package/config.md
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Device Tracker
|
|
3
|
-
*
|
|
4
|
-
* Tracks device state changes and errors for differential updates and diagnostics.
|
|
5
|
-
* Enables efficient polling by only updating devices that have changed.
|
|
6
|
-
*/
|
|
7
|
-
import { GatewayDevice } from './daikin-types';
|
|
8
|
-
export interface DeviceError {
|
|
9
|
-
timestamp: Date;
|
|
10
|
-
severity: 'error' | 'warning';
|
|
11
|
-
message: string;
|
|
12
|
-
operation: string;
|
|
13
|
-
retryCount: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Device Tracker for managing device state and error history
|
|
17
|
-
*/
|
|
18
|
-
export declare class DeviceTracker {
|
|
19
|
-
private lastUpdate;
|
|
20
|
-
private dataHash;
|
|
21
|
-
private errors;
|
|
22
|
-
private readonly maxErrors;
|
|
23
|
-
/**
|
|
24
|
-
* Check if device data has changed since last update
|
|
25
|
-
*
|
|
26
|
-
* @param newData - New device data from API
|
|
27
|
-
* @returns True if data has changed
|
|
28
|
-
*/
|
|
29
|
-
hasChanges(newData: GatewayDevice): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Update the tracked state
|
|
32
|
-
*
|
|
33
|
-
* @param data - Device data to track
|
|
34
|
-
*/
|
|
35
|
-
updateState(data: GatewayDevice): void;
|
|
36
|
-
/**
|
|
37
|
-
* Get time since last update in milliseconds
|
|
38
|
-
*
|
|
39
|
-
* @returns Milliseconds since last update
|
|
40
|
-
*/
|
|
41
|
-
getTimeSinceLastUpdate(): number;
|
|
42
|
-
/**
|
|
43
|
-
* Get last update timestamp
|
|
44
|
-
*
|
|
45
|
-
* @returns Date of last update
|
|
46
|
-
*/
|
|
47
|
-
getLastUpdateTime(): Date;
|
|
48
|
-
/**
|
|
49
|
-
* Add an error to the device error history
|
|
50
|
-
*
|
|
51
|
-
* @param error - Error details
|
|
52
|
-
*/
|
|
53
|
-
addError(error: DeviceError): void;
|
|
54
|
-
/**
|
|
55
|
-
* Get all recorded errors
|
|
56
|
-
*
|
|
57
|
-
* @returns Array of errors
|
|
58
|
-
*/
|
|
59
|
-
getErrors(): DeviceError[];
|
|
60
|
-
/**
|
|
61
|
-
* Get errors since a specific time
|
|
62
|
-
*
|
|
63
|
-
* @param since - Date to filter errors from
|
|
64
|
-
* @returns Filtered errors
|
|
65
|
-
*/
|
|
66
|
-
getRecentErrors(since: Date): DeviceError[];
|
|
67
|
-
/**
|
|
68
|
-
* Clear all recorded errors
|
|
69
|
-
*/
|
|
70
|
-
clearErrors(): void;
|
|
71
|
-
/**
|
|
72
|
-
* Check if device has recent errors (within last 5 minutes)
|
|
73
|
-
*
|
|
74
|
-
* @returns True if recent errors exist
|
|
75
|
-
*/
|
|
76
|
-
hasRecentErrors(): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Get error count by severity
|
|
79
|
-
*
|
|
80
|
-
* @returns Object with error and warning counts
|
|
81
|
-
*/
|
|
82
|
-
getErrorStats(): {
|
|
83
|
-
errors: number;
|
|
84
|
-
warnings: number;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Compute hash of device data for change detection
|
|
88
|
-
*
|
|
89
|
-
* Uses MD5 hash of JSON-stringified data for fast comparison.
|
|
90
|
-
* Note: This is for change detection only, not cryptographic security.
|
|
91
|
-
*
|
|
92
|
-
* @param data - Device data to hash
|
|
93
|
-
* @returns MD5 hash string
|
|
94
|
-
*/
|
|
95
|
-
private computeHash;
|
|
96
|
-
}
|
|
97
|
-
//# sourceMappingURL=daikin-device-tracker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"daikin-device-tracker.d.ts","sourceRoot":"","sources":["../../../src/api/daikin-device-tracker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAE7C,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAM;IAEhC;;;;;OAKG;IACH,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;IAK3C;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAKtC;;;;OAIG;IACH,sBAAsB,IAAI,MAAM;IAIhC;;;;OAIG;IACH,iBAAiB,IAAI,IAAI;IAIzB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAOlC;;;;OAIG;IACH,SAAS,IAAI,WAAW,EAAE;IAI1B;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,EAAE;IAI3C;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;;;OAIG;IACH,eAAe,IAAI,OAAO;IAK1B;;;;OAIG;IACH,aAAa,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAOrD;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW;CAatB"}
|