@mp-consulting/homebridge-philips-ambilight-tv 1.0.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/.claude/settings.local.json +12 -0
- package/.tool-versions +1 -0
- package/CHANGELOG.md +34 -0
- package/LICENSE +176 -0
- package/README.md +158 -0
- package/config.schema.json +193 -0
- package/dist/api/PhilipsTVClient.d.ts +54 -0
- package/dist/api/PhilipsTVClient.js +230 -0
- package/dist/api/PhilipsTVClient.js.map +1 -0
- package/dist/api/constants.d.ts +12 -0
- package/dist/api/constants.js +24 -0
- package/dist/api/constants.js.map +1 -0
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.js +14 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/types.d.ts +159 -0
- package/dist/api/types.js +5 -0
- package/dist/api/types.js.map +1 -0
- package/dist/api/utils.d.ts +31 -0
- package/dist/api/utils.js +175 -0
- package/dist/api/utils.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.d.ts +21 -0
- package/dist/platform.js +78 -0
- package/dist/platform.js.map +1 -0
- package/dist/platformAccessory.d.ts +58 -0
- package/dist/platformAccessory.js +472 -0
- package/dist/platformAccessory.js.map +1 -0
- package/dist/settings.d.ts +8 -0
- package/dist/settings.js +9 -0
- package/dist/settings.js.map +1 -0
- package/homebridge-ui/api/PhilipsTVClient.d.ts +54 -0
- package/homebridge-ui/api/PhilipsTVClient.js +230 -0
- package/homebridge-ui/api/PhilipsTVClient.js.map +1 -0
- package/homebridge-ui/api/PhilipsTvApi.d.ts +35 -0
- package/homebridge-ui/api/PhilipsTvApi.js +248 -0
- package/homebridge-ui/api/PhilipsTvApi.js.map +1 -0
- package/homebridge-ui/api/constants.d.ts +12 -0
- package/homebridge-ui/api/constants.js +24 -0
- package/homebridge-ui/api/constants.js.map +1 -0
- package/homebridge-ui/api/index.d.ts +10 -0
- package/homebridge-ui/api/index.js +14 -0
- package/homebridge-ui/api/index.js.map +1 -0
- package/homebridge-ui/api/types.d.ts +159 -0
- package/homebridge-ui/api/types.js +5 -0
- package/homebridge-ui/api/types.js.map +1 -0
- package/homebridge-ui/api/utils.d.ts +31 -0
- package/homebridge-ui/api/utils.js +175 -0
- package/homebridge-ui/api/utils.js.map +1 -0
- package/homebridge-ui/public/ambilight-tv.jpg +0 -0
- package/homebridge-ui/public/app.js +854 -0
- package/homebridge-ui/public/index.html +210 -0
- package/homebridge-ui/public/styles.css +249 -0
- package/homebridge-ui/server.js +407 -0
- package/package.json +57 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(npm run build:*)",
|
|
5
|
+
"Bash(git rev-list:*)",
|
|
6
|
+
"Bash(GIT_SEQUENCE_EDITOR=\"sed -i '''' ''s/^pick 9712d26/reword 9712d26/''\" git rebase -i 9712d26~1)",
|
|
7
|
+
"Bash(git filter-branch:*)",
|
|
8
|
+
"Bash(npm run lint:*)",
|
|
9
|
+
"Bash(npm pkg fix:*)"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
}
|
package/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodejs 20.19.5
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2024-12-20
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Initial release
|
|
10
|
+
- Power ON/OFF control with Wake-on-LAN support
|
|
11
|
+
- Input source selection (HDMI ports, TV tuner, applications)
|
|
12
|
+
- Volume control and mute functionality
|
|
13
|
+
- Remote control support (D-Pad, Back, Menu, Play/Pause, Info)
|
|
14
|
+
- Ambilight power control
|
|
15
|
+
- Multi-TV support in a single platform
|
|
16
|
+
- Custom UI for Homebridge Config UI X:
|
|
17
|
+
- TV discovery via mDNS (Bonjour)
|
|
18
|
+
- Guided pairing wizard with PIN entry
|
|
19
|
+
- Source editor with drag-and-drop reordering
|
|
20
|
+
- Source visibility toggle
|
|
21
|
+
- MAC address auto-detection
|
|
22
|
+
- JointSpace API v6 client for Philips Android TVs
|
|
23
|
+
- Digest authentication support
|
|
24
|
+
- Input source persistence across restarts
|
|
25
|
+
- Workaround for tvOS 18 HomeHub input source renaming bug
|
|
26
|
+
- Comprehensive error handling and logging
|
|
27
|
+
|
|
28
|
+
### Technical
|
|
29
|
+
|
|
30
|
+
- TypeScript codebase with ESM modules
|
|
31
|
+
- Separate API client library (`PhilipsTVClient`)
|
|
32
|
+
- Shared code between plugin and custom UI
|
|
33
|
+
- ESLint configuration with strict rules
|
|
34
|
+
- Test script for TV API endpoints
|
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="homebridge-ui/public/ambilight-tv.jpg" width="300">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Homebridge Philips Ambilight TV
|
|
6
|
+
|
|
7
|
+
A Homebridge plugin to control Philips Android TVs with Ambilight as HomeKit Television accessories.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Power ON/OFF with Wake-on-LAN support
|
|
12
|
+
- Input source selection (HDMI, TV tuner, apps)
|
|
13
|
+
- Volume control and mute
|
|
14
|
+
- Remote control (D-Pad, Back, Menu, Play/Pause, etc.)
|
|
15
|
+
- Ambilight power control
|
|
16
|
+
- Multi-TV support
|
|
17
|
+
- Custom UI for easy setup and configuration
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Philips Android TV with JointSpace API v6 (2016+ models)
|
|
22
|
+
- TV and Homebridge on the same network
|
|
23
|
+
- Node.js 20.18.0 or later
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
### Via Homebridge UI (Recommended)
|
|
28
|
+
|
|
29
|
+
1. Open the Homebridge UI
|
|
30
|
+
2. Go to the Plugins tab
|
|
31
|
+
3. Search for "homebridge-philips-ambilight-tv"
|
|
32
|
+
4. Click Install
|
|
33
|
+
|
|
34
|
+
### Via Command Line
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g homebridge-philips-ambilight-tv
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Setup
|
|
41
|
+
|
|
42
|
+
### Using the Custom UI (Recommended)
|
|
43
|
+
|
|
44
|
+
1. Open the Homebridge UI and go to the plugin settings
|
|
45
|
+
2. Click "Discover TVs" to find your TV on the network
|
|
46
|
+
3. Select your TV and follow the pairing wizard
|
|
47
|
+
4. Enter the PIN displayed on your TV screen
|
|
48
|
+
5. Customize sources and save
|
|
49
|
+
|
|
50
|
+
### Manual Configuration
|
|
51
|
+
|
|
52
|
+
Add the following to your `config.json`:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"platforms": [
|
|
57
|
+
{
|
|
58
|
+
"platform": "PhilipsAmbilightTV",
|
|
59
|
+
"devices": [
|
|
60
|
+
{
|
|
61
|
+
"name": "Living Room TV",
|
|
62
|
+
"ip": "192.168.1.10",
|
|
63
|
+
"mac": "AA:BB:CC:DD:EE:FF",
|
|
64
|
+
"username": "your_device_id",
|
|
65
|
+
"password": "your_auth_key"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Configuration Options
|
|
74
|
+
|
|
75
|
+
| Key | Description | Required |
|
|
76
|
+
| --- | --- | --- |
|
|
77
|
+
| `platform` | Must be `PhilipsAmbilightTV` | Yes |
|
|
78
|
+
| `devices` | Array of TV configurations | Yes |
|
|
79
|
+
| `devices[].name` | Display name for the TV | Yes |
|
|
80
|
+
| `devices[].ip` | IP address of your TV | Yes |
|
|
81
|
+
| `devices[].mac` | MAC address (for Wake-on-LAN) | Yes |
|
|
82
|
+
| `devices[].username` | Device ID from pairing | Yes |
|
|
83
|
+
| `devices[].password` | Auth key from pairing | Yes |
|
|
84
|
+
| `devices[].sources` | Custom source configuration | No |
|
|
85
|
+
|
|
86
|
+
### Getting Credentials
|
|
87
|
+
|
|
88
|
+
The `username` and `password` are obtained during the pairing process:
|
|
89
|
+
|
|
90
|
+
1. Use the plugin's custom UI to pair (recommended)
|
|
91
|
+
2. Or use the TV's built-in pairing API:
|
|
92
|
+
- Send a pairing request to `https://<TV_IP>:1926/6/pair/request`
|
|
93
|
+
- Complete the pairing with the PIN shown on TV
|
|
94
|
+
- The response contains your credentials
|
|
95
|
+
|
|
96
|
+
## Editing Sources
|
|
97
|
+
|
|
98
|
+
The plugin supports customizing which sources appear in HomeKit:
|
|
99
|
+
|
|
100
|
+
1. Go to the plugin settings in Homebridge UI
|
|
101
|
+
2. Click "Edit Sources" on your configured TV
|
|
102
|
+
3. Drag and drop to reorder sources
|
|
103
|
+
4. Toggle visibility for each source
|
|
104
|
+
5. Click "Done" to save
|
|
105
|
+
|
|
106
|
+
Note: HomeKit limits input sources to 45 total.
|
|
107
|
+
|
|
108
|
+
## Troubleshooting
|
|
109
|
+
|
|
110
|
+
### TV not discovered
|
|
111
|
+
|
|
112
|
+
- Ensure the TV is powered on (not in standby)
|
|
113
|
+
- Check that TV and Homebridge are on the same network/VLAN
|
|
114
|
+
- Try entering the IP address manually
|
|
115
|
+
|
|
116
|
+
### Pairing fails
|
|
117
|
+
|
|
118
|
+
- Make sure no other device is pairing simultaneously
|
|
119
|
+
- Try restarting the TV
|
|
120
|
+
- Check the TV's network settings
|
|
121
|
+
|
|
122
|
+
### TV not responding
|
|
123
|
+
|
|
124
|
+
- Verify the TV's IP hasn't changed (consider a static IP)
|
|
125
|
+
- Check if Wake-on-LAN is enabled in TV settings
|
|
126
|
+
- Ensure the TV's API is accessible (port 1926)
|
|
127
|
+
|
|
128
|
+
### Input sources not updating in Home app
|
|
129
|
+
|
|
130
|
+
This is a known tvOS 18 bug. The plugin includes a workaround that may require removing and re-adding the TV in the Home app.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Clone the repository
|
|
136
|
+
git clone https://github.com/mickael/homebridge-philips-ambilight-tv.git
|
|
137
|
+
|
|
138
|
+
# Install dependencies
|
|
139
|
+
npm install
|
|
140
|
+
|
|
141
|
+
# Build
|
|
142
|
+
npm run build
|
|
143
|
+
|
|
144
|
+
# Run with test config
|
|
145
|
+
npm start
|
|
146
|
+
|
|
147
|
+
# Test TV endpoints
|
|
148
|
+
npm run test:tv
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
Apache-2.0
|
|
154
|
+
|
|
155
|
+
## Credits
|
|
156
|
+
|
|
157
|
+
- [Homebridge](https://homebridge.io/)
|
|
158
|
+
- Philips JointSpace API documentation
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
{
|
|
2
|
+
"pluginAlias": "PhilipsAmbilightTV",
|
|
3
|
+
"pluginType": "platform",
|
|
4
|
+
"singular": true,
|
|
5
|
+
"strictValidation": false,
|
|
6
|
+
"customUi": true,
|
|
7
|
+
"schema": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"required": [
|
|
10
|
+
"devices"
|
|
11
|
+
],
|
|
12
|
+
"additionalProperties": false,
|
|
13
|
+
"properties": {
|
|
14
|
+
"devices": {
|
|
15
|
+
"title": "TV Devices",
|
|
16
|
+
"type": "array",
|
|
17
|
+
"minItems": 1,
|
|
18
|
+
"items": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"required": [
|
|
21
|
+
"name",
|
|
22
|
+
"mac",
|
|
23
|
+
"ip",
|
|
24
|
+
"username",
|
|
25
|
+
"password"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"properties": {
|
|
29
|
+
"name": {
|
|
30
|
+
"title": "TV Name",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"default": "My Philips TV",
|
|
33
|
+
"description": "The name of the TV as it will appear in HomeKit."
|
|
34
|
+
},
|
|
35
|
+
"mac": {
|
|
36
|
+
"title": "MAC Address",
|
|
37
|
+
"type": "string",
|
|
38
|
+
"pattern": "^([A-Fa-f0-9]{2}:){5}[A-Fa-f0-9]{2}$",
|
|
39
|
+
"placeholder": "AA:BB:CC:DD:EE:FF",
|
|
40
|
+
"description": "The MAC address of the TV (required for Wake-on-LAN)."
|
|
41
|
+
},
|
|
42
|
+
"ip": {
|
|
43
|
+
"title": "IP Address",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"format": "ipv4",
|
|
46
|
+
"placeholder": "192.168.1.100",
|
|
47
|
+
"description": "The IP address of the TV on the local network."
|
|
48
|
+
},
|
|
49
|
+
"username": {
|
|
50
|
+
"title": "Username",
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "The username obtained during TV pairing."
|
|
53
|
+
},
|
|
54
|
+
"password": {
|
|
55
|
+
"title": "Password",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "The password (auth key) obtained during TV pairing."
|
|
58
|
+
},
|
|
59
|
+
"pollingInterval": {
|
|
60
|
+
"title": "Polling Interval (ms)",
|
|
61
|
+
"type": "integer",
|
|
62
|
+
"default": 10000,
|
|
63
|
+
"minimum": 1000,
|
|
64
|
+
"maximum": 60000,
|
|
65
|
+
"description": "How often to poll the TV for state updates (in milliseconds)."
|
|
66
|
+
},
|
|
67
|
+
"wakeOnLanEnabled": {
|
|
68
|
+
"title": "Wake-on-LAN",
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"default": true,
|
|
71
|
+
"description": "Enable Wake-on-LAN to turn on the TV from standby."
|
|
72
|
+
},
|
|
73
|
+
"inputs": {
|
|
74
|
+
"title": "Custom Input Sources",
|
|
75
|
+
"type": "array",
|
|
76
|
+
"description": "Custom input sources to display in HomeKit. If not specified, apps will be fetched from the TV.",
|
|
77
|
+
"items": {
|
|
78
|
+
"type": "object",
|
|
79
|
+
"required": [
|
|
80
|
+
"name",
|
|
81
|
+
"type",
|
|
82
|
+
"identifier"
|
|
83
|
+
],
|
|
84
|
+
"properties": {
|
|
85
|
+
"name": {
|
|
86
|
+
"title": "Name",
|
|
87
|
+
"type": "string",
|
|
88
|
+
"description": "The display name for this input source."
|
|
89
|
+
},
|
|
90
|
+
"type": {
|
|
91
|
+
"title": "Type",
|
|
92
|
+
"type": "string",
|
|
93
|
+
"enum": [
|
|
94
|
+
"app",
|
|
95
|
+
"source",
|
|
96
|
+
"channel"
|
|
97
|
+
],
|
|
98
|
+
"description": "The type of input source."
|
|
99
|
+
},
|
|
100
|
+
"identifier": {
|
|
101
|
+
"title": "Identifier",
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "The app package name, source ID, or channel number."
|
|
104
|
+
},
|
|
105
|
+
"displayOrder": {
|
|
106
|
+
"title": "Display Order",
|
|
107
|
+
"type": "integer",
|
|
108
|
+
"minimum": 0,
|
|
109
|
+
"description": "The order in which this input appears in HomeKit."
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"sources": {
|
|
115
|
+
"title": "Source Configuration",
|
|
116
|
+
"type": "array",
|
|
117
|
+
"description": "Source order and visibility settings (managed via the Sources UI).",
|
|
118
|
+
"items": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {
|
|
121
|
+
"id": {
|
|
122
|
+
"title": "Source ID",
|
|
123
|
+
"type": "string",
|
|
124
|
+
"description": "The unique identifier for this source."
|
|
125
|
+
},
|
|
126
|
+
"order": {
|
|
127
|
+
"title": "Display Order",
|
|
128
|
+
"type": "integer",
|
|
129
|
+
"minimum": 0,
|
|
130
|
+
"description": "The order in which this source appears in HomeKit."
|
|
131
|
+
},
|
|
132
|
+
"visible": {
|
|
133
|
+
"title": "Visible",
|
|
134
|
+
"type": "boolean",
|
|
135
|
+
"default": true,
|
|
136
|
+
"description": "Whether this source is visible in HomeKit."
|
|
137
|
+
},
|
|
138
|
+
"customName": {
|
|
139
|
+
"title": "Custom Name",
|
|
140
|
+
"type": "string",
|
|
141
|
+
"description": "Optional custom name to display instead of the default."
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"layout": [
|
|
152
|
+
{
|
|
153
|
+
"type": "fieldset",
|
|
154
|
+
"title": "TV Devices",
|
|
155
|
+
"expandable": true,
|
|
156
|
+
"expanded": true,
|
|
157
|
+
"items": [
|
|
158
|
+
{
|
|
159
|
+
"key": "devices",
|
|
160
|
+
"type": "array",
|
|
161
|
+
"orderable": true,
|
|
162
|
+
"buttonText": "Add TV",
|
|
163
|
+
"items": [
|
|
164
|
+
"devices[].name",
|
|
165
|
+
"devices[].ip",
|
|
166
|
+
"devices[].mac",
|
|
167
|
+
"devices[].username",
|
|
168
|
+
"devices[].password",
|
|
169
|
+
{
|
|
170
|
+
"key": "devices[].pollingInterval",
|
|
171
|
+
"description": "Polling interval in milliseconds (default: 10000)"
|
|
172
|
+
},
|
|
173
|
+
"devices[].wakeOnLanEnabled",
|
|
174
|
+
{
|
|
175
|
+
"key": "devices[].inputs",
|
|
176
|
+
"type": "array",
|
|
177
|
+
"title": "Custom Input Sources (Optional)",
|
|
178
|
+
"expandable": true,
|
|
179
|
+
"expanded": false,
|
|
180
|
+
"buttonText": "Add Input",
|
|
181
|
+
"items": [
|
|
182
|
+
"devices[].inputs[].name",
|
|
183
|
+
"devices[].inputs[].type",
|
|
184
|
+
"devices[].inputs[].identifier",
|
|
185
|
+
"devices[].inputs[].displayOrder"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Philips TV API Client
|
|
3
|
+
* Handles all communication with the Philips TV JointSpace API (v6)
|
|
4
|
+
*/
|
|
5
|
+
import type { VolumeState, TVSource, TVApplication, TVChannel, RemoteKey, SystemInfo } from './types.js';
|
|
6
|
+
/** Built-in HDMI sources for Android TV (Philips) */
|
|
7
|
+
export declare const HDMI_SOURCES: Readonly<Record<string, string>>;
|
|
8
|
+
/** Watch TV source URI */
|
|
9
|
+
export declare const WATCH_TV_URI = "content://android.media.tv/channel";
|
|
10
|
+
export interface PhilipsTVClientConfig {
|
|
11
|
+
ip: string;
|
|
12
|
+
mac: string;
|
|
13
|
+
username: string;
|
|
14
|
+
password: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class PhilipsTVClient {
|
|
17
|
+
private readonly config;
|
|
18
|
+
constructor(config: PhilipsTVClientConfig);
|
|
19
|
+
private request;
|
|
20
|
+
private handleDigestAuth;
|
|
21
|
+
private parseJsonResponse;
|
|
22
|
+
private get;
|
|
23
|
+
private post;
|
|
24
|
+
getPowerState(): Promise<boolean>;
|
|
25
|
+
setPowerState(on: boolean): Promise<boolean>;
|
|
26
|
+
private tryWakeOnLan;
|
|
27
|
+
getVolume(): Promise<VolumeState | null>;
|
|
28
|
+
setVolume(volume: number): Promise<boolean>;
|
|
29
|
+
setMuted(muted: boolean): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Fetches available sources from the TV API.
|
|
32
|
+
* Falls back to built-in sources if the API call fails.
|
|
33
|
+
*/
|
|
34
|
+
getSources(): Promise<TVSource[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Returns hardcoded built-in sources (Watch TV + HDMI ports).
|
|
37
|
+
* Use getSources() instead for dynamic source fetching.
|
|
38
|
+
*/
|
|
39
|
+
getBuiltInSources(): TVSource[];
|
|
40
|
+
setSource(sourceUri: string): Promise<boolean>;
|
|
41
|
+
getApplications(): Promise<TVApplication[]>;
|
|
42
|
+
launchApplication(packageName: string): Promise<boolean>;
|
|
43
|
+
getCurrentActivity(): Promise<string | null>;
|
|
44
|
+
private launchIntent;
|
|
45
|
+
getChannels(): Promise<TVChannel[]>;
|
|
46
|
+
setChannel(ccid: number): Promise<boolean>;
|
|
47
|
+
sendKey(key: RemoteKey): Promise<boolean>;
|
|
48
|
+
getSystemInfo(): Promise<SystemInfo | null>;
|
|
49
|
+
isReachable(): Promise<boolean>;
|
|
50
|
+
getAmbilightPower(): Promise<boolean>;
|
|
51
|
+
setAmbilightPower(on: boolean): Promise<boolean>;
|
|
52
|
+
wakeUp(): Promise<void>;
|
|
53
|
+
private sleep;
|
|
54
|
+
}
|