homebridge-smarthq-client 1.0.3 → 1.1.2
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 +59 -0
- package/Readme.md +61 -34
- package/config.schema.json +62 -5
- package/dist/dishwasher/controlLock.d.ts +21 -0
- package/dist/dishwasher/controlLock.js +119 -0
- package/dist/dishwasher/controlLock.js.map +1 -0
- package/dist/dishwasher/dishwasher.d.ts +81 -0
- package/dist/dishwasher/dishwasher.js +858 -0
- package/dist/dishwasher/dishwasher.js.map +1 -0
- package/dist/dishwasher/fanFresh.d.ts +22 -0
- package/dist/dishwasher/fanFresh.js +133 -0
- package/dist/dishwasher/fanFresh.js.map +1 -0
- package/dist/dishwasher/sabbathMode.d.ts +21 -0
- package/dist/dishwasher/sabbathMode.js +121 -0
- package/dist/dishwasher/sabbathMode.js.map +1 -0
- package/dist/dishwasher/soundOption.d.ts +22 -0
- package/dist/dishwasher/soundOption.js +131 -0
- package/dist/dishwasher/soundOption.js.map +1 -0
- package/dist/dishwasherServices.d.ts +4 -0
- package/dist/dishwasherServices.js +24 -0
- package/dist/dishwasherServices.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/platform.d.ts +12 -36
- package/dist/platform.js +102 -163
- package/dist/platform.js.map +1 -1
- package/dist/refrigerator/controlLock.d.ts +8 -6
- package/dist/refrigerator/controlLock.js +51 -23
- package/dist/refrigerator/controlLock.js.map +1 -1
- package/dist/refrigerator/convertibleDrawer.d.ts +8 -6
- package/dist/refrigerator/convertibleDrawer.js +216 -152
- package/dist/refrigerator/convertibleDrawer.js.map +1 -1
- package/dist/refrigerator/dispenserLight.d.ts +8 -6
- package/dist/refrigerator/dispenserLight.js +51 -25
- package/dist/refrigerator/dispenserLight.js.map +1 -1
- package/dist/refrigerator/energy.d.ts +8 -6
- package/dist/refrigerator/energy.js +48 -25
- package/dist/refrigerator/energy.js.map +1 -1
- package/dist/refrigerator/freezer.d.ts +8 -6
- package/dist/refrigerator/freezer.js +65 -47
- package/dist/refrigerator/freezer.js.map +1 -1
- package/dist/refrigerator/iceMaker.d.ts +10 -8
- package/dist/refrigerator/iceMaker.js +44 -30
- package/dist/refrigerator/iceMaker.js.map +1 -1
- package/dist/refrigerator/interiorLight.d.ts +8 -6
- package/dist/refrigerator/interiorLight.js +52 -26
- package/dist/refrigerator/interiorLight.js.map +1 -1
- package/dist/refrigerator/refrigerator.d.ts +11 -7
- package/dist/refrigerator/refrigerator.js +103 -56
- package/dist/refrigerator/refrigerator.js.map +1 -1
- package/dist/refrigerator/refrigeratorAlerts.d.ts +9 -7
- package/dist/refrigerator/refrigeratorAlerts.js +90 -75
- package/dist/refrigerator/refrigeratorAlerts.js.map +1 -1
- package/dist/refrigerator/sabbathMode.d.ts +8 -7
- package/dist/refrigerator/sabbathMode.js +56 -30
- package/dist/refrigerator/sabbathMode.js.map +1 -1
- package/dist/refrigerator/temperatureUnits.d.ts +8 -6
- package/dist/refrigerator/temperatureUnits.js +81 -42
- package/dist/refrigerator/temperatureUnits.js.map +1 -1
- package/dist/refrigerator/turboCoolMode.d.ts +8 -6
- package/dist/refrigerator/turboCoolMode.js +77 -39
- package/dist/refrigerator/turboCoolMode.js.map +1 -1
- package/dist/refrigerator/waterFilter.d.ts +8 -6
- package/dist/refrigerator/waterFilter.js +55 -33
- package/dist/refrigerator/waterFilter.js.map +1 -1
- package/dist/refrigeratorServices.d.ts +2 -3
- package/dist/refrigeratorServices.js +14 -14
- package/dist/refrigeratorServices.js.map +1 -1
- package/dist/smarthq-types.d.ts +7 -7
- package/package.json +39 -29
- package/settings.ts +14 -0
- package/src/@types/library-patches.d.ts +11 -0
- package/src/dishwasher/controlLock.ts +153 -0
- package/src/dishwasher/dishwasher.ts +1053 -0
- package/src/dishwasher/fanFresh.ts +154 -0
- package/src/dishwasher/sabbathMode.ts +137 -0
- package/src/dishwasher/soundOption.ts +154 -0
- package/src/dishwasherServices.ts +29 -0
- package/src/index.ts +90 -0
- package/src/platform.ts +125 -218
- package/src/refrigerator/controlLock.ts +60 -35
- package/src/refrigerator/convertibleDrawer.ts +229 -187
- package/src/refrigerator/dispenserLight.ts +58 -34
- package/src/refrigerator/energy.ts +92 -74
- package/src/refrigerator/freezer.ts +69 -56
- package/src/refrigerator/iceMaker.ts +48 -40
- package/src/refrigerator/interiorLight.ts +56 -35
- package/src/refrigerator/refrigerator.ts +125 -70
- package/src/refrigerator/refrigeratorAlerts.ts +94 -83
- package/src/refrigerator/sabbathMode.ts +74 -54
- package/src/refrigerator/temperatureUnits.ts +88 -59
- package/src/refrigerator/turboCoolMode.ts +80 -51
- package/src/refrigerator/waterFilter.ts +59 -45
- package/src/refrigeratorServices.ts +16 -17
- package/src/smarthq-types.ts +8 -8
- package/tsconfig.json +6 -1
- package/dist/smartHqApi.d.ts +0 -29
- package/dist/smartHqApi.js +0 -267
- package/dist/smartHqApi.js.map +0 -1
- package/src/smartHqApi.ts +0 -305
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.1.1](https://github.com/ceb400/homebridge-smarthq-client/releases/tag/v1.1.1) (2026-04-25)
|
|
6
|
+
|
|
7
|
+
## What's Changed
|
|
8
|
+
- Changed some log.info msgs to debug level to eliminate some normal log messages
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## [1.1.0](https://github.com/ceb400/homebridge-smarthq-client/releases/tag/v1.1.0) (2026-04-25)
|
|
12
|
+
|
|
13
|
+
## What's Changed
|
|
14
|
+
- Changed to use pkg *'ge-smarthq'* for all API calls + Oauth2 authentication, token handling and web socket
|
|
15
|
+
- Changed refrigerator alert handling from a polling interval to monitoring via web sockets.
|
|
16
|
+
- added initial support for dishwasher
|
|
17
|
+
- updated config.schema.json to include dishwasher and additional debug logging
|
|
18
|
+
|
|
19
|
+
**Full Changelog**: https://github.com/ceb400/homebridge-smarthq-client/compare/...v1.1.0
|
|
20
|
+
|
|
21
|
+
## [1.0.3](https://github.com/ceb400/homebridge-smarthq-client/releases/tag/v1.0.3) (2026-02-11)
|
|
22
|
+
|
|
23
|
+
## What's Changed
|
|
24
|
+
- Patch for undefined value for targetheattingcooling threshold
|
|
25
|
+
- added a lightbulb Brightness characteristic to display level for water filter pct remaining
|
|
26
|
+
|
|
27
|
+
**Full Changelog**: https://github.com/ceb400/homebridge-smarthq-client/compare/...v1.0.2
|
|
28
|
+
|
|
29
|
+
## [1.0.2](https://github.com/ceb400/homebridge-smarthq-client/releases/tag/v1.0.2) (2026-02-03)
|
|
30
|
+
|
|
31
|
+
## What's Changed
|
|
32
|
+
* No notable changes
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [1.0.1](https://github.com/ceb400/homebridge-smarthq-client/releases/tag/v1.0.1) (2026-02-02)
|
|
36
|
+
|
|
37
|
+
## What's Changed
|
|
38
|
+
- Corrected non-unique display name
|
|
39
|
+
- Updated Readme.md
|
|
40
|
+
- Create License
|
|
41
|
+
- Updated email
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
**Full Changelog**: https://github.com/ceb400/homebridge-smarthq-client/compare/...v1.0.1
|
|
45
|
+
|
|
46
|
+
## [1.0.0](https://github.com/ceb400/homebridge-smarthq-client/releases/tag/v1.0.0) (2026-01-31)
|
|
47
|
+
|
|
48
|
+
## What's Changed
|
|
49
|
+
- Initial release of Homebridge GE SmartHQ
|
|
50
|
+
- Controls for GE refrigerators
|
|
51
|
+
- OAuth2 authentication with automatic token refresh
|
|
52
|
+
- Device discovery and management
|
|
53
|
+
- Service state queries and updates
|
|
54
|
+
- Command execution
|
|
55
|
+
- Alert monitoring
|
|
56
|
+
|
|
57
|
+
**Full Changelog**: https://github.com/ceb400/homebridge-smarthq-client/compare/...v1.0.0
|
|
58
|
+
|
|
59
|
+
|
package/Readme.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
# Homebridge-SmartHQ Client
|
|
4
4
|
|
|
5
|
-
A homebridge plugin for GE appliances using the SmartHQ API s (Identity and Access Management API, Digital Twin API)
|
|
5
|
+
A homebridge plugin for GE appliances using the SmartHQ API s (Identity and Access Management API, Digital Twin API) from npm pkg 'ge-smarthq'. The following devices are implemented:
|
|
6
|
+
* refrigerator
|
|
7
|
+
* dishwasher
|
|
8
|
+
* Other devices will be discovered and service information could be written to the log to assist in adding support for more devices.
|
|
6
9
|
|
|
7
10
|
The refrigerator services include controls for:
|
|
8
11
|
* refrigerator temperature
|
|
@@ -18,6 +21,13 @@ The refrigerator services include controls for:
|
|
|
18
21
|
* water filter maintenance (see notes)
|
|
19
22
|
* additional switches are used to implement notifications
|
|
20
23
|
|
|
24
|
+
The dishwasher services include controls for:
|
|
25
|
+
* Wash cycle presets
|
|
26
|
+
* Wash temperatures
|
|
27
|
+
* Dry temperatures
|
|
28
|
+
* Wash zones
|
|
29
|
+
* Options for steam, bottlewash, silverware, sabbath mode, controls lock
|
|
30
|
+
|
|
21
31
|
|
|
22
32
|
|
|
23
33
|
## Installation
|
|
@@ -49,39 +59,47 @@ Use the Homebridge UI to configure this plugin. See **Requirements** for steps t
|
|
|
49
59
|
* Select the services you want to add for the appliance in the plugin config.
|
|
50
60
|
|
|
51
61
|
* Select Logging options.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
(This info is used to add support for other appliances.)
|
|
62
|
+
* *Plugin Debug Logging* will log additional messages to the Homebridge log.
|
|
63
|
+
* *Display Service Details for all discovered device services* will log sorted information about all services for each discovered device.
|
|
64
|
+
(This info is used to add support for other appliances.)
|
|
65
|
+
* *Display Service Details for only refrigerator services* will only log sorted information about all services for refrigerator.
|
|
66
|
+
* *Display Service Details for only dishwasher services* will only log sorted information about all services for dishwasher.
|
|
55
67
|
|
|
56
68
|
* Save plugin config and restart child bridge.
|
|
57
69
|
|
|
58
70
|
Or manually edit the config file with
|
|
59
71
|
```
|
|
60
72
|
{
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
"
|
|
84
|
-
|
|
73
|
+
"name": "GE SmartHQ",
|
|
74
|
+
"redirectUri": "http://localhost:8888/callback",
|
|
75
|
+
"addControlLock": true,
|
|
76
|
+
"addConvertibleDrawer": true,
|
|
77
|
+
"addDispenserLight": true,
|
|
78
|
+
"addIceMaker": true,
|
|
79
|
+
"addInteriorLight": true,
|
|
80
|
+
"addSabbathMode": true,
|
|
81
|
+
"addTemperatureUnits": true,
|
|
82
|
+
"addEnergyMonitor": true,
|
|
83
|
+
"addTurboCool": true,
|
|
84
|
+
"addWaterFilter": true,
|
|
85
|
+
"addAlerts": true,
|
|
86
|
+
"addDwSabbath": true,
|
|
87
|
+
"addDwSound": true,
|
|
88
|
+
"addDwFanFresh": true,
|
|
89
|
+
"addDwControlLock": true,
|
|
90
|
+
"debugLogging": true,
|
|
91
|
+
"clientId": "your client Id",
|
|
92
|
+
"clientSecret": "your client Secret",
|
|
93
|
+
"_bridge": {
|
|
94
|
+
"name": "Homebridge GE SmartHQ",
|
|
95
|
+
"username": "0E:1B:48:E5:A4:B9",
|
|
96
|
+
"port": 50928
|
|
97
|
+
},
|
|
98
|
+
"debugServicesFridge": false,
|
|
99
|
+
"debugServicesDishwasher": false,
|
|
100
|
+
"debugServicesAll": false,
|
|
101
|
+
"platform": "SmartHqPlatform"
|
|
102
|
+
}
|
|
85
103
|
```
|
|
86
104
|
|
|
87
105
|
|
|
@@ -96,9 +114,9 @@ Click on the URL to be redirected to a SmartHQ authorization screen.
|
|
|
96
114
|
Login to your SmartHQ account to complete the process.
|
|
97
115
|
Once an access (and refresh) token have been saved this step will only be needed if the file
|
|
98
116
|
used to store your tokens is deleted.
|
|
99
|
-
When an access token expires the plugin will use the refresh token to obtain a new access token.
|
|
117
|
+
When an access token expires the plugin will use the refresh token to obtain a new access token automatically.
|
|
100
118
|
|
|
101
|
-
## Notifications
|
|
119
|
+
## Notifications (for refrigerators)
|
|
102
120
|
|
|
103
121
|
API device alerts are monitored for the following conditions:
|
|
104
122
|
* Door left open
|
|
@@ -117,7 +135,8 @@ These switches will appear in Accessories as *Alert Door*, *Alert Temp*, *Alert
|
|
|
117
135
|
|
|
118
136
|
[SmartHQ Documentation](https://developer.smarthq.com/)
|
|
119
137
|
|
|
120
|
-
## Notes
|
|
138
|
+
## Notes
|
|
139
|
+
(for refrigerator)
|
|
121
140
|
The *water filter maintenance* option uses the Filter Maintenance Service in the Homebridge API.
|
|
122
141
|
The service exists in HomeKit but has not been implemented in the Apple Home app.
|
|
123
142
|
If selected in the plugin config you will notice a tile on the Homebridge Accessories page but there
|
|
@@ -126,15 +145,23 @@ will not be any tile/device shown in the Home app.
|
|
|
126
145
|
2/11/26 Added a lightbulb service Brightness characteristic to show remaining water filter %. (this will be displayed in HomeKit)
|
|
127
146
|
|
|
128
147
|
|
|
148
|
+
## Acknowledgements
|
|
149
|
+
|
|
150
|
+
[donavanbecker](https://github.com/donavanbecker) for the excellent 'ge-smarthq' pkg.
|
|
151
|
+
GE SmartHQ API Client
|
|
152
|
+
|
|
153
|
+
|
|
129
154
|
## Feedback
|
|
130
155
|
|
|
131
156
|
If you have any feedback, please reach out at: ceb40win@outlook.com
|
|
132
157
|
|
|
133
|
-
If you have GE smart appliances other than refrigerator you can capture
|
|
158
|
+
If you have GE smart appliances other than refrigerator or dishwasher you can capture
|
|
134
159
|
the following information (after adding the appliance to your SmartHQ account)
|
|
135
|
-
* Update the plugin config to select *Display Service Details*
|
|
160
|
+
* Update the plugin config to select *'Display Service Details for all discovered device services'*
|
|
136
161
|
* Restart the child bridge.
|
|
137
|
-
* Copy log output including 'SmartHQ Discovered device: newDevice Model:
|
|
162
|
+
* Copy log output including 'SmartHQ Discovered device: *newDevice* Model: *deviceModelNumber*'
|
|
138
163
|
plus all logged services and forward the file to me.
|
|
139
164
|
As my time permits I will attempt to add support for new devices.
|
|
140
165
|
|
|
166
|
+
Or fork the repository to add support for other devices.
|
|
167
|
+
|
package/config.schema.json
CHANGED
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
"singular": true,
|
|
5
5
|
"schema": {
|
|
6
6
|
"type": "object",
|
|
7
|
-
"required": ["clientId", "clientSecret"],
|
|
8
7
|
"properties": {
|
|
8
|
+
"name": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"title": "Name",
|
|
11
|
+
"default": "GE SmartHQ"
|
|
12
|
+
},
|
|
9
13
|
"clientId": {
|
|
10
14
|
"type": "string",
|
|
11
15
|
"title": "SmartHQ Client ID",
|
|
@@ -81,17 +85,51 @@
|
|
|
81
85
|
"title": "Add Alert Notifications",
|
|
82
86
|
"default": false
|
|
83
87
|
},
|
|
88
|
+
"addDwSabbath": {
|
|
89
|
+
"type": "boolean",
|
|
90
|
+
"title": "Add Sabbath Mode Control",
|
|
91
|
+
"default": false
|
|
92
|
+
},
|
|
93
|
+
"addDwSound": {
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"title": "Add Sound Option Control",
|
|
96
|
+
"default": false
|
|
97
|
+
},
|
|
98
|
+
"addDwFanFresh": {
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"title": "Add Fan Fresh Control",
|
|
101
|
+
"default": false
|
|
102
|
+
},
|
|
103
|
+
"addDwControlLock": {
|
|
104
|
+
"type": "boolean",
|
|
105
|
+
"title": "Add Control Lock Control",
|
|
106
|
+
"default": false
|
|
107
|
+
},
|
|
84
108
|
"debugLogging": {
|
|
85
109
|
"type": "boolean",
|
|
86
110
|
"title": "Plugin Debug Logging w/Chalk Colors",
|
|
87
111
|
"default": false
|
|
88
112
|
},
|
|
89
|
-
"
|
|
113
|
+
"debugServicesFridge": {
|
|
114
|
+
"type": "boolean",
|
|
115
|
+
"title": "Display Service Details for only refrigerator services",
|
|
116
|
+
"default": false
|
|
117
|
+
},
|
|
118
|
+
"debugServicesDishwasher": {
|
|
90
119
|
"type": "boolean",
|
|
91
|
-
"title": "Display Service Details for
|
|
120
|
+
"title": "Display Service Details for only dishwasher services",
|
|
121
|
+
"default": false
|
|
122
|
+
},
|
|
123
|
+
"debugServicesAll": {
|
|
124
|
+
"type": "boolean",
|
|
125
|
+
"title": "Display Service Details for all discovered device services",
|
|
92
126
|
"default": false
|
|
93
127
|
}
|
|
94
|
-
}
|
|
128
|
+
},
|
|
129
|
+
"required": [
|
|
130
|
+
"clientId",
|
|
131
|
+
"clientSecret"
|
|
132
|
+
]
|
|
95
133
|
},
|
|
96
134
|
"layout": [
|
|
97
135
|
{
|
|
@@ -108,6 +146,23 @@
|
|
|
108
146
|
}
|
|
109
147
|
]
|
|
110
148
|
},
|
|
149
|
+
{
|
|
150
|
+
"type": "section",
|
|
151
|
+
"title": "Dishwasher Services",
|
|
152
|
+
"expandable": true,
|
|
153
|
+
"expanded": false,
|
|
154
|
+
"items": [
|
|
155
|
+
{
|
|
156
|
+
"description": "Include the selected dishwasher services.",
|
|
157
|
+
"items": [
|
|
158
|
+
"addDwSabbath",
|
|
159
|
+
"addDwSound",
|
|
160
|
+
"addDwFanFresh",
|
|
161
|
+
"addDwControlLock"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
},
|
|
111
166
|
{
|
|
112
167
|
"type": "section",
|
|
113
168
|
"title": "Refrigerator Services",
|
|
@@ -139,7 +194,9 @@
|
|
|
139
194
|
"expanded": false,
|
|
140
195
|
"items": [
|
|
141
196
|
"debugLogging",
|
|
142
|
-
"
|
|
197
|
+
"debugServicesAll",
|
|
198
|
+
"debugServicesFridge",
|
|
199
|
+
"debugServicesDishwasher"
|
|
143
200
|
]
|
|
144
201
|
}
|
|
145
202
|
]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CharacteristicValue, PlatformAccessory, Service, Characteristic } from "homebridge";
|
|
2
|
+
import { DeviceService } from "ge-smarthq";
|
|
3
|
+
import { SmartHqPlatform } from "../platform.js";
|
|
4
|
+
/**
|
|
5
|
+
* Platform Accessory
|
|
6
|
+
* An instance of this class is created for each accessory your platform registers
|
|
7
|
+
* Each accessory may expose multiple services of different service types.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ControlLock {
|
|
10
|
+
private readonly platform;
|
|
11
|
+
private readonly accessory;
|
|
12
|
+
readonly deviceServices: DeviceService[];
|
|
13
|
+
readonly deviceId: string;
|
|
14
|
+
private client;
|
|
15
|
+
readonly Service: typeof Service;
|
|
16
|
+
readonly Characteristic: typeof Characteristic;
|
|
17
|
+
private readonly api;
|
|
18
|
+
constructor(platform: SmartHqPlatform, accessory: PlatformAccessory, deviceServices: DeviceService[], deviceId: string);
|
|
19
|
+
getcontrolsLock(): Promise<CharacteristicValue>;
|
|
20
|
+
setcontrolsLock(value: CharacteristicValue): Promise<void>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { SmartHQClient } from "ge-smarthq";
|
|
2
|
+
/**
|
|
3
|
+
* Platform Accessory
|
|
4
|
+
* An instance of this class is created for each accessory your platform registers
|
|
5
|
+
* Each accessory may expose multiple services of different service types.
|
|
6
|
+
*/
|
|
7
|
+
export class ControlLock {
|
|
8
|
+
platform;
|
|
9
|
+
accessory;
|
|
10
|
+
deviceServices;
|
|
11
|
+
deviceId;
|
|
12
|
+
client;
|
|
13
|
+
Service;
|
|
14
|
+
Characteristic;
|
|
15
|
+
api;
|
|
16
|
+
constructor(platform, accessory, deviceServices, deviceId) {
|
|
17
|
+
this.platform = platform;
|
|
18
|
+
this.accessory = accessory;
|
|
19
|
+
this.deviceServices = deviceServices;
|
|
20
|
+
this.deviceId = deviceId;
|
|
21
|
+
this.api = platform.api;
|
|
22
|
+
this.Service = this.api.hap.Service;
|
|
23
|
+
this.Characteristic = this.api.hap.Characteristic;
|
|
24
|
+
this.accessory = accessory;
|
|
25
|
+
this.deviceServices = deviceServices;
|
|
26
|
+
this.deviceId = deviceId;
|
|
27
|
+
this.client = new SmartHQClient({
|
|
28
|
+
clientId: platform.config.clientId,
|
|
29
|
+
clientSecret: platform.config.clientSecret,
|
|
30
|
+
redirectUri: platform.config.redirectUri,
|
|
31
|
+
debug: platform.config.debugLogging || false,
|
|
32
|
+
});
|
|
33
|
+
if (!this.platform.config.addDwControlLock) {
|
|
34
|
+
// If user has not enabled Control Lock switch, then don't add it
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
//====================================================================================
|
|
38
|
+
// Check to see if the device has any supported Control Lock services
|
|
39
|
+
// If not, then don't add services for device that doesn't support it
|
|
40
|
+
//====================================================================================
|
|
41
|
+
let hasControlLock = false;
|
|
42
|
+
for (const service of deviceServices) {
|
|
43
|
+
if (service.serviceDeviceType === "cloud.smarthq.device.appliance" &&
|
|
44
|
+
service.serviceType === "cloud.smarthq.service.toggle" &&
|
|
45
|
+
service.domainType === "cloud.smarthq.domain.controls.lock") {
|
|
46
|
+
hasControlLock = true;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (!hasControlLock) {
|
|
51
|
+
this.client.debug("No supported Control Lock service found for device: " +
|
|
52
|
+
this.accessory.displayName);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.client.debug("Adding Dishwasher Controls Lock Switch");
|
|
56
|
+
//=====================================================================================
|
|
57
|
+
// create a Control Lock switch for the Dishwasher
|
|
58
|
+
//=====================================================================================
|
|
59
|
+
const displayName = "Dw Control Lock";
|
|
60
|
+
const controlsLock = this.accessory.getService(displayName) ||
|
|
61
|
+
this.accessory.addService(this.Service.Switch, displayName, "dw-control-lock-123");
|
|
62
|
+
controlsLock.setCharacteristic(this.Characteristic.Name, displayName);
|
|
63
|
+
controlsLock.addOptionalCharacteristic(this.Characteristic.ConfiguredName);
|
|
64
|
+
controlsLock.setCharacteristic(this.Characteristic.ConfiguredName, displayName);
|
|
65
|
+
controlsLock
|
|
66
|
+
.getCharacteristic(this.Characteristic.On)
|
|
67
|
+
.onGet(this.getcontrolsLock.bind(this))
|
|
68
|
+
.onSet(this.setcontrolsLock.bind(this));
|
|
69
|
+
}
|
|
70
|
+
//=====================================================================================
|
|
71
|
+
async getcontrolsLock() {
|
|
72
|
+
let isOn = false;
|
|
73
|
+
for (const service of this.deviceServices) {
|
|
74
|
+
if (service.serviceDeviceType === "cloud.smarthq.device.appliance" &&
|
|
75
|
+
service.serviceType === "cloud.smarthq.service.toggle" &&
|
|
76
|
+
service.domainType === "cloud.smarthq.domain.controls.lock") {
|
|
77
|
+
try {
|
|
78
|
+
const response = await this.client.getServiceDetails(this.deviceId, service.serviceId);
|
|
79
|
+
if (response?.state?.on == null) {
|
|
80
|
+
this.client.debug("No response from getcontrolsLock command");
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
isOn = response?.state?.on === true;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
this.client.debug("Error getting Control Lock state: " + error);
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return isOn;
|
|
93
|
+
}
|
|
94
|
+
//=====================================================================================
|
|
95
|
+
async setcontrolsLock(value) {
|
|
96
|
+
const cmdBody = {
|
|
97
|
+
command: {
|
|
98
|
+
commandType: "cloud.smarthq.command.toggle.set",
|
|
99
|
+
on: value,
|
|
100
|
+
},
|
|
101
|
+
kind: "service#command",
|
|
102
|
+
deviceId: this.deviceId,
|
|
103
|
+
serviceDeviceType: "cloud.smarthq.device.appliance",
|
|
104
|
+
serviceType: "cloud.smarthq.service.toggle",
|
|
105
|
+
domainType: "cloud.smarthq.domain.controls.lock",
|
|
106
|
+
};
|
|
107
|
+
try {
|
|
108
|
+
const response = await this.client.sendCommand(cmdBody);
|
|
109
|
+
if (response == null) {
|
|
110
|
+
this.client.debug("No response from setcontrolsLock command");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
this.client.debug("Error sending setcontrolsLock command: " + error);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=controlLock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controlLock.js","sourceRoot":"","sources":["../../src/dishwasher/controlLock.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAC;AAG1D;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAOH;IACA;IACD;IACA;IATV,MAAM,CAAgB;IACd,OAAO,CAAiB;IACxB,cAAc,CAAwB;IACrC,GAAG,CAAM;IAE1B,YACmB,QAAyB,EACzB,SAA4B,EAC7B,cAA+B,EAC/B,QAAgB;QAHf,aAAQ,GAAR,QAAQ,CAAiB;QACzB,cAAS,GAAT,SAAS,CAAmB;QAC7B,mBAAc,GAAd,cAAc,CAAiB;QAC/B,aAAQ,GAAR,QAAQ,CAAQ;QAEhC,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC;QACpC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,CAAC;YAC9B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ;YAClC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY;YAC1C,WAAW,EAAE,QAA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;QAC9C,MAAM,OAAO,GAAG;YACd,OAAO,EAAE;gBACP,WAAW,EAAE,kCAAkC;gBAC/C,EAAE,EAAE,KAAK;aACV;YACD,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,iBAAiB,EAAE,gCAAgC;YACnD,WAAW,EAAE,8BAA8B;YAC3C,UAAU,EAAE,oCAAoC;SACjD,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAExD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;gBACrB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;gBAC9D,OAAO;YACT,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,GAAG,KAAK,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { CharacteristicValue, PlatformAccessory, Service, Characteristic } from "homebridge";
|
|
2
|
+
import { DeviceService } from "ge-smarthq";
|
|
3
|
+
import { SmartHqPlatform } from "../platform.js";
|
|
4
|
+
/**
|
|
5
|
+
* Platform Accessory
|
|
6
|
+
* An instance of this class is created for each accessory your platform registers
|
|
7
|
+
* Each accessory may expose multiple services of different service types
|
|
8
|
+
*/
|
|
9
|
+
export declare class Dishwasher {
|
|
10
|
+
private readonly platform;
|
|
11
|
+
private readonly accessory;
|
|
12
|
+
readonly deviceServices: DeviceService[];
|
|
13
|
+
readonly deviceId: string;
|
|
14
|
+
private readonly groupAccessory;
|
|
15
|
+
private client;
|
|
16
|
+
readonly Service: typeof Service;
|
|
17
|
+
readonly Characteristic: typeof Characteristic;
|
|
18
|
+
private readonly api;
|
|
19
|
+
private totalSeconds;
|
|
20
|
+
private timeRemainingFromWebSocket;
|
|
21
|
+
private energyMeterValuePerHour;
|
|
22
|
+
private washZoneMap;
|
|
23
|
+
private washTempMap;
|
|
24
|
+
private heatedDryMap;
|
|
25
|
+
private presetMap;
|
|
26
|
+
private currentPreset;
|
|
27
|
+
private currentWashTemp;
|
|
28
|
+
private currentWashZone;
|
|
29
|
+
private currentHeatedDry;
|
|
30
|
+
private currentbottleWash;
|
|
31
|
+
private currentSteam;
|
|
32
|
+
private currentSilverwareWash;
|
|
33
|
+
private readonly NORMAL_MODE;
|
|
34
|
+
private readonly HEAVY_MODE;
|
|
35
|
+
private readonly AUTOSENSE_MODE;
|
|
36
|
+
private readonly ONE_HOUR_MODE;
|
|
37
|
+
private readonly PLATPLUS_MODE;
|
|
38
|
+
private readonly RINSE_MODE;
|
|
39
|
+
constructor(platform: SmartHqPlatform, accessory: PlatformAccessory, deviceServices: DeviceService[], deviceId: string, groupAccessory: PlatformAccessory[]);
|
|
40
|
+
/**
|
|
41
|
+
* Handle requests to get the current value of the "Active" characteristic
|
|
42
|
+
*/
|
|
43
|
+
handleSetDurationGet(): Promise<CharacteristicValue>;
|
|
44
|
+
/**
|
|
45
|
+
* Handle requests to get the current value of the "Active" characteristic
|
|
46
|
+
*/
|
|
47
|
+
handleActiveGet(): Promise<CharacteristicValue>;
|
|
48
|
+
/**
|
|
49
|
+
* Handle requests to set the "Active" characteristic
|
|
50
|
+
*/
|
|
51
|
+
handleActiveSet(value: CharacteristicValue): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Handle requests to get the current value of the "In Use" characteristic
|
|
54
|
+
*/
|
|
55
|
+
handleInUseGet(): Promise<CharacteristicValue>;
|
|
56
|
+
/**
|
|
57
|
+
* Handle requests to get the current value of the "Name" characteristic
|
|
58
|
+
*/
|
|
59
|
+
handleNameGet(): Promise<string | false>;
|
|
60
|
+
/**
|
|
61
|
+
* Handle requests to get the current value of the "mode" value
|
|
62
|
+
*/
|
|
63
|
+
handleModeGet(v1mode: string): Promise<CharacteristicValue>;
|
|
64
|
+
/**
|
|
65
|
+
* Handle requests to get the current value of the "Valve Type" characteristic
|
|
66
|
+
*/
|
|
67
|
+
handleValveTypeGet(): Promise<number>;
|
|
68
|
+
handleRemainingTimeGet(): Promise<CharacteristicValue>;
|
|
69
|
+
getCyclePct(): Promise<CharacteristicValue>;
|
|
70
|
+
setCyclePct(value: CharacteristicValue): Promise<CharacteristicValue>;
|
|
71
|
+
setMode(): Promise<boolean | undefined>;
|
|
72
|
+
startCycle(): Promise<boolean>;
|
|
73
|
+
stopCycle(): Promise<boolean>;
|
|
74
|
+
setupService(serviceType: string, displayName: string, serviceIdSuffix: string): Service;
|
|
75
|
+
setupGroupService(serviceType: string, displayName: string, serviceIdSuffix: string, accessory: PlatformAccessory): Service;
|
|
76
|
+
getAvailableItemsByType(availableType: string): [string, string][];
|
|
77
|
+
getAvailablePresets(): [string, string][];
|
|
78
|
+
getLastElementAndCapitalize(str: string, delimiter: string): [string, string];
|
|
79
|
+
setupWebSocket(): Promise<void>;
|
|
80
|
+
logCurrentOptions(): void;
|
|
81
|
+
}
|