Example TV Server script: Scheduling TVs to turn off via RS-232

The IPTV 250m set-top box receiver can be used to send RS-232 commands to an attached screen via optional Encoded Media USB to RS-232 cable.

This KB Article details an example script which triggers the TV Server appliance to connect with every set-top box connected to it, and then have each box send the required RS-232 commands to power off an attached screen at a predetermined time.

This is an advanced topic! It is intended for system administrators only.

The commands in the example script are specific to NEC MultiSync LCD4020 and LCD4620 displays, but can be adapted to suit any RS-232 compatible TV or panel by modifying the sequence of commands sent.

Though scripts are tested extensively, the downloading of example code either in whole or in part is done so entirely at your own risk. Encoded Media cannot accept responsibility for errors, omissions or unwanted behaviour arising from your use of example code.

The steps to initiate the script are as follows:

  1. Download the plain text file attached to this message.  Edit the HOUR_ON and HOUR_OFF values to reflect the hour of day during which you wish the commands to be sent.
  2. Access your TV Server console.
  3. Select Maintenance (5), then Advanced (4), then Launch Command Shell (3)
  4. Add a new hourly cron job by running the following command at the prompt:
  5. pico /etc/cron.hourly/rs232
    	
  6. Paste the contents of the text file you downloaded earlier and save the job by pressing CTRL+X followed by pressing Y to confirm.
  7. Now make the script file executable with the following command:
  8. chmod a+x /etc/cron.hourly/rs232
    	
  9. Next, edit crontab by running the following command at the prompt:
  10. pico /etc/crontab
    	
  11. Now edit the following line so that the first column is as follows:
  12. 0 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
    	

    The number in the first column denotes the minutes past the hour at which the job will run. In the line provided above the job runs on the hour, every hour. For testing purposes, you can alter this number to trigger sooner.

  13. Save your new configuration by pressing CTRL+X followed by pressing Y to confirm.

* If you do not know the root password for the IPTV 250m set-top box, please raise a support ticket with Encoded Media by emailing  support@encodedmedia.com

Example Scripts

Example: connect to STB and run RS232 commands

Example: connect to all recent STBs, ignore any with "demo_unit" and change the channel to #3

Example: connect to STBs and run an STB command

Example: connect to STBs and change channel