Scripts that I created to enhance the Hyperion experience. You can also read this in Italiano:it:
Table of Contents (click to expand)
- 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).
- 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.sh
script:
cd ~/ultimate-ambilight-setup/
sudo chmod 775 install.sh
sudo ./install.sh
- You can decide what to install/reinstall using the
-a
,-b
,-c
and-f
arguments (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
.
You can change any configuration value after the installation process. If you do, please remember to reboot your device afterwards
sudo reboot
- Open the
clock.json
file:
sudo nano ~/ultimate-ambilight-setup/Hyperion_effects/clock.json
- Get your OpenWeatherMap API key
- Modify the
owmAPIkey
value pasting your API key (you can use the same API key in the Kodi Weather app btw) - Get your coordinates
- Modify both
latitude
andlongitude
values pasting your own latitude and longitude - Modify the
offset
value to match your LED setup - Modify the
direction
value 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 + X
and closeEnter
the file - If you want to modify the
clock.json
file 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)
- Open the
buttons.json
file:
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.json
file. - Modify the
short-press
andlong-press
values 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, ornull
to 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-mode
value to match the pin numbering you're using ("BCM"/"BOARD") - Save
Ctrl + X
and closeEnter
the file
- Open the
fan.json
file:
nano ~/ultimate-ambilight-setup/Raspberry-Pi-PWM-fan/fan.json
- Modify the
pin
value to match your GPIO setup - Modify the
gpio-mode
value 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 + X
and closeEnter
the file
- Open the
client.json
file:
nano ~/ultimate-ambilight-setup/hyperion-mqtt-subscriber/client.json
- Modify the
ip_address
value of thehyperion_server
to 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
port
value 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
username
andkey
values of themqtt_broker
to match your Adafruit-IO username and AIO key - Modify the
effect-topic
value of themqtt_broker
to match the name of your Adafruit-IO "effect launching" topic - Modify the
color-topic
value of themqtt_broker
to match the name of your Adafruit-IO "color launching" topic - Modify the
misc-topic
value of themqtt_broker
to match the name of your Adafruit-IO "miscellaneous" topic - Modify the
ip_address
value of thekodi_server
to 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_uri
value of thekodi_server
to 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_key
value with the Yandex API key. Simply set this value as blank (""
) if you use English as main language - Modify the
from_language
value 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 + X
and closeEnter
the file
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-topic
earlier) - to the "color launching" topic (the same topic assigned to
color-topic
earlier) - to the "miscellaneous" topic (the same topic assigned to
misc-topic
earlier)OFF
in order to turn any effect/color off (goes back to capture mode)ON
in order to turn on the lights with white color (custom action)PLAY
in order to play the video fromvideo_uri
while turning any effect off (goes back to capture mode)STOP
in 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.
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
Please see CONTRIBUTING.md.
Major dependencies:
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.
- 06/09/2018 - 0.1.0 - beta release