homebridge-cmd4 6.0.0 → 6.0.4
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 +30 -0
- package/Cmd4Accessory.js +115 -143
- package/Cmd4Platform.js +19 -0
- package/RUNNING_CHANGELOG.md +36 -0
- package/docs/Developers.md +1 -1
- package/package.json +2 -2
- package/homebridge-ui/public/index.html.1 +0 -248
- package/homebridge-ui/public/index.html.2 +0 -257
- package/homebridge-ui/public/index.html.3 +0 -265
- package/homebridge-ui/public/index.html.3.1 +0 -244
- package/homebridge-ui/public/index.html.wemo.1 +0 -194
- package/homebridge-ui/public/index.html.wemo.2 +0 -339
- package/homebridge-ui/public/js/main.js.1 +0 -583
- package/homebridge-ui/public/js/main.js.2 +0 -583
- package/homebridge-ui/public/js/main.js.3 +0 -583
- package/homebridge-ui/public/js/schema.js.save +0 -196
- package/homebridge-ui/public/js/wmain.js.1 +0 -152
- package/homebridge-ui/public/js/wmain.js.2 +0 -161
- package/homebridge-ui/server.js.1 +0 -281
- package/homebridge-ui/server.js.2 +0 -281
- package/homebridge-ui/server.js.3 +0 -281
- package/homebridge-ui/server.js.wemo.1 +0 -78
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
<p class="text-center">
|
|
2
|
-
<img src="images/HB_Cmd4.png"
|
|
3
|
-
alt="Scripting with Cmd4 for Homebridge"
|
|
4
|
-
style="width: 60%;"
|
|
5
|
-
/>
|
|
6
|
-
</p>
|
|
7
|
-
<div id="pageIntro" class="text-center" style="display: none;">
|
|
8
|
-
<p class="lead">Thank you for Cmd4 <strong>homebridge-Cmd4</strong></p>
|
|
9
|
-
<p>Remember to click Save on the next page</p>
|
|
10
|
-
<button type="button" class="btn btn-primary" id="introContinue">Continue →</button>
|
|
11
|
-
</div>
|
|
12
|
-
<div
|
|
13
|
-
id="menuWrapper"
|
|
14
|
-
class="btn-group w-100 mb-0"
|
|
15
|
-
role="group"
|
|
16
|
-
aria-label="UI Menu"
|
|
17
|
-
style="display: none;"
|
|
18
|
-
>
|
|
19
|
-
<button type="button" class="btn btn-primary ml-0" id="menuSettings">Settings</button>
|
|
20
|
-
<button type="button" class="btn btn-primary" id="menuDevices">My Devices</button>
|
|
21
|
-
<button type="button" class="btn btn-primary mr-0" id="menuHome">Support</button>
|
|
22
|
-
</div>
|
|
23
|
-
<div
|
|
24
|
-
id="disabledBanner"
|
|
25
|
-
class="alert alert-secondary mb-0 mt-3"
|
|
26
|
-
role="alert"
|
|
27
|
-
style="display: none;"
|
|
28
|
-
>
|
|
29
|
-
Plugin is currently disabled
|
|
30
|
-
<button id="disabledEnable" type="button" class="btn btn-link p-0 m-0 float-right">Enable</button>
|
|
31
|
-
</div>
|
|
32
|
-
<div id="pageDevices" class="mt-4" style="display: none;">
|
|
33
|
-
<div id="deviceInfo">
|
|
34
|
-
<form>
|
|
35
|
-
<div class="form-group">
|
|
36
|
-
<select class="form-control" id="deviceSelect"></select>
|
|
37
|
-
</div>
|
|
38
|
-
</form>
|
|
39
|
-
<table class="table w-100" id="deviceTable" style="display: none;">
|
|
40
|
-
<thead>
|
|
41
|
-
<tr class="table-active">
|
|
42
|
-
<th scope="col" style="width: 40%;">Device Name</th>
|
|
43
|
-
<th scope="col" style="width: 60%;" id="displayName"></th>
|
|
44
|
-
</tr>
|
|
45
|
-
</thead>
|
|
46
|
-
<tbody>
|
|
47
|
-
<tr>
|
|
48
|
-
<th scope="row">HTTP Status</th>
|
|
49
|
-
<td id="http_status"></td>
|
|
50
|
-
</tr>
|
|
51
|
-
<tr>
|
|
52
|
-
<th scope="row">UPnP Status</th>
|
|
53
|
-
<td id="upnp_status"></td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr>
|
|
56
|
-
<th scope="row">IP Address</th>
|
|
57
|
-
<td id="ipAddress"></td>
|
|
58
|
-
</tr>
|
|
59
|
-
<tr>
|
|
60
|
-
<th scope="row">Port</th>
|
|
61
|
-
<td id="port"></td>
|
|
62
|
-
</tr>
|
|
63
|
-
<tr>
|
|
64
|
-
<th scope="row">UPnP Info</th>
|
|
65
|
-
<td id="upnpInfo"></td>
|
|
66
|
-
</tr>
|
|
67
|
-
<tr>
|
|
68
|
-
<th scope="row">Serial Number</th>
|
|
69
|
-
<td id="serialNumber"></td>
|
|
70
|
-
</tr>
|
|
71
|
-
<tr>
|
|
72
|
-
<th scope="row">MAC Address</th>
|
|
73
|
-
<td id="macAddress"></td>
|
|
74
|
-
</tr>
|
|
75
|
-
<tr>
|
|
76
|
-
<th scope="row">Firmware</th>
|
|
77
|
-
<td id="firmware"></td>
|
|
78
|
-
</tr>
|
|
79
|
-
<tr>
|
|
80
|
-
<td colspan="2" style="text-align: center" id="imgIcon"></td>
|
|
81
|
-
</tr>
|
|
82
|
-
</tbody>
|
|
83
|
-
</table>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div id="pageSupport" class="mt-4" style="display: none;">
|
|
87
|
-
<p class="text-center lead">Thank you for using <strong>homebridge-Cmd4</strong></p>
|
|
88
|
-
<p class="text-center">The links below will take you to our GitHub wiki</p>
|
|
89
|
-
<h4>Setup</h4>
|
|
90
|
-
<ul>
|
|
91
|
-
<li>
|
|
92
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Installation" target="_blank"
|
|
93
|
-
>Installation</a
|
|
94
|
-
>
|
|
95
|
-
</li>
|
|
96
|
-
<li>
|
|
97
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Configuration" target="_blank"
|
|
98
|
-
>Configuration</a
|
|
99
|
-
>
|
|
100
|
-
</li>
|
|
101
|
-
<li>
|
|
102
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Beta-Version" target="_blank"
|
|
103
|
-
>Beta Version</a
|
|
104
|
-
>
|
|
105
|
-
</li>
|
|
106
|
-
<li>
|
|
107
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Node-Version" target="_blank"
|
|
108
|
-
>Node Version</a
|
|
109
|
-
>
|
|
110
|
-
</li>
|
|
111
|
-
<li>
|
|
112
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Uninstallation" target="_blank"
|
|
113
|
-
>Uninstallation</a
|
|
114
|
-
>
|
|
115
|
-
</li>
|
|
116
|
-
</ul>
|
|
117
|
-
<h4>Features</h4>
|
|
118
|
-
<ul>
|
|
119
|
-
<li>
|
|
120
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Supported-Devices" target="_blank"
|
|
121
|
-
>Supported Devices</a
|
|
122
|
-
>
|
|
123
|
-
</li>
|
|
124
|
-
</ul>
|
|
125
|
-
<h4>Help/About</h4>
|
|
126
|
-
<ul>
|
|
127
|
-
<li>
|
|
128
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Common-Errors" target="_blank"
|
|
129
|
-
>Common Errors</a
|
|
130
|
-
>
|
|
131
|
-
</li>
|
|
132
|
-
<li>
|
|
133
|
-
<a href="https://github.com/bwp91/homebridge-wemo/issues/new/choose" target="_blank"
|
|
134
|
-
>Support Request</a
|
|
135
|
-
>
|
|
136
|
-
</li>
|
|
137
|
-
<li>
|
|
138
|
-
<a href="https://github.com/bwp91/homebridge-wemo/blob/latest/CHANGELOG.md" target="_blank"
|
|
139
|
-
>Changelog</a
|
|
140
|
-
>
|
|
141
|
-
</li>
|
|
142
|
-
<li><a href="https://github.com/sponsors/bwp91" target="_blank">About Me</a></li>
|
|
143
|
-
</ul>
|
|
144
|
-
<h4>Credits</h4>
|
|
145
|
-
<ul>
|
|
146
|
-
<li>
|
|
147
|
-
To the creator of this plugin:
|
|
148
|
-
<a href="https://github.com/rudders" target="_blank">@rudders</a>, and to
|
|
149
|
-
<a href="https://github.com/devbobo" target="_blank">@devbobo</a> for his contributions.
|
|
150
|
-
</li>
|
|
151
|
-
<li>
|
|
152
|
-
To the creator of
|
|
153
|
-
<a href="https://github.com/timonreinhard/wemo-client" target="_blank">wemo-client</a> (which
|
|
154
|
-
is now contained within this plugin):
|
|
155
|
-
<a href="https://github.com/timonreinhard" target="_blank">@timonreinhard</a>.
|
|
156
|
-
</li>
|
|
157
|
-
<li>
|
|
158
|
-
To <a href="http://www.hardill.me.uk/wordpress/tag/wemo/" target="_blank">Ben Hardill</a> for
|
|
159
|
-
his research on Wemo devices.
|
|
160
|
-
</li>
|
|
161
|
-
<li>To all users who have helped/tested to enable functionality for new devices.</li>
|
|
162
|
-
<li>
|
|
163
|
-
To the creators/contributors of
|
|
164
|
-
<a href="https://github.com/simont77/fakegato-history" target="_blank">Fakegato</a>:
|
|
165
|
-
<a href="https://github.com/simont77" target="_blank">@simont77</a> and
|
|
166
|
-
<a href="https://github.com/NorthernMan54" target="_blank">@NorthernMan54</a>.
|
|
167
|
-
</li>
|
|
168
|
-
<li>
|
|
169
|
-
To the creator of the awesome plugin header logo:
|
|
170
|
-
<a href="https://www.instagram.com/keryan.me" target="_blank">Keryan Belahcene</a>.
|
|
171
|
-
</li>
|
|
172
|
-
<li>
|
|
173
|
-
To the creators/contributors of
|
|
174
|
-
<a href="https://homebridge.io" target="_blank">Homebridge</a> who make this plugin possible.
|
|
175
|
-
</li>
|
|
176
|
-
</ul>
|
|
177
|
-
<h4>Disclaimer</h4>
|
|
178
|
-
<ul>
|
|
179
|
-
<li>
|
|
180
|
-
I am in no way affiliated with Belkin/Wemo and this plugin is a personal project that I
|
|
181
|
-
maintain in my free time.
|
|
182
|
-
</li>
|
|
183
|
-
<li>Use this plugin entirely at your own risk - please see licence for more information.</li>
|
|
184
|
-
</ul>
|
|
185
|
-
</div>
|
|
186
|
-
|
|
187
|
-
<!-- Modules -->
|
|
188
|
-
<script type="text/javascript" src="js/modules/jquery.min.js"></script>
|
|
189
|
-
|
|
190
|
-
<!-- Custom Schema -->
|
|
191
|
-
<script type="text/javascript" src="js/schema.js?v=0.0.7"></script>
|
|
192
|
-
|
|
193
|
-
<!-- Main -->
|
|
194
|
-
<script type="text/javascript" src="js/wmain.js?v=0.0.7"></script>
|
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
<p class="text-center">
|
|
2
|
-
<img src="images/HB_Cmd4.png"
|
|
3
|
-
alt="Scripting with Cmd4 for Homebridge"
|
|
4
|
-
style="width: 60%;"
|
|
5
|
-
/>
|
|
6
|
-
</p>
|
|
7
|
-
<div id="pageIntro" class="text-center" style="display: none;">
|
|
8
|
-
<p class="lead">Thank you for Cmd4 <strong>homebridge-Cmd4</strong></p>
|
|
9
|
-
<p>Remember to click Save on the next page</p>
|
|
10
|
-
<button type="button" class="btn btn-primary" id="introContinue">Continue →</button>
|
|
11
|
-
</div>
|
|
12
|
-
<div
|
|
13
|
-
id="menuWrapper"
|
|
14
|
-
class="btn-group w-100 mb-0"
|
|
15
|
-
role="group"
|
|
16
|
-
aria-label="UI Menu"
|
|
17
|
-
style="display: none;"
|
|
18
|
-
>
|
|
19
|
-
<button type="button" class="btn btn-primary ml-0" id="menuSettings">Settings</button>
|
|
20
|
-
<button type="button" class="btn btn-primary" id="menuDevices">My Devices</button>
|
|
21
|
-
<button type="button" class="btn btn-primary mr-0" id="menuHome">Support</button>
|
|
22
|
-
</div>
|
|
23
|
-
<div
|
|
24
|
-
id="disabledBanner"
|
|
25
|
-
class="alert alert-secondary mb-0 mt-3"
|
|
26
|
-
role="alert"
|
|
27
|
-
style="display: none;"
|
|
28
|
-
>
|
|
29
|
-
Plugin is currently disabled
|
|
30
|
-
<button id="disabledEnable" type="button" class="btn btn-link p-0 m-0 float-right">Enable</button>
|
|
31
|
-
</div>
|
|
32
|
-
<div id="pageDevices" class="mt-4" style="display: none;">
|
|
33
|
-
<div id="deviceInfo">
|
|
34
|
-
<form>
|
|
35
|
-
<div class="form-group">
|
|
36
|
-
<select class="form-control" id="deviceSelect"></select>
|
|
37
|
-
</div>
|
|
38
|
-
</form>
|
|
39
|
-
<table class="table w-100" id="deviceTable" style="display: none;">
|
|
40
|
-
<thead>
|
|
41
|
-
<tr class="table-active">
|
|
42
|
-
<th scope="col" style="width: 40%;">Device Name</th>
|
|
43
|
-
<th scope="col" style="width: 60%;" id="displayName"></th>
|
|
44
|
-
</tr>
|
|
45
|
-
</thead>
|
|
46
|
-
<tbody>
|
|
47
|
-
<tr>
|
|
48
|
-
<th scope="row">HTTP Status</th>
|
|
49
|
-
<td id="http_status"></td>
|
|
50
|
-
</tr>
|
|
51
|
-
<tr>
|
|
52
|
-
<th scope="row">UPnP Status</th>
|
|
53
|
-
<td id="upnp_status"></td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr>
|
|
56
|
-
<th scope="row">IP Address</th>
|
|
57
|
-
<td id="ipAddress"></td>
|
|
58
|
-
</tr>
|
|
59
|
-
<tr>
|
|
60
|
-
<th scope="row">Port</th>
|
|
61
|
-
<td id="port"></td>
|
|
62
|
-
</tr>
|
|
63
|
-
<tr>
|
|
64
|
-
<th scope="row">UPnP Info</th>
|
|
65
|
-
<td id="upnpInfo"></td>
|
|
66
|
-
</tr>
|
|
67
|
-
<tr>
|
|
68
|
-
<th scope="row">Serial Number</th>
|
|
69
|
-
<td id="serialNumber"></td>
|
|
70
|
-
</tr>
|
|
71
|
-
<tr>
|
|
72
|
-
<th scope="row">MAC Address</th>
|
|
73
|
-
<td id="macAddress"></td>
|
|
74
|
-
</tr>
|
|
75
|
-
<tr>
|
|
76
|
-
<th scope="row">Firmware</th>
|
|
77
|
-
<td id="firmware"></td>
|
|
78
|
-
</tr>
|
|
79
|
-
<tr>
|
|
80
|
-
<td colspan="2" style="text-align: center" id="imgIcon"></td>
|
|
81
|
-
</tr>
|
|
82
|
-
</tbody>
|
|
83
|
-
</table>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
<div id="pageSupport" class="mt-4" style="display: none;">
|
|
87
|
-
<p class="text-center lead">Thank you for using <strong>homebridge-Cmd4</strong></p>
|
|
88
|
-
<p class="text-center">The links below will take you to our GitHub wiki</p>
|
|
89
|
-
<h4>Setup</h4>
|
|
90
|
-
<ul>
|
|
91
|
-
<li>
|
|
92
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Installation" target="_blank"
|
|
93
|
-
>Installation</a
|
|
94
|
-
>
|
|
95
|
-
</li>
|
|
96
|
-
<li>
|
|
97
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Configuration" target="_blank"
|
|
98
|
-
>Configuration</a
|
|
99
|
-
>
|
|
100
|
-
</li>
|
|
101
|
-
<li>
|
|
102
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Beta-Version" target="_blank"
|
|
103
|
-
>Beta Version</a
|
|
104
|
-
>
|
|
105
|
-
</li>
|
|
106
|
-
<li>
|
|
107
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Node-Version" target="_blank"
|
|
108
|
-
>Node Version</a
|
|
109
|
-
>
|
|
110
|
-
</li>
|
|
111
|
-
<li>
|
|
112
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Uninstallation" target="_blank"
|
|
113
|
-
>Uninstallation</a
|
|
114
|
-
>
|
|
115
|
-
</li>
|
|
116
|
-
</ul>
|
|
117
|
-
<h4>Features</h4>
|
|
118
|
-
<ul>
|
|
119
|
-
<li>
|
|
120
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Supported-Devices" target="_blank"
|
|
121
|
-
>Supported Devices</a
|
|
122
|
-
>
|
|
123
|
-
</li>
|
|
124
|
-
</ul>
|
|
125
|
-
<h4>Help/About</h4>
|
|
126
|
-
<ul>
|
|
127
|
-
<li>
|
|
128
|
-
<a href="https://github.com/bwp91/homebridge-wemo/wiki/Common-Errors" target="_blank"
|
|
129
|
-
>Common Errors</a
|
|
130
|
-
>
|
|
131
|
-
</li>
|
|
132
|
-
<li>
|
|
133
|
-
<a href="https://github.com/bwp91/homebridge-wemo/issues/new/choose" target="_blank"
|
|
134
|
-
>Support Request</a
|
|
135
|
-
>
|
|
136
|
-
</li>
|
|
137
|
-
<li>
|
|
138
|
-
<a href="https://github.com/bwp91/homebridge-wemo/blob/latest/CHANGELOG.md" target="_blank"
|
|
139
|
-
>Changelog</a
|
|
140
|
-
>
|
|
141
|
-
</li>
|
|
142
|
-
<li><a href="https://github.com/sponsors/bwp91" target="_blank">About Me</a></li>
|
|
143
|
-
</ul>
|
|
144
|
-
<h4>Credits</h4>
|
|
145
|
-
<ul>
|
|
146
|
-
<li>
|
|
147
|
-
To the creator of this plugin:
|
|
148
|
-
<a href="https://github.com/rudders" target="_blank">@rudders</a>, and to
|
|
149
|
-
<a href="https://github.com/devbobo" target="_blank">@devbobo</a> for his contributions.
|
|
150
|
-
</li>
|
|
151
|
-
<li>
|
|
152
|
-
To the creator of
|
|
153
|
-
<a href="https://github.com/timonreinhard/wemo-client" target="_blank">wemo-client</a> (which
|
|
154
|
-
is now contained within this plugin):
|
|
155
|
-
<a href="https://github.com/timonreinhard" target="_blank">@timonreinhard</a>.
|
|
156
|
-
</li>
|
|
157
|
-
<li>
|
|
158
|
-
To <a href="http://www.hardill.me.uk/wordpress/tag/wemo/" target="_blank">Ben Hardill</a> for
|
|
159
|
-
his research on Wemo devices.
|
|
160
|
-
</li>
|
|
161
|
-
<li>To all users who have helped/tested to enable functionality for new devices.</li>
|
|
162
|
-
<li>
|
|
163
|
-
To the creators/contributors of
|
|
164
|
-
<a href="https://github.com/simont77/fakegato-history" target="_blank">Fakegato</a>:
|
|
165
|
-
<a href="https://github.com/simont77" target="_blank">@simont77</a> and
|
|
166
|
-
<a href="https://github.com/NorthernMan54" target="_blank">@NorthernMan54</a>.
|
|
167
|
-
</li>
|
|
168
|
-
<li>
|
|
169
|
-
To the creator of the awesome plugin header logo:
|
|
170
|
-
<a href="https://www.instagram.com/keryan.me" target="_blank">Keryan Belahcene</a>.
|
|
171
|
-
</li>
|
|
172
|
-
<li>
|
|
173
|
-
To the creators/contributors of
|
|
174
|
-
<a href="https://homebridge.io" target="_blank">Homebridge</a> who make this plugin possible.
|
|
175
|
-
</li>
|
|
176
|
-
</ul>
|
|
177
|
-
<h4>Disclaimer</h4>
|
|
178
|
-
<ul>
|
|
179
|
-
<li>
|
|
180
|
-
I am in no way affiliated with Belkin/Wemo and this plugin is a personal project that I
|
|
181
|
-
maintain in my free time.
|
|
182
|
-
</li>
|
|
183
|
-
<li>Use this plugin entirely at your own risk - please see licence for more information.</li>
|
|
184
|
-
</ul>
|
|
185
|
-
</div>
|
|
186
|
-
<script>
|
|
187
|
-
;(async () => {
|
|
188
|
-
try {
|
|
189
|
-
const currentConfig = await homebridge.getPluginConfig()
|
|
190
|
-
showIntro = () => {
|
|
191
|
-
const introContinue = document.getElementById('introContinue')
|
|
192
|
-
introContinue.addEventListener('click', () => {
|
|
193
|
-
homebridge.showSpinner()
|
|
194
|
-
document.getElementById('pageIntro').style.display = 'none'
|
|
195
|
-
document.getElementById('menuWrapper').style.display = 'inline-flex'
|
|
196
|
-
showSettings()
|
|
197
|
-
homebridge.hideSpinner()
|
|
198
|
-
})
|
|
199
|
-
document.getElementById('pageIntro').style.display = 'block'
|
|
200
|
-
}
|
|
201
|
-
showDevices = async () => {
|
|
202
|
-
homebridge.showSpinner()
|
|
203
|
-
homebridge.hideSchemaForm()
|
|
204
|
-
document.getElementById('menuHome').classList.remove('btn-elegant')
|
|
205
|
-
document.getElementById('menuHome').classList.add('btn-primary')
|
|
206
|
-
document.getElementById('menuDevices').classList.add('btn-elegant')
|
|
207
|
-
document.getElementById('menuDevices').classList.remove('btn-primary')
|
|
208
|
-
document.getElementById('menuSettings').classList.remove('btn-elegant')
|
|
209
|
-
document.getElementById('menuSettings').classList.add('btn-primary')
|
|
210
|
-
document.getElementById('pageSupport').style.display = 'none'
|
|
211
|
-
document.getElementById('pageDevices').style.display = 'block'
|
|
212
|
-
const cachedAccessories =
|
|
213
|
-
typeof homebridge.getCachedAccessories === 'function'
|
|
214
|
-
? await homebridge.getCachedAccessories()
|
|
215
|
-
: await homebridge.request('/getCachedAccessories')
|
|
216
|
-
if (cachedAccessories.length > 0) {
|
|
217
|
-
cachedAccessories.sort((a, b) => {
|
|
218
|
-
return a.displayName.toLowerCase() > b.displayName.toLowerCase()
|
|
219
|
-
? 1
|
|
220
|
-
: b.displayName.toLowerCase() > a.displayName.toLowerCase()
|
|
221
|
-
? -1
|
|
222
|
-
: 0
|
|
223
|
-
})
|
|
224
|
-
}
|
|
225
|
-
const deviceSelect = document.getElementById('deviceSelect')
|
|
226
|
-
deviceSelect.innerHTML = ''
|
|
227
|
-
cachedAccessories.forEach(a => {
|
|
228
|
-
const option = document.createElement('option')
|
|
229
|
-
option.text = a.displayName
|
|
230
|
-
option.value = a.context.serialNumber
|
|
231
|
-
deviceSelect.add(option)
|
|
232
|
-
})
|
|
233
|
-
showDeviceInfo = async serialNumber => {
|
|
234
|
-
homebridge.showSpinner()
|
|
235
|
-
const thisAcc = cachedAccessories.find(x => x.context.serialNumber === serialNumber)
|
|
236
|
-
const context = thisAcc.context
|
|
237
|
-
document.getElementById('displayName').innerHTML = thisAcc.displayName
|
|
238
|
-
document.getElementById('http_status').innerHTML = context.httpOnline
|
|
239
|
-
? '<i class="fas fa-circle mr-1 green-text"></i> Yes'
|
|
240
|
-
: '<i class="fas fa-circle mr-1 red-text"></i> No'
|
|
241
|
-
document.getElementById('upnp_status').innerHTML = context.upnpOnline
|
|
242
|
-
? '<i class="fas fa-circle mr-1 green-text"></i> Yes'
|
|
243
|
-
: '<i class="fas fa-circle mr-1 red-text"></i> No'
|
|
244
|
-
document.getElementById('ipAddress').innerHTML = context.ipAddress || 'N/A'
|
|
245
|
-
document.getElementById('port').innerHTML = context.port || 'N/A'
|
|
246
|
-
document.getElementById('upnpInfo').innerHTML =
|
|
247
|
-
context.ipAddress && context.port
|
|
248
|
-
? '<a href="http://' +
|
|
249
|
-
context.ipAddress +
|
|
250
|
-
':' +
|
|
251
|
-
context.port +
|
|
252
|
-
'/setup.xml" target="_blank" class="primary-text">Visit XML →</a>'
|
|
253
|
-
: 'N/A'
|
|
254
|
-
document.getElementById('serialNumber').innerHTML = context.serialNumber || 'N/A'
|
|
255
|
-
document.getElementById('macAddress').innerHTML = context.macAddress || 'N/A'
|
|
256
|
-
document.getElementById('firmware').innerHTML = context.firmware || 'N/A'
|
|
257
|
-
document.getElementById('imgIcon').innerHTML =
|
|
258
|
-
context.icon && context.ipAddress && context.port
|
|
259
|
-
? '<img src="http://' +
|
|
260
|
-
context.ipAddress +
|
|
261
|
-
':' +
|
|
262
|
-
context.port +
|
|
263
|
-
'/' +
|
|
264
|
-
context.icon +
|
|
265
|
-
'" style="width: 150px;">'
|
|
266
|
-
: ''
|
|
267
|
-
document.getElementById('deviceTable').style.display = 'inline-table'
|
|
268
|
-
homebridge.hideSpinner()
|
|
269
|
-
}
|
|
270
|
-
deviceSelect.addEventListener('change', event => showDeviceInfo(event.target.value))
|
|
271
|
-
if (cachedAccessories.length > 0) {
|
|
272
|
-
showDeviceInfo(cachedAccessories[0].context.serialNumber)
|
|
273
|
-
} else {
|
|
274
|
-
const option = document.createElement('option')
|
|
275
|
-
option.text = 'No Devices'
|
|
276
|
-
deviceSelect.add(option)
|
|
277
|
-
deviceSelect.disabled = true
|
|
278
|
-
}
|
|
279
|
-
homebridge.hideSpinner()
|
|
280
|
-
}
|
|
281
|
-
showSupport = () => {
|
|
282
|
-
homebridge.showSpinner()
|
|
283
|
-
homebridge.hideSchemaForm()
|
|
284
|
-
document.getElementById('menuHome').classList.add('btn-elegant')
|
|
285
|
-
document.getElementById('menuHome').classList.remove('btn-primary')
|
|
286
|
-
document.getElementById('menuDevices').classList.remove('btn-elegant')
|
|
287
|
-
document.getElementById('menuDevices').classList.add('btn-primary')
|
|
288
|
-
document.getElementById('menuSettings').classList.remove('btn-elegant')
|
|
289
|
-
document.getElementById('menuSettings').classList.add('btn-primary')
|
|
290
|
-
document.getElementById('pageSupport').style.display = 'block'
|
|
291
|
-
document.getElementById('pageDevices').style.display = 'none'
|
|
292
|
-
homebridge.hideSpinner()
|
|
293
|
-
}
|
|
294
|
-
showSettings = () => {
|
|
295
|
-
homebridge.showSpinner()
|
|
296
|
-
document.getElementById('menuHome').classList.remove('btn-elegant')
|
|
297
|
-
document.getElementById('menuHome').classList.add('btn-primary')
|
|
298
|
-
document.getElementById('menuDevices').classList.remove('btn-elegant')
|
|
299
|
-
document.getElementById('menuDevices').classList.add('btn-primary')
|
|
300
|
-
document.getElementById('menuSettings').classList.add('btn-elegant')
|
|
301
|
-
document.getElementById('menuSettings').classList.remove('btn-primary')
|
|
302
|
-
document.getElementById('pageSupport').style.display = 'none'
|
|
303
|
-
document.getElementById('pageDevices').style.display = 'none'
|
|
304
|
-
homebridge.showSchemaForm()
|
|
305
|
-
homebridge.hideSpinner()
|
|
306
|
-
}
|
|
307
|
-
showDisabledBanner = () => {
|
|
308
|
-
document.getElementById('disabledBanner').style.display = 'block'
|
|
309
|
-
}
|
|
310
|
-
enablePlugin = async () => {
|
|
311
|
-
homebridge.showSpinner()
|
|
312
|
-
document.getElementById('disabledBanner').style.display = 'none'
|
|
313
|
-
currentConfig[0].disablePlugin = false
|
|
314
|
-
await homebridge.updatePluginConfig(currentConfig)
|
|
315
|
-
await homebridge.savePluginConfig()
|
|
316
|
-
homebridge.hideSpinner()
|
|
317
|
-
}
|
|
318
|
-
menuHome.addEventListener('click', () => showSupport())
|
|
319
|
-
menuDevices.addEventListener('click', () => showDevices())
|
|
320
|
-
menuSettings.addEventListener('click', () => showSettings())
|
|
321
|
-
disabledEnable.addEventListener('click', () => enablePlugin())
|
|
322
|
-
if (currentConfig.length) {
|
|
323
|
-
document.getElementById('menuWrapper').style.display = 'inline-flex'
|
|
324
|
-
showSettings()
|
|
325
|
-
if (currentConfig[0].disablePlugin) {
|
|
326
|
-
showDisabledBanner()
|
|
327
|
-
}
|
|
328
|
-
} else {
|
|
329
|
-
currentConfig.push({ name: 'Cmd4' })
|
|
330
|
-
await homebridge.updatePluginConfig(currentConfig)
|
|
331
|
-
showIntro()
|
|
332
|
-
}
|
|
333
|
-
} catch (err) {
|
|
334
|
-
homebridge.toast.error(err.message, 'Error')
|
|
335
|
-
} finally {
|
|
336
|
-
homebridge.hideSpinner()
|
|
337
|
-
}
|
|
338
|
-
})()
|
|
339
|
-
</script>
|