homebridge-philips-hue-sync-box 1.2.0-beta.2 → 1.2.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 +9 -7
- package/README.md +178 -141
- package/config.schema.json +1 -7
- package/dist/accessories/base.js +1 -1
- package/dist/accessories/base.js.map +1 -1
- package/dist/config.d.ts +0 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/lib/client.js +1 -1
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/constants.d.ts +0 -1
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +0 -6
- package/dist/lib/constants.js.map +1 -1
- package/dist/platform.d.ts +1 -0
- package/dist/platform.d.ts.map +1 -1
- package/dist/platform.js +11 -4
- package/dist/platform.js.map +1 -1
- package/package.json +3 -3
- package/src/accessories/base.ts +1 -1
- package/src/config.ts +0 -1
- package/src/lib/client.ts +1 -1
- package/src/lib/constants.ts +0 -8
- package/src/platform.ts +12 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,21 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [1.2.0
|
|
6
|
+
## [1.2.0](https://github.com/jabrown93/homebridge-philips-hue-sync-box/compare/v1.1.6...v1.2.0) (2025-01-24)
|
|
7
7
|
|
|
8
|
-
###
|
|
8
|
+
### Features
|
|
9
9
|
|
|
10
|
-
*
|
|
10
|
+
* Support multiple instances of the plugin and multiple sync boxes ([#46](https://github.com/jabrown93/homebridge-philips-hue-sync-box/issues/46)) ([949346b](https://github.com/jabrown93/homebridge-philips-hue-sync-box/commit/949346be7bbee35f268f5aa8089b3dbd9b42b567))
|
|
11
11
|
|
|
12
|
-
## [1.
|
|
12
|
+
## [1.1.6](https://github.com/jabrown93/homebridge-philips-hue-sync-box/compare/v1.1.5...v1.1.6) (2025-01-22)
|
|
13
13
|
|
|
14
|
-
###
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* only use API object provided categories and make type config case insensitive ([410730b](https://github.com/jabrown93/homebridge-philips-hue-sync-box/commit/410730b0b274ff3c39e7d9c96c578f16e943c345))
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
## [1.1.5](https://github.com/jabrown93/homebridge-philips-hue-sync-box/compare/v1.1.4...v1.1.5) (2025-01-21)
|
|
17
19
|
|
|
18
20
|
### Bug Fixes
|
|
19
21
|
|
|
20
|
-
*
|
|
22
|
+
* Removes non-functional "Base Accessory Name" config, Homebridge cannot sync this to HomeKit ([#110](https://github.com/jabrown93/homebridge-philips-hue-sync-box/issues/110)) ([25deadc](https://github.com/jabrown93/homebridge-philips-hue-sync-box/commit/25deadc5ef3f632d7e96074fc7646cd20d1ddd98))
|
|
21
23
|
|
|
22
24
|
## [1.1.4](https://github.com/jabrown93/homebridge-philips-hue-sync-box/compare/v1.1.3...v1.1.4) (2025-01-20)
|
|
23
25
|
|
package/README.md
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
</span>
|
|
12
12
|
|
|
13
13
|
[](https://www.npmjs.com/package/homebridge-philips-hue-sync-box)
|
|
14
|
+
[](https://www.npmjs.com/package/homebridge-philips-hue-sync-box)
|
|
15
|
+
[](https://www.npmjs.com/package/homebridge-philips-hue-sync-box)
|
|
14
16
|
[](https://www.npmjs.com/package/homebridge-philips-hue-sync-box)
|
|
15
17
|
[](https://github.com/jabrown93/homebridge-philips-hue-sync-box)
|
|
16
18
|
[](https://github.com/jabrown93/homebridge-philips-hue-sync-box)
|
|
@@ -19,6 +21,31 @@
|
|
|
19
21
|
[](https://app.fossa.com/projects/custom%2B50603%2Fgithub.com%2Fjabrown93%2Fhomebridge-philips-hue-sync-box?ref=badge_shield&issueType=license)
|
|
20
22
|
[](https://app.fossa.com/projects/custom%2B50603%2Fgithub.com%2Fjabrown93%2Fhomebridge-philips-hue-sync-box?ref=badge_shield&issueType=security)
|
|
21
23
|
|
|
24
|
+
## Table of Contents
|
|
25
|
+
|
|
26
|
+
- [Installation](#installation)
|
|
27
|
+
- [Plugin Installation](#plugin-installation)
|
|
28
|
+
- [Homebridge UI (Recommended)](#homebridge-ui-recommended)
|
|
29
|
+
- [Manual](#manual)
|
|
30
|
+
- [Get Sync Box Access Token](#get-sync-box-access-token)
|
|
31
|
+
- [Multiple Sync Boxes](#multiple-sync-boxes)
|
|
32
|
+
- [Configuration](#configuration)
|
|
33
|
+
- [API](#api)
|
|
34
|
+
- [GET](#get)
|
|
35
|
+
- [POST](#post)
|
|
36
|
+
- [Development](#development)
|
|
37
|
+
- [Setup Development Environment](#setup-development-environment)
|
|
38
|
+
- [Install Development Dependencies](#install-development-dependencies)
|
|
39
|
+
- [Build Plugin](#build-plugin)
|
|
40
|
+
- [Link To Homebridge](#link-to-homebridge)
|
|
41
|
+
- [Watch For Changes and Build Automatically](#watch-for-changes-and-build-automatically)
|
|
42
|
+
- [Help! I'm Having Issues!](#help-im-having-issues)
|
|
43
|
+
- [I Have an Idea for a New Feature!](#i-have-an-idea-for-a-new-feature)
|
|
44
|
+
- [I Want to Contribute!](#i-want-to-contribute)
|
|
45
|
+
- [Code of Conduct](#code-of-conduct)
|
|
46
|
+
- [License](#license)
|
|
47
|
+
- [Credit](#credit)
|
|
48
|
+
|
|
22
49
|
Homebridge plugin for the Philips Hue Sync Box.
|
|
23
50
|
|
|
24
51
|
The Sync Box can be exposed as a lightbulb. The following features are supported:
|
|
@@ -55,13 +82,24 @@ same pin as for the plugin).
|
|
|
55
82
|
|
|
56
83
|
## Installation
|
|
57
84
|
|
|
58
|
-
|
|
85
|
+
### Plugin Installation
|
|
59
86
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
87
|
+
#### Homebridge UI (Recommended)
|
|
88
|
+
|
|
89
|
+
1. Open
|
|
90
|
+
the [Homebridge UI](https://github.com/homebridge/homebridge/wiki/Install-Homebridge-on-macOS#complete-login-to-the-homebridge-ui).
|
|
91
|
+
2. Open the Plugins tab, search for `homebridge-philips-hue-sync-box`, and install the plugin.
|
|
92
|
+
3. Get the Sync Box access token as described [below](#get-sync-box-access-token).
|
|
93
|
+
4. Configure the plugin via the Homebridge Config UI
|
|
94
|
+
|
|
95
|
+
#### Manual
|
|
96
|
+
|
|
97
|
+
1. Install the plugin using `hb-service add homebridge-philips-hue-sync-box` or
|
|
98
|
+
`npm i -g homebridge-philips-hue-sync-box` if you are not using hb-service
|
|
99
|
+
2. Get the Sync Box access token as described [below](#get-sync-box-access-token).
|
|
100
|
+
3. Configure the plugin in Homebridge's config.json file, see [Configuration](#configuration) for the details.
|
|
63
101
|
|
|
64
|
-
|
|
102
|
+
### Get Sync Box Access Token
|
|
65
103
|
|
|
66
104
|
You have to create new credentials to communicate with the Philips Hue Sync Box:
|
|
67
105
|
|
|
@@ -79,9 +117,8 @@ You have to create new credentials to communicate with the Philips Hue Sync Box:
|
|
|
79
117
|
Hints:
|
|
80
118
|
|
|
81
119
|
- One way to do this is to enter the following into the Terminal:
|
|
82
|
-
`curl -H "Content-Type: application/json" -X POST -d '{"appName": "homebridge", "appSecret":"MDAwMTExMDAwMTExMDAwMTExMDAwMTExMDAwMTExMDA=", "instanceName": "homebridge"}' https://<SYNC-BOX-IP>/api/v1/registrations`,
|
|
83
|
-
replacing `<SYNC-BOX-IP>` with the IP address of your Sync Box.
|
|
84
|
-
parameter `-k` to the cURL command.
|
|
120
|
+
`curl -H -k "Content-Type: application/json" -X POST -d '{"appName": "homebridge", "appSecret":"MDAwMTExMDAwMTExMDAwMTExMDAwMTExMDAwMTExMDA=", "instanceName": "homebridge"}' https://<SYNC-BOX-IP>/api/v1/registrations`,
|
|
121
|
+
replacing `<SYNC-BOX-IP>` with the IP address of your Sync Box.
|
|
85
122
|
- Another way may be to use tools like **Postman**. Set the request method to `POST` and enter
|
|
86
123
|
`https://<SYNC-BOX-IP>/api/v1/registrations` as the request URL (replace `<SYNC-BOX-IP>` with the IP address of your
|
|
87
124
|
Sync Box). Next, open the tab "Body", set the type to "raw" and select "JSON" as the content type in the dropdown.
|
|
@@ -91,24 +128,25 @@ Hints:
|
|
|
91
128
|
due to a certificate error, you can disable certificate verification in Postman. Go to the global settings, open the
|
|
92
129
|
tab "General" and disable the toggle switch for "SSL certificate verification".
|
|
93
130
|
|
|
94
|
-
|
|
131
|
+
### Multiple Sync Boxes
|
|
95
132
|
|
|
96
|
-
**WARNING: If you currently have a sync box setup, setting a `uuidSeed` will
|
|
97
|
-
on at most 1 Sync Box.**
|
|
133
|
+
**WARNING: If you currently have a sync box setup, setting a `uuidSeed` will remove all of the accessories and create
|
|
134
|
+
new ones. You may leave this config blank on at most 1 Sync Box.**
|
|
98
135
|
|
|
99
|
-
In order to support multiple Sync Boxes, you have to run multiple instances of this plugin. Each instance
|
|
136
|
+
In order to support multiple Sync Boxes, you have to run multiple instances of this plugin. Each instance must have a
|
|
100
137
|
unique `uuidSeed` value. This value is used to differentiate the accessories in HomeKit. If you have existing
|
|
101
138
|
accessories, changing this value will cause them to be removed and re-created. HomeKit will consider these as new
|
|
102
139
|
accessories and you will need to setup them up again.
|
|
103
140
|
|
|
104
141
|
You will need to add multiple platforms to your `config.json` file. This can be found at
|
|
105
|
-
`https://<homebridge_host>/config` in the UI or `<homebridge_config_dir>/config.json`. Each platform
|
|
142
|
+
`https://<homebridge_host>/config` in the UI or `<homebridge_config_dir>/config.json`. Each platform must have a
|
|
106
143
|
a `platform` value of `PhilipsHueSyncBoxPlatform`.
|
|
107
144
|
|
|
108
145
|
**Important Notes**
|
|
109
146
|
|
|
110
|
-
- The `uuidSeed` value must be unique for each Sync Box. `
|
|
111
|
-
- Changing the `uuidSeed` value will cause the accessories to be removed and re-created. HomeKit will consider these as
|
|
147
|
+
- The `uuidSeed` value must be unique for each Sync Box. `""` is a valid value for at most one Sync Box.
|
|
148
|
+
- Changing the `uuidSeed` value will cause the accessories to be removed and re-created. HomeKit will consider these as
|
|
149
|
+
new accessories and you will need to setup them up again and remove the unresponsive ones.
|
|
112
150
|
- The `name` value should be unique for each Sync Box, this improves the logging output.
|
|
113
151
|
|
|
114
152
|
```json5
|
|
@@ -118,16 +156,16 @@ a `platform` value of `PhilipsHueSyncBoxPlatform`.
|
|
|
118
156
|
{
|
|
119
157
|
platform: 'PhilipsHueSyncBoxPlatform',
|
|
120
158
|
name: 'LivingRoomPhilipsHueSyncBoxPlatform',
|
|
121
|
-
syncBoxIpAddress: '<SYNC-BOX-IP-ADDRESS>',
|
|
122
|
-
syncBoxApiAccessToken: '<ACCESS-TOKEN>',
|
|
159
|
+
syncBoxIpAddress: '<SYNC-BOX-1-IP-ADDRESS>',
|
|
160
|
+
syncBoxApiAccessToken: '<SYNC-BOX-1-ACCESS-TOKEN>',
|
|
123
161
|
uuidSeed: 'LivingRoom',
|
|
124
162
|
// rest of config
|
|
125
163
|
},
|
|
126
164
|
{
|
|
127
165
|
platform: 'PhilipsHueSyncBoxPlatform',
|
|
128
166
|
name: 'BedroomPhilipsHueSyncBoxPlatform',
|
|
129
|
-
syncBoxIpAddress: '<SYNC-BOX-IP-ADDRESS>',
|
|
130
|
-
syncBoxApiAccessToken: '<ACCESS-TOKEN>',
|
|
167
|
+
syncBoxIpAddress: '<SYNC-BOX-2-IP-ADDRESS>',
|
|
168
|
+
syncBoxApiAccessToken: '<SYNC-BOX-2-ACCESS-TOKEN>',
|
|
131
169
|
uuidSeed: 'Bedroom',
|
|
132
170
|
// rest of config
|
|
133
171
|
},
|
|
@@ -139,33 +177,32 @@ a `platform` value of `PhilipsHueSyncBoxPlatform`.
|
|
|
139
177
|
|
|
140
178
|
| **Name** | **Description** | **Type** | **Default** | **Required** | **Allowed Values** |
|
|
141
179
|
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------------- | ------------ | --------------------------------------------- |
|
|
142
|
-
| `syncBoxIpAddress` | The IP address of your Philips Hue Sync Box. | string |
|
|
143
|
-
| `syncBoxApiAccessToken` | The access token that you get while registration. | string |
|
|
180
|
+
| `syncBoxIpAddress` | The IP address of your Philips Hue Sync Box. | string | | Yes | |
|
|
181
|
+
| `syncBoxApiAccessToken` | The access token that you get while registration. | string | | Yes | |
|
|
144
182
|
| `defaultOnMode` | The mode that is used when switching the Sync Box on via HomeKit. Possible values are `video`, `music`, `game` or `lastSyncMode`. | string | `video` | No | `video`, `music`, `game`, `lastSyncMode` |
|
|
145
183
|
| `defaultOffMode` | The mode that is used when switching the Sync Box off via HomeKit. Possible values are `powersave` or `passthrough`. | string | `passthrough` | No | `powersave`, `passthrough` |
|
|
146
184
|
| `baseAccessory` | Determines the type of the base accessory for the Sync Box. Possible values are `lightbulb`, `switch` or `none`. If `none` is used, no base accessory is exposed. | string | `lightbulb` | No | `lightbulb`, `switch`, `none` |
|
|
147
|
-
| `baseAccessoryName` | Sets custom name for the Base Accessory. Overwrites names configured HomeKit. | string | None | No | |
|
|
148
185
|
| `tvAccessory` | Enables a TV Accessory for switching the inputs of the Sync Box. | boolean | `false` | No | |
|
|
149
|
-
| `tvAccessoryConfiguredName` | Sets custom name for the HDMI Input TV. Overwrites names configured HomeKit. | string |
|
|
186
|
+
| `tvAccessoryConfiguredName` | Sets custom name for the HDMI Input TV. Overwrites names configured HomeKit. | string | | No | |
|
|
150
187
|
| `tvAccessoryType` | Type of icon that the Apple Home app should show. Possible values are `tv`, `settopbox`, `tvstick` or `audioreceiver`. | string | `tv` | No | `tv`, `settopbox`, `tvstick`, `audioreceiver` |
|
|
151
188
|
| `tvAccessoryLightbulb` | Enables an integrated lightbulb for the TV Accessory for switching the inputs. | boolean | `false` | No | |
|
|
152
189
|
| `modeTvAccessory` | Enables a TV Accessory for switching the modes (`video`, `music`, `game`) of the Sync Box. | boolean | `false` | No | |
|
|
153
|
-
| `modeTvAccessoryConfiguredName` | Sets custom name for the Mode TV. Overwrites names configured HomeKit. | string |
|
|
190
|
+
| `modeTvAccessoryConfiguredName` | Sets custom name for the Mode TV. Overwrites names configured HomeKit. | string | | No | |
|
|
154
191
|
| `modeTvAccessoryType` | Type of icon that the Apple Home app should show. Possible values are `tv`, `settopbox`, `tvstick` or `audioreceiver`. | string | `tv` | No | `tv`, `settopbox`, `tvstick`, `audioreceiver` |
|
|
155
192
|
| `modeTvAccessoryLightbulb` | Enables an integrated lightbulb for the TV Accessory for switching the modes. | boolean | `false` | No | |
|
|
156
193
|
| `intensityTvAccessory` | Enables a TV Accessory for switching the intensity (`subtle`, `moderate`, `high`, `intense`) of the Sync Box. | boolean | `false` | No | |
|
|
157
|
-
| `intensityTvAccessoryConfiguredName` | Sets custom name for the Intensity TV. Overwrites names configured HomeKit. | string |
|
|
194
|
+
| `intensityTvAccessoryConfiguredName` | Sets custom name for the Intensity TV. Overwrites names configured HomeKit. | string | | No | |
|
|
158
195
|
| `intensityTvAccessoryType` | Type of icon that the Apple Home app should show. Possible values are `tv`, `settopbox`, `tvstick` or `audioreceiver`. | string | `tv` | No | `tv`, `settopbox`, `tvstick`, `audioreceiver` |
|
|
159
196
|
| `intensityTvAccessoryLightbulb` | Enables an integrated lightbulb for the TV Accessory for switching the intensity. | boolean | `false` | No | |
|
|
160
197
|
| `entertainmentTvAccessory` | Enables a TV Accessory for switching the entertainment area of the Sync Box. | boolean | `false` | No | |
|
|
161
|
-
| `entertainmentTvAccessoryConfiguredName` | Sets custom name for the Entertainment TV. Overwrites names configured HomeKit. | string |
|
|
198
|
+
| `entertainmentTvAccessoryConfiguredName` | Sets custom name for the Entertainment TV. Overwrites names configured HomeKit. | string | | No | |
|
|
162
199
|
| `entertainmentTvAccessoryType` | Type of icon that the Apple Home app should show. Possible values are `tv`, `settopbox`, `tvstick` or `audioreceiver`. | string | `tv` | No | `tv`, `settopbox`, `tvstick`, `audioreceiver` |
|
|
163
200
|
| `entertainmentTvAccessoryLightbulb` | Enables an integrated lightbulb for the TV Accessory for switching the entertainment areas. | boolean | `false` | No | |
|
|
164
201
|
| `updateIntervalInSeconds` | The interval in seconds in which the plugin polls the Sync Box for updates. | integer | `5` | No | |
|
|
165
|
-
| `uuidSeed` | Only set this if you're running multiple instances of this plugin to differentiate the accessories. If you have existing accessories, changing this will cause them to be removed and re-created. HomeKit will consider these as new accessories and you will need to setup them up again. | string |
|
|
202
|
+
| `uuidSeed` | Only set this if you're running multiple instances of this plugin to differentiate the accessories. If you have existing accessories, changing this will cause them to be removed and re-created. HomeKit will consider these as new accessories and you will need to setup them up again. | string | | No | |
|
|
166
203
|
| `apiServerEnabled` | Enables an HTTP API for controlling the Sync Box. | boolean | `false` | No | |
|
|
167
204
|
| `apiServerPort` | The port that the API (if enabled) runs on. Defaults to `40220`, please change this setting if the port is already in use. | integer | `40220` | No | |
|
|
168
|
-
| `apiServerToken` | The token that has to be included in each request of the API. Is required if the API is enabled and has no default value. | string |
|
|
205
|
+
| `apiServerToken` | The token that has to be included in each request of the API. Is required if the API is enabled and has no default value. | string | | No | |
|
|
169
206
|
|
|
170
207
|
```json
|
|
171
208
|
{
|
|
@@ -178,17 +215,26 @@ a `platform` value of `PhilipsHueSyncBoxPlatform`.
|
|
|
178
215
|
"defaultOffMode": "passthrough",
|
|
179
216
|
"baseAccessory": "lightbulb",
|
|
180
217
|
"tvAccessory": false,
|
|
218
|
+
"tvAccessoryConfiguredName": "Sync Box Input",
|
|
181
219
|
"tvAccessoryType": "tv",
|
|
182
220
|
"tvAccessoryLightbulb": false,
|
|
183
221
|
"modeTvAccessory": false,
|
|
222
|
+
"modeTvAccessoryConfiguredName": "Sync Box Mode",
|
|
184
223
|
"modeTvAccessoryType": "tv",
|
|
185
224
|
"modeTvAccessoryLightbulb": false,
|
|
186
225
|
"intensityTvAccessory": false,
|
|
226
|
+
"intensityTvAccessoryConfiguredName": "Sync Box Intensity",
|
|
187
227
|
"intensityTvAccessoryType": "tv",
|
|
188
228
|
"intensityTvAccessoryLightbulb": false,
|
|
189
229
|
"entertainmentTvAccessory": false,
|
|
230
|
+
"entertainmentTvAccessoryConfiguredName": "Sync Box Area",
|
|
190
231
|
"entertainmentTvAccessoryType": "tv",
|
|
191
|
-
"entertainmentTvAccessoryLightbulb": false
|
|
232
|
+
"entertainmentTvAccessoryLightbulb": false,
|
|
233
|
+
"updateIntervalInSeconds": 5,
|
|
234
|
+
"uuidSeed": "livingroom",
|
|
235
|
+
"apiServerEnabled": false,
|
|
236
|
+
"apiServerPort": 40220,
|
|
237
|
+
"apiServerToken": "token"
|
|
192
238
|
}
|
|
193
239
|
]
|
|
194
240
|
}
|
|
@@ -213,7 +259,7 @@ The token has to be specified as value of the `Authorization` header on each req
|
|
|
213
259
|
Authorization: <YOUR-TOKEN>
|
|
214
260
|
```
|
|
215
261
|
|
|
216
|
-
###
|
|
262
|
+
### GET
|
|
217
263
|
|
|
218
264
|
Use the `state` endpoint to retrieve the state of the Sync Box. The HTTP method has to be `GET`:
|
|
219
265
|
|
|
@@ -221,43 +267,10 @@ Use the `state` endpoint to retrieve the state of the Sync Box. The HTTP method
|
|
|
221
267
|
http://<YOUR-HOST-IP-ADDRESS>:<apiPort>/state
|
|
222
268
|
```
|
|
223
269
|
|
|
224
|
-
The response is a JSON
|
|
270
|
+
The response is a JSON object, looking like this:
|
|
225
271
|
|
|
226
272
|
```
|
|
227
273
|
{
|
|
228
|
-
"device": {
|
|
229
|
-
"name": "Living Room Sync Box",
|
|
230
|
-
"deviceType": "HSB2",
|
|
231
|
-
"uniqueId": "ID2",
|
|
232
|
-
"apiLevel": 10,
|
|
233
|
-
"firmwareVersion": "2.4.1",
|
|
234
|
-
"buildNumber": 784734914,
|
|
235
|
-
"termsAgreed": true,
|
|
236
|
-
"wifiState": "wan",
|
|
237
|
-
"ipAddress": "192.168.1.3",
|
|
238
|
-
"wifi": {
|
|
239
|
-
"ssid": "Guest Network",
|
|
240
|
-
"strength": 4
|
|
241
|
-
},
|
|
242
|
-
"lastCheckedUpdate": "2025-01-07T10:04:23Z",
|
|
243
|
-
"updatableBuildNumber": null,
|
|
244
|
-
"updatableFirmwareVersion": null,
|
|
245
|
-
"update": {
|
|
246
|
-
"autoUpdateEnabled": true,
|
|
247
|
-
"autoUpdateTime": 10
|
|
248
|
-
},
|
|
249
|
-
"ledMode": 1,
|
|
250
|
-
"action": "none",
|
|
251
|
-
"pushlink": "idle",
|
|
252
|
-
"capabilities": {
|
|
253
|
-
"maxIrCodes": 24,
|
|
254
|
-
"maxPresets": 16
|
|
255
|
-
},
|
|
256
|
-
"beta": false,
|
|
257
|
-
"overheating": false,
|
|
258
|
-
"undervolt": false,
|
|
259
|
-
"bluetooth": false
|
|
260
|
-
},
|
|
261
274
|
"hue": {
|
|
262
275
|
"bridgeUniqueId": "ID1",
|
|
263
276
|
"bridgeIpAddress": "192.168.1.2",
|
|
@@ -298,86 +311,11 @@ The response is a JSON response, the following properties are included:
|
|
|
298
311
|
"palette": "melancholicEnergetic"
|
|
299
312
|
},
|
|
300
313
|
"preset": null
|
|
301
|
-
}
|
|
302
|
-
"hdmi": {
|
|
303
|
-
"input1": {
|
|
304
|
-
"name": "HDMI 1",
|
|
305
|
-
"type": "generic",
|
|
306
|
-
"status": "unplugged",
|
|
307
|
-
"lastSyncMode": "video"
|
|
308
|
-
},
|
|
309
|
-
"input2": {
|
|
310
|
-
"name": "HDMI 2",
|
|
311
|
-
"type": "generic",
|
|
312
|
-
"status": "unplugged",
|
|
313
|
-
"lastSyncMode": "video"
|
|
314
|
-
},
|
|
315
|
-
"input3": {
|
|
316
|
-
"name": "HDMI 3",
|
|
317
|
-
"type": "generic",
|
|
318
|
-
"status": "unplugged",
|
|
319
|
-
"lastSyncMode": "video"
|
|
320
|
-
},
|
|
321
|
-
"input4": {
|
|
322
|
-
"name": "AVR",
|
|
323
|
-
"type": "avreceiver",
|
|
324
|
-
"status": "linked",
|
|
325
|
-
"lastSyncMode": "video"
|
|
326
|
-
},
|
|
327
|
-
"output": {
|
|
328
|
-
"name": "HDMI Out",
|
|
329
|
-
"type": "generic",
|
|
330
|
-
"status": "linked",
|
|
331
|
-
"lastSyncMode": "video"
|
|
332
|
-
},
|
|
333
|
-
"contentSpecs": "3840 x 2160 @ 60000 - SDR",
|
|
334
|
-
"videoSyncSupported": true,
|
|
335
|
-
"audioSyncSupported": true
|
|
336
|
-
},
|
|
337
|
-
"behavior": {
|
|
338
|
-
"inactivePowersave": 20,
|
|
339
|
-
"cecPowersave": 1,
|
|
340
|
-
"usbPowersave": 1,
|
|
341
|
-
"hpdInputSwitch": 1,
|
|
342
|
-
"hpdOutputEnableMs": 1500,
|
|
343
|
-
"arcBypassMode": 1,
|
|
344
|
-
"input1": {
|
|
345
|
-
"cecInputSwitch": 1,
|
|
346
|
-
"hpdInputPortSwitch": 1,
|
|
347
|
-
"linkAutoSync": 0
|
|
348
|
-
},
|
|
349
|
-
"input2": {
|
|
350
|
-
"cecInputSwitch": 1,
|
|
351
|
-
"hpdInputPortSwitch": 1,
|
|
352
|
-
"linkAutoSync": 0
|
|
353
|
-
},
|
|
354
|
-
"input3": {
|
|
355
|
-
"cecInputSwitch": 1,
|
|
356
|
-
"hpdInputPortSwitch": 1,
|
|
357
|
-
"linkAutoSync": 0
|
|
358
|
-
},
|
|
359
|
-
"input4": {
|
|
360
|
-
"cecInputSwitch": 1,
|
|
361
|
-
"hpdInputPortSwitch": 1,
|
|
362
|
-
"linkAutoSync": 0
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
"ir": {
|
|
366
|
-
"defaultCodes": true,
|
|
367
|
-
"scan": {
|
|
368
|
-
"scanning": false,
|
|
369
|
-
"code": null,
|
|
370
|
-
"codes": []
|
|
371
|
-
},
|
|
372
|
-
"codes": {}
|
|
373
|
-
},
|
|
374
|
-
"registrations": {
|
|
375
|
-
},
|
|
376
|
-
"presets": {}
|
|
314
|
+
}
|
|
377
315
|
}
|
|
378
316
|
```
|
|
379
317
|
|
|
380
|
-
###
|
|
318
|
+
### POST
|
|
381
319
|
|
|
382
320
|
Use the `state` endpoint to set state of the Sync Box. The HTTP method has to be `POST`:
|
|
383
321
|
|
|
@@ -432,3 +370,102 @@ The body of the request has to be JSON and can contain any/some/all of the follo
|
|
|
432
370
|
}
|
|
433
371
|
}
|
|
434
372
|
```
|
|
373
|
+
|
|
374
|
+
## Development
|
|
375
|
+
|
|
376
|
+
### Setup Development Environment
|
|
377
|
+
|
|
378
|
+
To develop Homebridge Philips Hue Sync Bridge you must have Node.js 18 or later installed, and a modern code editor such
|
|
379
|
+
as [VS Code](https://code.visualstudio.com/). This plugin uses [TypeScript](https://www.typescriptlang.org/) to
|
|
380
|
+
make development easier and comes with pre-configured settings for Prettier and ESLint. If you are using VS Code install
|
|
381
|
+
these extensions:
|
|
382
|
+
|
|
383
|
+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
|
384
|
+
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
|
385
|
+
|
|
386
|
+
### Install Development Dependencies
|
|
387
|
+
|
|
388
|
+
Using a terminal, navigate to the project folder and run this command to install the development dependencies:
|
|
389
|
+
|
|
390
|
+
```sh
|
|
391
|
+
|
|
392
|
+
npm install
|
|
393
|
+
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
### Build Plugin
|
|
397
|
+
|
|
398
|
+
TypeScript needs to be compiled into JavaScript before it can run. The following command will compile the contents of
|
|
399
|
+
your [`src`](./src) directory and put the resulting code into the `dist` folder.
|
|
400
|
+
|
|
401
|
+
```sh
|
|
402
|
+
|
|
403
|
+
npm run build
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Link To Homebridge
|
|
408
|
+
|
|
409
|
+
Run this command so your global install of Homebridge can discover the plugin in your development environment:
|
|
410
|
+
|
|
411
|
+
```sh
|
|
412
|
+
|
|
413
|
+
npm link
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
You can now start Homebridge, use the `-D` flag so you can see debug log messages in your plugin:
|
|
418
|
+
|
|
419
|
+
```sh
|
|
420
|
+
|
|
421
|
+
homebridge -D
|
|
422
|
+
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Watch For Changes and Build Automatically
|
|
426
|
+
|
|
427
|
+
If you want to have your code compile automatically as you make changes, and restart Homebridge automatically between
|
|
428
|
+
changes you can run:
|
|
429
|
+
|
|
430
|
+
```sh
|
|
431
|
+
|
|
432
|
+
npm run watch
|
|
433
|
+
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
This will launch an instance of Homebridge in debug mode which will restart every time you make a change to the source
|
|
437
|
+
code. It will load the config stored in the default location under `~/.homebridge`. You may need to stop other running
|
|
438
|
+
instances of Homebridge while using this command to prevent conflicts. You can adjust the Homebridge startup command in
|
|
439
|
+
the [`nodemon.json`](./nodemon.json) file.
|
|
440
|
+
|
|
441
|
+
## Help! I'm Having Issues!
|
|
442
|
+
|
|
443
|
+
If you are having issues with this plugin, please check the following:
|
|
444
|
+
|
|
445
|
+
- [Homebridge Basic Troubleshooting](https://github.com/homebridge/homebridge/wiki/Basic-Troubleshooting)
|
|
446
|
+
|
|
447
|
+
If you're still having issues, let us know by opening
|
|
448
|
+
an [issue](https://github.com/jabrown93/homebridge-philips-hue-sync-box/issues/new/choose) on GitHub. Please fill out
|
|
449
|
+
the template with as much information as possible to help us help you.
|
|
450
|
+
|
|
451
|
+
## I Have an Idea for a New Feature!
|
|
452
|
+
|
|
453
|
+
If you have a feature request, please checkout our [Contribution](./CONTRIBUTING.md) guide and open
|
|
454
|
+
a [feature request issue](https://github.com/jabrown93/homebridge-philips-hue-sync-box/issues/new?template=feature-request.md)
|
|
455
|
+
|
|
456
|
+
## I Want to Contribute!
|
|
457
|
+
|
|
458
|
+
If you want to contribute to this project, please checkout our [Contribution](./CONTRIBUTING.md) guide. We welcome
|
|
459
|
+
contributions of all kinds!
|
|
460
|
+
|
|
461
|
+
## Code of Conduct
|
|
462
|
+
|
|
463
|
+
Please checkout our [Code of Conduct](./CODE_OF_CONDUCT.md) for more information.
|
|
464
|
+
|
|
465
|
+
## License
|
|
466
|
+
|
|
467
|
+
This project is licensed under the terms of the [MIT License](./LICENSE).
|
|
468
|
+
|
|
469
|
+
## Credit
|
|
470
|
+
|
|
471
|
+
This plugin was originally developed by [Lukas Rögner](https://github.com/lukasroegner)
|
package/config.schema.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"pluginAlias": "PhilipsHueSyncBoxPlatform",
|
|
3
3
|
"pluginType": "platform",
|
|
4
4
|
"headerDisplay": "Homebridge plugin for the Philips Hue Sync Box. Important: TV accessories must be added to HomeKit manually, the logs show the pin for adding them (should be the same pin as for the plugin).",
|
|
5
|
-
"footerDisplay": "For help please visit the [GitHub repository](https://github.com/
|
|
5
|
+
"footerDisplay": "For help please visit the [GitHub repository](https://github.com/jabrown93/homebridge-philips-hue-sync-box).",
|
|
6
6
|
"schema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"properties": {
|
|
@@ -81,12 +81,6 @@
|
|
|
81
81
|
}
|
|
82
82
|
]
|
|
83
83
|
},
|
|
84
|
-
"baseAccessoryName": {
|
|
85
|
-
"title": "Set name for Base Accessory",
|
|
86
|
-
"type": "string",
|
|
87
|
-
"required": false,
|
|
88
|
-
"description": "Sets custom name for the Base Accessory. Overwrites names configured HomeKit."
|
|
89
|
-
},
|
|
90
84
|
"tvAccessory": {
|
|
91
85
|
"title": "Enable HDMI TV",
|
|
92
86
|
"type": "boolean",
|
package/dist/accessories/base.js
CHANGED
|
@@ -14,7 +14,7 @@ export class SyncBoxDevice {
|
|
|
14
14
|
this.service =
|
|
15
15
|
existingService ||
|
|
16
16
|
this.accessory.addService(this.getServiceType(), this.getServiceName(), this.getServiceSubType());
|
|
17
|
-
this.service.setCharacteristic(this.platform.api.hap.Characteristic.Name,
|
|
17
|
+
this.service.setCharacteristic(this.platform.api.hap.Characteristic.Name, accessory.displayName);
|
|
18
18
|
this.service
|
|
19
19
|
.getCharacteristic(this.getPowerCharacteristic())
|
|
20
20
|
.onSet(this.handlePowerCharacteristicSet.bind(this)); // SET - bind to the `setOn` method below
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/accessories/base.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,OAAgB,aAAa;IACd,QAAQ,CAAqB;IAChC,SAAS,CAAoB;IACnC,KAAK,CAAQ;IACb,OAAO,CAAU;IAE3B,YACE,QAA4B,EAC5B,SAA4B,EAC5B,KAAY;QAEZ,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,MAAM,eAAe,GACnB,IAAI,CAAC,iBAAiB,EAAE,KAAK,SAAS;YACpC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YAClD,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAC3B,IAAI,CAAC,cAAc,EAAE,EACrB,IAAI,CAAC,iBAAiB,EAAY,CACnC,CAAC;QAER,IAAI,CAAC,OAAO;YACV,eAAe;gBACf,IAAI,CAAC,SAAS,CAAC,UAAU,CACvB,IAAI,CAAC,cAAc,EAAE,EACrB,IAAI,CAAC,cAAc,EAAE,EACrB,IAAI,CAAC,iBAAiB,EAAE,CACzB,CAAC;QAEJ,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EACzC,
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/accessories/base.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE9D,MAAM,OAAgB,aAAa;IACd,QAAQ,CAAqB;IAChC,SAAS,CAAoB;IACnC,KAAK,CAAQ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C;IACJ,CAAC;IAES,SAAS;QACjB,OAAO,EAAE,CAAC;IACZ,CAAC;IAES,sBAAsB;QAC9B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC;IACrD,CAAC;IAES,4BAA4B,CAAC,KAA0B;QAC/D,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CACrB,MAAM,GAAG,IAAI,CAAC,sBAAsB,EAAE,GAAG,KAAK,EAC9C,KAAK,CACN,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAC/C,IAAI,CAAC,sBAAsB,EAAE,CAC9B,CAAC,KAAK,CAAC;QACR,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CACrB,mBAAmB,GAAG,IAAI,CAAC,sBAAsB,EAAE,GAAG,IAAI,GAAG,UAAU,CACxE,CAAC;QACF,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
package/dist/config.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export interface HueSyncBoxPlatformConfig extends PlatformConfig {
|
|
|
8
8
|
defaultOnMode: OnMode;
|
|
9
9
|
defaultOffMode: OffMode;
|
|
10
10
|
baseAccessory: 'lightbulb' | 'switch' | 'none';
|
|
11
|
-
baseAccessoryName: string;
|
|
12
11
|
tvAccessory: boolean;
|
|
13
12
|
tvAccessoryConfiguredName: string;
|
|
14
13
|
tvAccessoryType: TvAccessoryType;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,WAAW,GAAG,SAAS,GAAG,eAAe,CAAC;AAC/E,MAAM,MAAM,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AAwB,EAAE,eAAe,CAAC;IAC1C,6BAA6B,EAAE,OAAO,CAAC;IACvC,wBAAwB,EAAE,OAAO,CAAC;IAClC,sCAAsC,EAAE,MAAM,CAAC;IAC/C,4BAA4B,EAAE,eAAe,CAAC;IAC9C,iCAAiC,EAAE,OAAO,CAAC;IAC3C,uBAAuB,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;CAC3B"}
|
package/dist/lib/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import AsyncLock from 'async-lock';
|
|
|
5
5
|
const fetch = fetch_retry(originalFetch, {
|
|
6
6
|
retries: 3,
|
|
7
7
|
retryDelay: attempt => {
|
|
8
|
-
return Math.pow(2, attempt) *
|
|
8
|
+
return Math.pow(2, attempt) * 1000; // 1000, 2000, 4000
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
11
|
export class SyncBoxClient {
|
package/dist/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAGpC,OAAO,SAA+B,MAAM,YAAY,CAAC;AAEzD,MAAM,KAAK,GAAG,WAAW,CAAC,aAAa,EAAE;IACvC,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,OAAO,CAAC,EAAE;QACpB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,YAAY,CAAC;AACvC,OAAO,WAAW,MAAM,a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AC,GAAG,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,IAAI,CAAC,GAAG,CAAC,KAAK,CACZ,UAAU,GAAG,CAAC,MAAM,MAAM,GAAG,CAAC,UAAU,KAAK,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE,CAChF,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC,MAAM,MAAM,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,MAAM,KAAK,KAAK,CAAC,CAAC,CAAE,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAO,CAAC,CAAC,CAAE,IAAU,CAAC;IACpE,CAAC;CACF"}
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -8,5 +8,4 @@ export declare const TV_ACCESSORY: string;
|
|
|
8
8
|
export declare const MODE_TV_ACCESSORY: string;
|
|
9
9
|
export declare const INTENSITY_TV_ACCESSORY: string;
|
|
10
10
|
export declare const ENTERTAINMENT_TV_ACCESSORY: string;
|
|
11
|
-
export declare const TV_ACCESSORY_TYPES_TO_CATEGORY: Record<string, number>;
|
|
12
11
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,EAAE,MAAsB,CAAC;AACjD,eAAO,MAAM,UAAU,EAAE,MAAoB,CAAC;AAC9C,eAAO,MAAM,SAAS,cAAc,CAAC;AACrC,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,eAAO,MAAM,mBAAmB,EAAE,MAA6B,CAAC;AAChE,eAAO,MAAM,gBAAgB,EAAE,MAA0B,CAAC;AAC1D,eAAO,MAAM,YAAY,EAAE,MAAsB,CAAC;AAClD,eAAO,MAAM,iBAAiB,EAAE,MAA0B,CAAC;AAC3D,eAAO,MAAM,sBAAsB,EAAE,MAA+B,CAAC;AACrE,eAAO,MAAM,0BAA0B,EAAE,MAAmC,CAAC"}
|
package/dist/lib/constants.js
CHANGED
|
@@ -8,10 +8,4 @@ export const TV_ACCESSORY = 'TVAccessory';
|
|
|
8
8
|
export const MODE_TV_ACCESSORY = 'ModeTVAccessory';
|
|
9
9
|
export const INTENSITY_TV_ACCESSORY = 'IntensityTVAccessory';
|
|
10
10
|
export const ENTERTAINMENT_TV_ACCESSORY = 'EntertainmentTVAccessory';
|
|
11
|
-
export const TV_ACCESSORY_TYPES_TO_CATEGORY = {
|
|
12
|
-
settopbox: 35 /* Categories.TV_SET_TOP_BOX */,
|
|
13
|
-
tvstick: 36 /* Categories.TV_STREAMING_STICK */,
|
|
14
|
-
audioreceiver: 34 /* Categories.AUDIO_RECEIVER */,
|
|
15
|
-
tv: 31 /* Categories.TELEVISION */,
|
|
16
|
-
};
|
|
17
11
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAW,aAAa,CAAC;AACjD,MAAM,CAAC,MAAM,UAAU,GAAW,WAAW,CAAC;AAC9C,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;AACrC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAQ,CAAC;AAC/B,MAAM,CAAC,MAAM,mBAAmB,GAAW,oBAAoB,CAAC;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAW,iBAAiB,CAAC;AAC1D,MAAM,CAAC,MAAM,YAAY,GAAW,aAAa,CAAC;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAW,iBAAiB,CAAC;AAC3D,MAAM,CAAC,MAAM,sBAAsB,GAAW,sBAAsB,CAAC;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAW,0BAA0B,CAAC"}
|
package/dist/platform.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export declare class HueSyncBoxPlatform implements DynamicPlatformPlugin {
|
|
|
15
15
|
private readonly existingAccessories;
|
|
16
16
|
private readonly externalAccessories;
|
|
17
17
|
private mainAccessory?;
|
|
18
|
+
private readonly TV_ACCESSORY_TYPES_TO_CATEGORY;
|
|
18
19
|
constructor(logger: Logging, platformConfig: PlatformConfig, apiInput: API);
|
|
19
20
|
handleConfigDefaults(): void;
|
|
20
21
|
configureAccessory(accessory: PlatformAccessory): void;
|
package/dist/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,qBAAqB,EACrB,OAAO,EACP,iBAAiB,EACjB,cAAc,
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,qBAAqB,EACrB,OAAO,EACP,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAoBnC,qBAAa,kBAAmB,YAAW,qBAAqB;aAmB5C,MAAM,EAAE,OAAO;aACf,cAAc,EAAE,cAAc;aAC9B,QAAQ,EAAE,GAAG;IApB/B,SAAgB,MAAM,EAAE,wBAAwB,CAAC;IACjD,SAAgB,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC;IACvC,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,GAAG,EAAE,GAAG,CAAC;IAEzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6C;IACzE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CACxB;IAEZ,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CACxB;IAEZ,OAAO,CAAC,aAAa,CAAC,CAAoB;IAE1C,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAyB;gBAGtD,MAAM,EAAE,OAAO,EACf,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,GAAG;IAsC/B,oBAAoB;IA8BpB,kBAAkB,CAAC,SAAS,EAAE,iBAAiB;IAKzC,eAAe;IA8Df,MAAM,CAAC,KAAK,EAAE,KAAK;IAQzB,OAAO,CAAC,mBAAmB;IA2D3B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,iBAAiB;IAqBzB,OAAO,CAAC,YAAY;CAgCrB"}
|
package/dist/platform.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SyncBoxClient } from './lib/client.js';
|
|
2
2
|
import { PLATFORM_NAME, PLUGIN_NAME } from './settings.js';
|
|
3
|
-
import { ENTERTAINMENT_TV_ACCESSORY, INTENSITY_TV_ACCESSORY, LIGHTBULB, LIGHTBULB_ACCESSORY, MODE_TV_ACCESSORY, SWITCH, SWITCH_ACCESSORY, TV_ACCESSORY,
|
|
3
|
+
import { ENTERTAINMENT_TV_ACCESSORY, INTENSITY_TV_ACCESSORY, LIGHTBULB, LIGHTBULB_ACCESSORY, MODE_TV_ACCESSORY, SWITCH, SWITCH_ACCESSORY, TV_ACCESSORY, } from './lib/constants.js';
|
|
4
4
|
import { SwitchDevice } from './accessories/switch.js';
|
|
5
5
|
import { LightbulbDevice } from './accessories/lightbulb.js';
|
|
6
6
|
import { TvDevice } from './accessories/tv.js';
|
|
@@ -21,6 +21,7 @@ export class HueSyncBoxPlatform {
|
|
|
21
21
|
existingAccessories = new Map();
|
|
22
22
|
externalAccessories = new Map();
|
|
23
23
|
mainAccessory;
|
|
24
|
+
TV_ACCESSORY_TYPES_TO_CATEGORY;
|
|
24
25
|
constructor(logger, platformConfig, apiInput) {
|
|
25
26
|
this.logger = logger;
|
|
26
27
|
this.platformConfig = platformConfig;
|
|
@@ -33,6 +34,12 @@ export class HueSyncBoxPlatform {
|
|
|
33
34
|
this.api = apiInput;
|
|
34
35
|
this.log = logger ?? console;
|
|
35
36
|
this.log.info('Initializing platform:', this.config.name);
|
|
37
|
+
this.TV_ACCESSORY_TYPES_TO_CATEGORY = {
|
|
38
|
+
settopbox: 35 /* this.api.hap.Categories.TV_SET_TOP_BOX */,
|
|
39
|
+
tvstick: 36 /* this.api.hap.Categories.TV_STREAMING_STICK */,
|
|
40
|
+
audioreceiver: 34 /* this.api.hap.Categories.AUDIO_RECEIVER */,
|
|
41
|
+
tv: 31 /* this.api.hap.Categories.TELEVISION */,
|
|
42
|
+
};
|
|
36
43
|
if (!this.config.syncBoxIpAddress || !this.config.syncBoxApiAccessToken) {
|
|
37
44
|
this.log.error('Missing required configuration parameters');
|
|
38
45
|
throw new Error('Missing required configuration parameters');
|
|
@@ -131,7 +138,7 @@ export class HueSyncBoxPlatform {
|
|
|
131
138
|
async update(state) {
|
|
132
139
|
this.log.debug('Updating state called');
|
|
133
140
|
for (const device of this.devices) {
|
|
134
|
-
this.log.debug('Updating device:', device.accessory.displayName
|
|
141
|
+
this.log.debug('Updating device:', device.accessory.displayName);
|
|
135
142
|
device.update(state);
|
|
136
143
|
}
|
|
137
144
|
}
|
|
@@ -183,8 +190,8 @@ export class HueSyncBoxPlatform {
|
|
|
183
190
|
createTvAccessory(state, accessoryName, accessoryType) {
|
|
184
191
|
const accessory = this.createPlatformAccessory(state, accessoryName);
|
|
185
192
|
accessory.category =
|
|
186
|
-
TV_ACCESSORY_TYPES_TO_CATEGORY[accessoryType.toLowerCase()] ??
|
|
187
|
-
31 /* Categories.TELEVISION */;
|
|
193
|
+
this.TV_ACCESSORY_TYPES_TO_CATEGORY[accessoryType.toLowerCase()] ??
|
|
194
|
+
31 /* this.api.hap.Categories.TELEVISION */;
|
|
188
195
|
this.externalAccessories.set(accessory.UUID, accessory);
|
|
189
196
|
this.log.debug('Created TV named ' +
|
|
190
197
|
accessoryName +
|
package/dist/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG3D,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,OAAO,kBAAkB;IAmBX;IACA;IACA;IApBF,MAAM,CAA2B;IACjC,GAAG,CAAoB;IACvB,MAAM,CAAgB;IACtB,GAAG,CAAM;IAER,OAAO,GAAyB,EAAE,CAAC;IACnC,WAAW,GAAmC,IAAI,GAAG,EAAE,CAAC;IACxD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Aa,CAAC,CAAC;YAClE,KAAK,iBAAiB;gBACpB,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YACtE,KAAK,sBAAsB;gBACzB,OAAO,IAAI,iBAAiB,CAC1B,IAAI,EACJ,SAAS,EACT,KAAK,EACL,IAAI,CAAC,aAAa,CACnB,CAAC;YACJ,KAAK,0BAA0B;gBAC7B,OAAO,IAAI,qBAAqB,CAC9B,IAAI,EACJ,SAAS,EACT,KAAK,EACL,IAAI,CAAC,aAAa,CACnB,CAAC;YACJ;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "homebridge-philips-hue-sync-box",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"displayName": "Philips Hue Sync Box",
|
|
5
|
-
"version": "1.2.0
|
|
5
|
+
"version": "1.2.0",
|
|
6
6
|
"description": "Homebridge plugin for the Philips Hue Sync Box.",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Jared Brown",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"conventional-changelog-conventionalcommits": "^8.0.0",
|
|
84
84
|
"cross-env": "^7.0.3",
|
|
85
85
|
"eslint": "^9.17.0",
|
|
86
|
-
"homebridge": "^
|
|
87
|
-
"homebridge-config-ui-x": "^
|
|
86
|
+
"homebridge": "^1.8.5",
|
|
87
|
+
"homebridge-config-ui-x": "^4.68.0",
|
|
88
88
|
"husky": "^9.1.7",
|
|
89
89
|
"lint-staged": "^15.3.0",
|
|
90
90
|
"nodemon": "^3.1.9",
|
package/src/accessories/base.ts
CHANGED
package/src/config.ts
CHANGED
|
@@ -10,7 +10,6 @@ export interface HueSyncBoxPlatformConfig extends PlatformConfig {
|
|
|
10
10
|
defaultOnMode: OnMode;
|
|
11
11
|
defaultOffMode: OffMode;
|
|
12
12
|
baseAccessory: 'lightbulb' | 'switch' | 'none';
|
|
13
|
-
baseAccessoryName: string;
|
|
14
13
|
tvAccessory: boolean;
|
|
15
14
|
tvAccessoryConfiguredName: string;
|
|
16
15
|
tvAccessoryType: TvAccessoryType;
|
package/src/lib/client.ts
CHANGED
|
@@ -10,7 +10,7 @@ import AsyncLock, { AsyncLockOptions } from 'async-lock';
|
|
|
10
10
|
const fetch = fetch_retry(originalFetch, {
|
|
11
11
|
retries: 3,
|
|
12
12
|
retryDelay: attempt => {
|
|
13
|
-
return Math.pow(2, attempt) *
|
|
13
|
+
return Math.pow(2, attempt) * 1000; // 1000, 2000, 4000
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
|
package/src/lib/constants.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { Categories } from 'homebridge';
|
|
2
|
-
|
|
3
1
|
export const PASSTHROUGH: string = 'passthrough';
|
|
4
2
|
export const POWER_SAVE: string = 'powersave';
|
|
5
3
|
export const LIGHTBULB = 'lightbulb';
|
|
@@ -10,9 +8,3 @@ export const TV_ACCESSORY: string = 'TVAccessory';
|
|
|
10
8
|
export const MODE_TV_ACCESSORY: string = 'ModeTVAccessory';
|
|
11
9
|
export const INTENSITY_TV_ACCESSORY: string = 'IntensityTVAccessory';
|
|
12
10
|
export const ENTERTAINMENT_TV_ACCESSORY: string = 'EntertainmentTVAccessory';
|
|
13
|
-
export const TV_ACCESSORY_TYPES_TO_CATEGORY: Record<string, number> = {
|
|
14
|
-
settopbox: Categories.TV_SET_TOP_BOX,
|
|
15
|
-
tvstick: Categories.TV_STREAMING_STICK,
|
|
16
|
-
audioreceiver: Categories.AUDIO_RECEIVER,
|
|
17
|
-
tv: Categories.TELEVISION,
|
|
18
|
-
};
|
package/src/platform.ts
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
Logging,
|
|
5
5
|
PlatformAccessory,
|
|
6
6
|
PlatformConfig,
|
|
7
|
-
Categories,
|
|
8
7
|
} from 'homebridge';
|
|
9
8
|
|
|
10
9
|
import { HueSyncBoxPlatformConfig } from './config';
|
|
@@ -21,7 +20,6 @@ import {
|
|
|
21
20
|
SWITCH,
|
|
22
21
|
SWITCH_ACCESSORY,
|
|
23
22
|
TV_ACCESSORY,
|
|
24
|
-
TV_ACCESSORY_TYPES_TO_CATEGORY,
|
|
25
23
|
} from './lib/constants.js';
|
|
26
24
|
import { SwitchDevice } from './accessories/switch.js';
|
|
27
25
|
import { LightbulbDevice } from './accessories/lightbulb.js';
|
|
@@ -47,6 +45,8 @@ export class HueSyncBoxPlatform implements DynamicPlatformPlugin {
|
|
|
47
45
|
|
|
48
46
|
private mainAccessory?: PlatformAccessory;
|
|
49
47
|
|
|
48
|
+
private readonly TV_ACCESSORY_TYPES_TO_CATEGORY: Record<string, number>;
|
|
49
|
+
|
|
50
50
|
constructor(
|
|
51
51
|
public readonly logger: Logging,
|
|
52
52
|
public readonly platformConfig: PlatformConfig,
|
|
@@ -61,6 +61,13 @@ export class HueSyncBoxPlatform implements DynamicPlatformPlugin {
|
|
|
61
61
|
this.log = logger ?? console;
|
|
62
62
|
this.log.info('Initializing platform:', this.config.name);
|
|
63
63
|
|
|
64
|
+
this.TV_ACCESSORY_TYPES_TO_CATEGORY = {
|
|
65
|
+
settopbox: this.api.hap.Categories.TV_SET_TOP_BOX,
|
|
66
|
+
tvstick: this.api.hap.Categories.TV_STREAMING_STICK,
|
|
67
|
+
audioreceiver: this.api.hap.Categories.AUDIO_RECEIVER,
|
|
68
|
+
tv: this.api.hap.Categories.TELEVISION,
|
|
69
|
+
};
|
|
70
|
+
|
|
64
71
|
if (!this.config.syncBoxIpAddress || !this.config.syncBoxApiAccessToken) {
|
|
65
72
|
this.log.error('Missing required configuration parameters');
|
|
66
73
|
throw new Error('Missing required configuration parameters');
|
|
@@ -181,10 +188,7 @@ export class HueSyncBoxPlatform implements DynamicPlatformPlugin {
|
|
|
181
188
|
async update(state: State) {
|
|
182
189
|
this.log.debug('Updating state called');
|
|
183
190
|
for (const device of this.devices) {
|
|
184
|
-
this.log.debug(
|
|
185
|
-
'Updating device:',
|
|
186
|
-
device.accessory.displayName + ' ' + device.accessory.context.kind
|
|
187
|
-
);
|
|
191
|
+
this.log.debug('Updating device:', device.accessory.displayName);
|
|
188
192
|
device.update(state);
|
|
189
193
|
}
|
|
190
194
|
}
|
|
@@ -273,8 +277,8 @@ export class HueSyncBoxPlatform implements DynamicPlatformPlugin {
|
|
|
273
277
|
) {
|
|
274
278
|
const accessory = this.createPlatformAccessory(state, accessoryName);
|
|
275
279
|
accessory.category =
|
|
276
|
-
TV_ACCESSORY_TYPES_TO_CATEGORY[accessoryType.toLowerCase()] ??
|
|
277
|
-
Categories.TELEVISION;
|
|
280
|
+
this.TV_ACCESSORY_TYPES_TO_CATEGORY[accessoryType.toLowerCase()] ??
|
|
281
|
+
this.api.hap.Categories.TELEVISION;
|
|
278
282
|
this.externalAccessories.set(accessory.UUID, accessory);
|
|
279
283
|
this.log.debug(
|
|
280
284
|
'Created TV named ' +
|