This page is a supplement to our tutorial on using a TV as a Tune-To Sign. It will also help you if you have general questions on how to create a script file and run it in FPP.
Various tasks can be automated within FPP to allow the show to do anything from emailing you when it starts/stops to turning on/off various devices. Here I will show how you can create a scrip file to automatically turn on/off a TV connected to a Pi. This can be used as a tune-to sign with video. To turn the TV on/off it assumes you have installed the CEC utilities on the Pi. This can be done by typing the following command in the SSH Shell:
sudo apt-get install cec-utils
Creating a scrip file
To create a scrip file, simply open notepad or any other text editor and add in the details of the script. For the turn on and off scripts there are only 2 lines. The turn on file is the following two lines. Once you have put them in, save the file and then change the extension from .txt to .sh You will now have a file titled filename1.sh
#!/bin/sh echo on 0 | cec-client -s -d 1
Creating the Turn off file is the same, and it will be saved as filename2.sh
#!/bin/sh echo standby 0 | cec-client -s -d 1
Loading the script file for use in FPP
You will now have 2 files (filename1.sh and filename2.sh) that are ready to be loaded to FPP. Log into your web interface and go to content setup > File Manager. Upload your two script files and navigate to content setup > playlists to use them to automate the power on and off of the TV.
Running the script file in FPP
Under Type in Playlist entry select script and then select the script you want to use. I put the “turn on” script in the lead in and right before each of the video files in the main playlist area. That way if for any reason the TV gets turned off, it will turn right back on again. I then put the “turn off” script in the lead out section. This will make sure that it turns off at the end of the night.
Notes to keep in mind:
- Be sure that you remove the .txt from your files you create. Otherwise they will not work. You can rename them in FPP if needed
- You must enable CEC in your TV for this to work. If available on your TV it will be on the TV under the settings. Sometimes it is shown as auto power on, HDMI control, or other names.
- If you wipe your SD card to rebuild FPP you will need to reinstall the CEC utilites listed above
- Contact us here if you have other questions!