ultimate-ambilight-setup
ultimate-ambilight-setup copied to clipboard
Scripts created to enhance the Hyperion experience on a Raspberry Pi setup. π
Scripts that I created to enhance the Hyperion experience. You can also read this in Italiano:it:
π Getting started
Table of Contents (click to expand)
- Getting started
- Installation
- Configuration
- Usage
- Resources
- Contributing
- Credits
- Support Me!
- FAQ
- Release History
- License
Requirements
- A Raspberry Pi 2, or higher
- A microSD card with an OS already up and running (OSMC is suggested)
Make sure you have Hyperion installed and configured (installation and configuration via HyperCon is suggested).
πΎ Installation
- Open a terminal window on your Raspberry Pi or connect via SSH (use the Terminal app on MacOS/Linux, or download PuTTY on Windows) and run this command to clone this repository on your device:
cd ~/ && sudo apt-get install git && git clone https://github.com/JFtechOfficial/ultimate-ambilight-setup.git
-
If you want you can pre-configure the Hyperion effects and buttons script. You can find them in the following directories:
Hyperion_effects,buttons. -
Run the
install.shscript:
cd ~/ultimate-ambilight-setup/
sudo chmod 775 install.sh
sudo ./install.sh
- You can decide what to install/reinstall using the
-a,-b,-cand-farguments (no custom installation arguments means "install everything").
Options:
General options:
-h --help Show this screen.
-v --version Show version.
Custom installation options:
-a --assistant Install Google Assistant script.
-b --buttons Install buttons script.
-c --clock Install clock effect.
-f --fan Install fan script.
- You now may configure any .json files, including the ones for the Google Assistant script and the fan script. You can find them in the following directories:
hyperion-mqtt-subscriber,Raspberry-Pi-PWM-fan.
βοΈ Configuration
You can change any configuration value after the installation process. If you do, please remember to reboot your device afterwards
sudo reboot
Clock Effect
- Open the
clock.jsonfile:
sudo nano ~/ultimate-ambilight-setup/Hyperion_effects/clock.json
- Get your OpenWeatherMap API key
- Modify the
owmAPIkeyvalue pasting your API key (you can use the same API key in the Kodi Weather app btw) - Get your coordinates
- Modify both
latitudeandlongitudevalues pasting your own latitude and longitude - Modify the
offsetvalue to match your LED setup - Modify the
directionvalue to match your LED setup (0-> clockwise,1-> counterclockwise) - You can modify the default colors and widths of the "virutal" clock hands and/or add markers
- Save
Ctrl + Xand closeEnterthe file - If you want to modify the
clock.jsonfile AFTER the installation you can find it in the Hyperion effects directory:
sudo nano /usr/share/hyperion/effects/clock.json
(example with the default path)
Buttons
- Open the
buttons.jsonfile:
nano ~/ultimate-ambilight-setup/buttons/buttons.json
- Modify the pins values to match your GPIO setup. AVOID using pin 5 (BOARD) a.k.a. GPIO 3 (BCM) for anything else than the power button: it's been hardcoded for you in this way and it cannot be changed for hardware related reasons. You DO NOT need to configure it in the
buttons.jsonfile. - Modify the
short-pressandlong-pressvalues for each pin. You can assign an effect name (e.g."Rainbow swirl") to launch the effect, an RGB value (e.g.[255,0,0]) to launch the resulting color, the string"clear"to go back to the default capture mode, ornullto do nothing.
I suggest you not modify:
{
"short-press" : "clear",
"long-press" : [0,0,0]
}
- You can add as many buttons as you want by pasting (and configuring) the following code after
gpio-setup: {:
"Pin number" :
{
"short-press" : "effect name"/[255,255,255]/null,
"long-press" : "effect name"/[255,255,255]/null
},
- Modify the
gpio-modevalue to match the pin numbering you're using ("BCM"/"BOARD") - Save
Ctrl + Xand closeEnterthe file
Fan
- Open the
fan.jsonfile:
nano ~/ultimate-ambilight-setup/Raspberry-Pi-PWM-fan/fan.json
- Modify the
pinvalue to match your GPIO setup - Modify the
gpio-modevalue to match the pin numbering you're using ("BCM"/"BOARD") - You can modify the other values to make sure your fan is working as intended
- Save
Ctrl + Xand closeEnterthe file
Google Assistant
- Open the
client.jsonfile:
nano ~/ultimate-ambilight-setup/hyperion-mqtt-subscriber/client.json
- Modify the
ip_addressvalue of thehyperion_serverto match the IP address of the device running Hyperion ("127.0.0.1" if it's the same device running this script) - If you used a different port you can modify the default
portvalue of thehyperion_server - Create an Adafruit-IO account
- Create an "effect launching" topic, a "color launching" topic and an "effect clearing" topic (Feeds)
- Modify the
usernameandkeyvalues of themqtt_brokerto match your Adafruit-IO username and AIO key - Modify the
effect-topicvalue of themqtt_brokerto match the name of your Adafruit-IO "effect launching" topic - Modify the
color-topicvalue of themqtt_brokerto match the name of your Adafruit-IO "color launching" topic - Modify the
misc-topicvalue of themqtt_brokerto match the name of your Adafruit-IO "miscellaneous" topic - Modify the
ip_addressvalue of thekodi_serverto match the IP address of the device running Kodi ("127.0.0.1" if it's the same device running this script) - Modify the
video_urivalue of thekodi_serverto the local path or internet link of the video you want to play (supported: YouTube, Dropbox, Flickr, GoogleDrive, Reddit, Twitch:video, Vimeo, VK and many more) - Get your Yandex API key. Skip this step if you use English as main language
- Modify the
API_keyvalue with the Yandex API key. Simply set this value as blank ("") if you use English as main language - Modify the
from_languagevalue to match your language - You can add custom actions by pasting the following code after
"custom_actions": [:
{
"message": "your_message",
"target": "effect name"/[255,255,255]/"clear"/null
},
- Save
Ctrl + Xand closeEnterthe file
βΆοΈ Usage
Use your favorite Hyperion client to select and run the clock effect: the second hand has a warmer color when outside is hot and it has a colder color when outside is cold.
Use buttons connected to the GPIO to launch effects or color, to go back to the capture mode, turn on or safely turn off the Raspberry Pi. You can trigger different functions by pressing and long-pressing the buttons.
Use a fan connected to the GPIO: it will automatically start to spin and cool down the system varing its speed depending on the Rasperry Pi's CPU temperature.
Use IFTTT to interface Google Assistant with the Adafruit-IO mqtt broker. You can send:
- to the "effect launching" topic (the same topic assigned to
effect-topicearlier) - to the "color launching" topic (the same topic assigned to
color-topicearlier) - to the "miscellaneous" topic (the same topic assigned to
misc-topicearlier)OFFin order to turn any effect/color off (goes back to capture mode)ONin order to turn on the lights with white color (custom action)PLAYin order to play the video fromvideo_uriwhile turning any effect off (goes back to capture mode)STOPin order to stop any video (goes back to capture mode)
Now you can use the Google Assistant on your smartphone/tablet/Google Home to tell Hyperion what to do.
π Resources
Here is a step-by-step video guide about how to build the ultimate Ambilight setup (ITA):
You can also check the wiki
The hyperion.config.json file is an example of a working configuration file for Hyperion (generated via HyperCon)
Please visit the hyperion-project website to learn more about Hyperion
π Contributing
Please see CONTRIBUTING.md.
β€οΈ Credits
Major dependencies:
π΅ Support Me!
π FAQ
Can I use the same GPIO pin for the configuration of two different scripts?
No. You should never use the same pin for different tasks at the same time (e.g. controlling the fan and reading the state of a button from the same pin at the same time will not work and could break your Raspberry Pi).
Can I install the Google Assistant client script on a Raspberry Pi different from the one running Hyperion?
Yes. You can run it on any unix machine connected to the same local network: it will send commands to the Raspberry Pi that runs Hyperion. The fan script, buttons script and the clock effect cannot be used in the same way: you must install them on the machine that you intend to use them on.
What about the Raspberry Pi Foundation TV Β΅HAT?
I don't think I'll ever use one, IPTV is good enough imho.
ποΈ Release History
- 06/09/2018 - 0.1.0 - beta release


