-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
439 lines (411 loc) · 20.1 KB
/
Copy pathindex.html
File metadata and controls
439 lines (411 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Sony Bravia TV Web Remote</title>
<meta name="description" content="Send commands to a Sony Bravia TV from a web page.">
<meta name="author" content="Melvin Tan">
<link rel="stylesheet" href="sony-tv.css">
<!-- Mobile Specific Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0">
<link rel="apple-touch-icon" href="./images/120.png">
<link rel="manifest" href="manifest.json">
<link rel="icon" type="image/png" href="images/128.png">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
<br>
<!-- =================================================================
Sony TV Web Page Remote
Uses Sony Bravia TV IRCC (IR like control commands) sent using HTTP POST.
This web page used the script file to display a set of buttons that
when clicked send a command to the TV.
Since this has to send a Javascript request to a different IP address,
it MAY run afoul of same origin policy restrictions. But there seem to be
edge conditions if the web page is saved locally and accessed using
file:// URL which then uses Javascript to POST to http:// URL, it works
fine in latest Chrome, Firefox (Jan 2017).
In any case, if that fails, here are the options:
1: Change this script to use node.js or server side scripting which
does not run afoul of same origin policy.
2: Load this as a Web Extension which asks for permissions to access
remote URLs, so avoids cross origin policy cross-domain restrictions.
Works on Chrome, Firefox, Edge.
Requires Javascript ES2015 (ES6). Works with most browsers in 2020.
Uses localStorage, for of loop, etc.
There are a number of similar tools available - from command line
scripts to server side Javascript. Use a web search such as "Sony
TV IRCC" to find references.
================================================================= -->
<ul class="tabs-navigation">
<!-- id of links must be same id as tab, with -link replaced by -content.
Ex: tab-buttons-link and tab-buttons-content -->
<li class="tab-link" id="tab-buttons-link"><a>Remote</a> </li>
<li class="tab-link" id="tab-setup-link"><a>TV Setup</a> </li>
<li class="tab-link" id="tab-help-link"><a>Help</a> </li>
</ul>
<!-- display error/status messages on a popup, usually centered on browser page using css -->
<div class="popup-text hide-initial" id="popup-text">Sony TV Remote Control</div>
<br>
<div class="tabs-all-content">
<div class="tab-content" id="tab-buttons-content">
<!-- Power -->
<div class="columns" id="tv-power">
<div class="one-third-item">
<button type="button" class="tv-command btn_settings" data-stv.commands="ActionMenu"><i
class="material-icons">settings</i></button>
</div>
<div class="one-third-item">
<div class="brand_name">SONY</div>
<div class="equipment_name">TV</div>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_power" data-stv.commands="TvPower"><i
class="material-icons">power_settings_new</i></button>
</div>
</div>
<div class="hr"></div>
<!-- Input -->
<div class="columns" id="tv-input">
<div class="one-fourth-item">
<button type="button" class="tv-command btn_input" data-stv.commands="Hdmi1">HDMI 1</button>
</div>
<div class="one-fourth-item">
<button type="button" class="tv-command btn_input" data-stv.commands="Hdmi2">HDMI 2</button>
</div>
<div class="one-fourth-item">
<button type="button" class="tv-command btn_input" data-stv.commands="Hdmi3">HDMI 3</button>
</div>
<div class="one-fourth-item">
<button type="button" class="tv-command btn_input" data-stv.commands="Hdmi4">HDMI 4</button>
</div>
</div>
<div class="hr"></div>
<!-- Smart TV -->
<div class="columns" id="tv-input-apps">
<div class="one-half-item">
<button type="button" class="tv-command btn_googletv" data-stv.commands="Home"><i
class="material-icons">bubble_chart</i>Google TV</button>
</div>
<div class="one-half-item">
<button type="button" class="tv-command btn_netflix" data-stv.commands="Netflix">NETFLIX</button>
</div>
</div>
<div class="hr"></div>
<!-- Volume -->
<div class="columns" id="tv-vol-ch">
<div class="one-third-item">
<span>VOL</span>
</div>
<div class="one-third-item">
</div>
<div class="one-third-item">
<span>CH</span>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_vol_ch" data-stv.commands="VolumeUp"><i
class="material-icons">volume_up</i></button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_vol_ch" data-stv.commands="ChannelUp"><i
class="material-icons">add</i></button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_mute" data-stv.commands="Mute"><i
class="material-icons">volume_off</i></button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_vol_ch" data-stv.commands="VolumeDown"><i
class="material-icons">volume_down</i></button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_vol_ch" data-stv.commands="ChannelDown"><i
class="material-icons">remove</i></button>
</div>
</div>
<div class="hr"></div>
<!-- Joystick -->
<div class="columns" id="tv-joystick">
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_joystick_arrow" data-stv.commands="Up"><i
class="material-icons">keyboard_arrow_up</i></button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item-right">
<button type="button" class="tv-command btn_joystick_arrow" data-stv.commands="Left"><i
class="material-icons">keyboard_arrow_left</i></button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_joystick_center" data-stv.commands="DpadCenter"><i
class="material-icons">blur_on</i></button>
</div>
<div class="one-third-item-left">
<button type="button" class="tv-command btn_joystick_arrow" data-stv.commands="Right"><i
class="material-icons">keyboard_arrow_right</i></button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_joystick_arrow" data-stv.commands="Down"><i
class="material-icons">keyboard_arrow_down</i></button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_back" data-stv.commands="Return">BACK</button>
</div>
<div class="one-third-item"></div>
<div class="one-third-item">
<button type="button" class="tv-command btn_tv" data-stv.commands="Tv">EXIT</button>
</div>
</div>
<div class="hr"></div>
<!-- Numbers -->
<div class="columns" id="tv-numbers-row">
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num1">1</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num2">2</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num3">3</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num4">4</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num5">5</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num6">6</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num7">7</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num8">8</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num9">9</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers " data-stv.commands="DOT">.</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_numbers" data-stv.commands="Num2">0</button>
</div>
<div class="one-third-item">
<button type="button" class="tv-command btn_display" data-stv.commands="Display">DISPLAY</button>
</div>
</div>
<div class="hr"></div>
<!-- Playback Controls -->
<div class="columns" id="tv-ffrw">
<div class="one-fourth-item">
<button type="button" class="tv-command btn_playback" data-stv.commands="Rewind"><i
class="material-icons">fast_rewind</i></button>
</div>
<div class="one-fourth-item">
<button type="button" class="tv-command btn_playback" data-stv.commands="Play"><i
class="material-icons">play_arrow</i></button>
</div>
<div class="one-fourth-item">
<button type="button" class="tv-command btn_playback" data-stv.commands="Forward"><i
class="material-icons">fast_forward</i></button>
</div>
<div class="one-fourth-item">
<button type="button" class="tv-command btn_playback" data-stv.commands="Pause"><i
class="material-icons">pause</i></button>
</div>
<div class="one-fourth-item"><button type="button" class="tv-command btn_playback" data-stv.commands="Prev"><i
class="material-icons">skip_previous</i></button></div>
<div class="one-fourth-item">
<button type="button" class="tv-command btn_playback" data-stv.commands="Stop"><i
class="material-icons">stop</i></button>
</div>
<div class="one-fourth-item"><button type="button" class="tv-command btn_playback" data-stv.commands="Next"><i
class="material-icons">skip_next</i></button></div>
<div class="one-fourth-item"></div>
</div>
<div class="hr"></div>
<!-- Frequently Used -->
<div class="columns" id="tv-volume">
<!-- Command input text box -->
<form id="tv-command-input">
<!-- put content one-fourth-item inside form otherwise fieldset border has too much
padding on right, and border around fieldset looks weird -->
<div class="one-fourth-item">
<fieldset>
<input type="text" id="tv-input-1" autocorrect="off" autocapitalize="none" spellcheck="false"
placeholder="Ex: 7.1">
<button type="submit" class="tv-command btn_send">Send</button>
</fieldset>
</div>
</form>
</div>
<div class="hr"></div>
<!-- Command input text box
<form id="tv-command-input">
<fieldset>
<legend>Type-in Commands</legend>
<input type="text" id="tv-input-1" autocorrect="off" autocapitalize="none" spellcheck="false" placeholder="Example: 7.1">
<button type="submit" class="tv-command">Send</button>
</fieldset>
</form>
<hr>
-->
<!-- Channel Numbers / Custom Buttons -->
<!-- these child elements are dynamically created based on user setup options -->
<div class="columns" id="tv-channel-numbers">
</div>
<br><br>
<br><br>
</div>
<!-- tab-buttons-content -->
<!-- Setup -->
<div class="tab-content" id="tab-setup-content">
<h2>TV Setup</h2>
<form id="tv-setup">
<fieldset>
<p>
<label for="tv-ip-address">Sony TV IP Address</label>
<input type="text" id="tv-ip-address" autocorrect="off" autocapitalize="none" spellcheck="false"
placeholder="Example: 10.0.0.108">
</p>
<p>
<label for="tv-key">Sony TV Pre-Shared Key</label>
<input type="text" id="tv-key" autocorrect="off" autocapitalize="none" spellcheck="false"
placeholder="Example: 6708">
</p>
<p>
<label for="make-custom-buttons">Custom Command : Channel Name
<textarea id="make-custom-buttons" autocorrect="off" autocapitalize="none" spellcheck="false"
rows="14"></textarea>
</label>
</p>
<button type="submit">Save</button>
</fieldset>
</form>
<p class="messages"></p>
<!-- Javascript error or status message -->
</div>
<!-- Help and About -->
<div class="tab-content" id="tab-help-content">
<h2>About</h2>
<h3>Sony TV Web Page Remote Control</h3>
<p> Version: <span id="about-version">1.4 (2020-Oct)</span>
<br>Homepage: <a href="http://www.aczoom.com/tech/sony-tv-remote/">aczoom.com/tech/sony-tv-remote/</a>
</p>
<h2>Help</h2>
<p>For details on how this works, the best choice is looking at the source code: <a
href="https://github.com/avinash311/sony-tv-remote">Sony TV Web Page Remote source code</a>.
<p>Using this requires the TV to support IRCC control
(Sony Bravia TV IR (infrared)-like-control-commands), have a fixed IP
address, and allow remote access using a pre-shared key.
<br> 2016 or later Sony Bravia TVs should all have this support.
</p>
<p>Power On from this page will only work if the TV Power Eco mode
allows it. The Bravia TV Settings for Power can be changed if needed.
Otherwise, use the physical remote to turn on the TV and then all
these web commands will work.</p>
<h2>Setup</h2>
<p>Click on the <code>Setup</code> tab and fill in all the fields in there.</p>
<p>Do this using the TV: Set pre-shared key on your TV:
<code>[Settings] [Network] [Home Network Setup] [IP Control] [Pre-Shared Key]</code>
<br> Set [Authentication] to [Normal and Pre-Shared Key]
<p>If the TV IP address is not fixed, give your TV a static IP address or make a DHCP reservation for a specific
IP address in your router.</p>
<p>Enter the list of over-the-air channels or TV commands you want direct access to on the
<code>Buttons</code> tab.
<br> This will create a button for each command string. Individual command names
can be found by querying the TV, see the section <a href="#tv-commands">TV commands</a>
in this document.
<br> Each button should be defined on a single line. Example format is:
</p>
<pre>
2.1 Enter : PBS 2
4.1 Enter : CBS 4
4.1 Enter : CBS 4
Netflix Confirm : Netflix
TvInput Confirm : TV
...
</pre>
<p>Where the <code> : </code> (space colon space) separates the TV commands
number from the button name. A channel number can also be used as a command.<br>
<br> This will create a button for each channel or command.
</p>
<p>After all data is entered, click Save.
<br> Once that is done, the buttons on the page can be used to send commands.
</p>
<p>
All data is saved locally, there is no information sent back to the web server.
<br> This maintains user privacy. The data is stored by the local browser, so it can
reload the data when it is restarted. It also means that each time a different browser
is used, or a browser on a different device, the setup information needs to be
re-entered.
</p>
<h2>Troubleshooting</h2>
<p>The Javascript code prints out status and error messages to the Javascript Console.
Some messages will also be shown on the web page as a popup for a few seconds, such
as when the Setup tab <code>Save</code> button is clicked, or if there is an error
sending the remote control command when a button is clicked.
<br> To see the messages, open up your browser's Developer Tools or similar to see the Console messages.
<br> For example, in Firefox or Chrome, type <code>Control-Shift-J</code> or in Firefox:
click on <code>[Menu] [Developer] [Browser console]</code> to open the Console
and look at the JS (Javascript) Tab to see messages from this script.
</p>
<p> Since this web page (and the Javascript code it uses) needs to connect to the TV,
this will only work if your web browser is able to access both this web page and
your TV.
<br> The web browser can be on a computer, a smartphone, or a tablet.
<a href="http://www.aczoom.com/tools/sony-tv-remote/sony-tv.html">online
Sony TV Web Remote at aczoom.com</a>.
</p>
<p> If the On button is not working from this web page, it indicates that the TV
has some power saving mode set. In this case, change the [Settings] [Power] Eco
mode using the TV remote.
Or always use the physical remote to turn on the TV.
<br> See this message thread for the issue related to WOL messages:
<a href="https://github.com/avinash311/sony-tv-remote/issues/1">TVPower
does not work</a>.
</p>
<p>If more customization of the Buttons page is needed, the entire source code
for this package is available for local download and editing. This may be useful
if you wish to hardcode the Setup details on the web page, so everyone in your
household can visit your modified web page and immediately start using the buttons.
<br> Download source code and web page as a ZIP archive: <a
href="https://github.com/avinash311/sony-tv-remote/archive/master.zip">sony-tv-remote-master.zip</a> and
unpack
it locally. Rename the folder if needed, and edit the HTML or Javascript files.
Then load the <code>sony-tv.html</code> in your browser (Firefox or Chrome only).
</p>
<p>For additional details, visit the home page and the source codes, available at:
<br> Browse source code online: <a href="https://github.com/avinash311/sony-tv-remote">Sony TV Web Page Remote
source code</a>
</p>
<a name="tv-commands">
<h2>TV Info (Commands)</h2>
</a>
<p>Here's a way to see all the Command names and IRCC codes supported by the TV.
It seems all Sony Bravia TVs return the same set of codes. This can be used to
confirm it, if needed by comparing this output to the COMMAND_MAP Javascript variable in the
code. This button works even if the TV is off (as long as it is plugged in). The entries
such as <code>{"name":"Hdmi2","value":"AAAAAgAAABoAAABbAw=="}</code> show the command name
and the value which indicates the IRCC code.
</p>
<p>In addition the commands here, this interface also accepts channel numbers as commands
such as <em>38.1</em> and such.</p>
<div id="controller-info">
<button type="button" id="controller-info-button">Get TV Remote Controller Info</button>
<div id="controller-info-output">(Remote Controller Info will show up here.)</div>
</div>
</div> <!-- tab-help-content -->
</div> <!-- tabs-all-content -->
<!-- End Document =============================================== -->
<script src="sony-tv.js"></script>
</body>
</html>