[{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eEver wanted to have your space sound like the engineering department of the Enterprise D? Maybe the warp core of Voyager in your home theater? Maybe you are in the mood for a rainstorm in your bed as you sleep. These are the kinds of things that pop into my head, and on long winter nights I make come true. If this is your jam then come along on this adventure!\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch1\u003ePrerequisites\u003c/h1\u003e\n\u003ch2\u003eHome Assistant\u003c/h2\u003e\n\u003cp\u003eThis project requires some things that need to be already in place. We will be using \u003ca title=\"Home Assistant\" href=\"https://www.home-assistant.io/\"\u003eHome Assistant\u003c/a\u003e . Home assistant is a home automation system that you can build from the ground up for free, or buy pre-installed on a Raspberry Pi platform. The advantage of Home Assistant over other systems is that it can be operated cloud-free. This is paramount for people who value their privacy. The set up and install of Home Assistant is out of scope here, but it is something I will revisit in the future. It's not terribly hard to set up and even easier if you purchase the pre-built ones. If you don't already have this in place drop by their website and have a look around. If you already have it installed and working then onward we go!\u0026nbsp;\u003c/p\u003e\n\u003ch2\u003eA stereo system with speakers.\u003c/h2\u003e\n\u003cp\u003eNext let's consider that we want to make this environmental. That means that hooking it up to your home stereo won't be an option because you don't want this to be interrupted by your usual habits of music listening or nightly bit of binge watching. This is a great task for that old stereo you kept in the closet for ages, or a small inexpensive amplifier with an AUX in. This is also a great way to upcycle older equipment that has aged out or can be bought at a swap meet or flea market. There is no need for large exotic speakers or subwoofers, but hey - if you have them hanging around why not use them? Remember that speaker kit you bought for your home computer ages ago that you no longer use? Time to repurpose it! Get creative with multiple speakers , room speakers, or entire house wide speakers. The only limits are your imagination!\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch1\u003eParts!\u003c/h1\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"product","content":"https://www.adafruit.com/product/4377","metadata":{"name":"Raspberry Pi Stand","url":"https://www.adafruit.com/product/4377","description":"Raspberry Pi stand, holding the Pi and the 7\" touchscreen","quantity":"1","featured":false}},{"element_type":"product","content":"https://www.adafruit.com/product/4564","metadata":{"name":"Raspberry Pi 4 with 8gb RAM","url":"https://www.adafruit.com/product/4564","description":"Raspberry Pi 4 , 8gb RAM","quantity":"1","featured":false}},{"element_type":"product","content":"https://www.adafruit.com/product/5441","metadata":{"name":"Cat 6 Ethernet cable","url":"https://www.adafruit.com/product/5441","description":"Adjust length to your needs","quantity":"1","featured":false}},{"element_type":"product","content":"https://www.adafruit.com/product/2718","metadata":{"name":"Raspberry Pi 7\" Touchscreen","url":"https://www.adafruit.com/product/2718","description":"Raspberry Pi 7\" Touchscreen","quantity":"1","featured":false}},{"element_type":"parts","content":"\n  \u003cdiv class=\"parts-details\"\u003e\n    \u003cdiv\u003e\n      \u003cspan class=\"parts-quantity\"\u003e1\u003c/span\u003e\u003cspan\u003e x \u003c/span\u003e\n        \u003ca href=\"https://www.adafruit.com/product/2693\" class=\"parts-name\" target=\"_blank\"\u003eMicro SD Memory Card\u003c/a\u003e\n      \u003cdiv class=\"parts-description\"\u003eMicro SD Memory Card\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n  \u003cdiv class=\"parts-action\"\u003e\n  \u003cdiv\u003e\n        \u003ca id=\"2693-product\" class=\"product-buy btn-primary parts-url\" target=\"_blank\" href=\"https://www.adafruit.com/product/2693\"\u003eAdd  to Cart\u003c/a\u003e\n\n\n  \u003c/div\u003e\n\u003c/div\u003e\n\n  \u003cdiv class=\"clearfix\"\u003e\u003c/div\u003e\n","metadata":{"name":"Micro SD Memory Card","url":"https://www.adafruit.com/product/2693","description":"Micro SD Memory Card","quantity":"1","featured":false}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch1\u003eHow It Works\u003c/h1\u003e\n\u003cp\u003eThis is important because the way I deployed this may seem unintuitive or unusual, but it overcomes several limitations in the software we are using and keep things relatively secure. If you find a way that works better for you or meets your needs then huzzah! This is meant to be a guide for how I did it, using the system that is working in my home right now. Your mileage may vary :)\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eIn the broad strokes the process goes like this :\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eHA dashboard button --\u0026gt; HA server --\u0026gt; SSH to Raspberry PI --\u0026gt; Run shell script to play audio\u003c/p\u003e\n\u003cp\u003eDepending on if the audio file is an environmental sound to be repeated or a sample to be played once there will be some variances in the shell script on the Pi.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eThe way Home Assistant communicates via ssh, this system is designed to connect, execute the shell script for the sound or sample, then exit. This keeps the storage of the sound files, the player, and the load on the Pi and not on your Home Assistant server. IT also allows you to place the pi closer to the stereo that will be playing the sounds and not have to run long lengths of audio cable.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eYou should be comfortable with Home Assistant, SSH, generating SSH keypairs, and basic shell scripting. Luckily for you if you need help with these assistance is just a google search away. I'll do my best to make this detailed and working, however the world changes quickly and software may change in the future.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eThis system was made with :\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eRaspberry Pi 4 hardware\u003c/li\u003e\n\u003cli\u003eRaspberry Pi OS : Bookworm\u0026nbsp;\u003c/li\u003e\n\u003cli\u003eHome Assistant : 2023.12.3\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"parts","content":"\n  \u003cdiv class=\"parts-details\"\u003e\n    \u003cdiv\u003e\n      \u003cspan class=\"parts-quantity\"\u003e1\u003c/span\u003e\u003cspan\u003e x \u003c/span\u003e\n        \u003ca href=\"https://www.amazon.com/Headphone-Adapter-Splitter-Connects-Smartphone/dp/B09GW6JHY6/\" class=\"parts-name\" target=\"_blank\"\u003e1/8\" stereo to RCA cable\u003c/a\u003e\n      \u003cdiv class=\"parts-description\"\u003e1/8\" stereo to RCA cable\u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n  \u003cdiv class=\"parts-action\"\u003e\n  \u003cdiv\u003e\n      \u003ca href=\"https://www.amazon.com/Headphone-Adapter-Splitter-Connects-Smartphone/dp/B09GW6JHY6/\" class=\"parts-url btn-secondary\" target=\"_blank\"\u003eBuy Now\u003c/a\u003e\n\n  \u003c/div\u003e\n\u003c/div\u003e\n\n  \u003cdiv class=\"clearfix\"\u003e\u003c/div\u003e\n","metadata":{"name":"1/8\" stereo to RCA cable","url":"https://www.amazon.com/Headphone-Adapter-Splitter-Connects-Smartphone/dp/B09GW6JHY6/","description":"1/8\" stereo to RCA cable","quantity":"1"}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch1\u003ePrepare The Pi\u003c/h1\u003e\n\u003ch2\u003ePart one : Assemble the Pi and the case.\u003c/h2\u003e\n\u003cp\u003eThis is pretty straightforward, but there are some tricky bits about it. The case is designed to hold both the Pi and the touchscreen monitor. Depending on which case you choose, make sure to follow the directions provided and to ensure that you do not pinch off any cables. The case listed in the parts manifest above has a link to a video showing the assembly. At some point I will update this with pictures, but I don't have any at the moment.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"alert","content":"The process of installing the Raspberry Pi and programming it can be tricky to people new to the idea. Because of this and because of the way that the case is assembled I suggest that you do not install all four of the nuts holding the Pi in place until you know for sure that the install \u0026amp; programming is complete and working. The only way to access the SD card once it is installed requires you to be able to freely lift the Pi to access it. Those nuts are TINY and hard to work with, and there is no way to wipe and re-flash the SD card when it is in the Pi. For sure be sure to go back and add the other three nuts once it's working though.","metadata":{"class":"element row-fluid alert-element build-alert alert-info","alert_type":"info"}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch2\u003ePart Two : Install the OS onto the Pi.\u0026nbsp;\u003c/h2\u003e\n\u003cp\u003eFor best results follow the directions provided at \u003ca title=\"The Pi web page\" href=\"https://www.raspberrypi.com/software/\"\u003eThe Pi home page\u003c/a\u003e . This will install the latest version of the Raspbian OS and walk you through the configuration. In order to make things easier down the line, here are a few things to do while installing the OS :\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eChoose the device that matches your Pi ( Pi 4 in this case )\u0026nbsp;\u003c/li\u003e\n\u003cli\u003eInstall the full 64 bit version of the OS\u003c/li\u003e\n\u003cli\u003eChoose to customize the OS before burning it to the SD card :\u0026nbsp;\n\u003cul\u003e\n\u003cli\u003eUnder the GENERAL tab\n\u003cul\u003e\n\u003cli\u003eSet a host name for the Pi ( in our example we will call it ENV )\u0026nbsp;\u003c/li\u003e\n\u003cli\u003eSet a user name and password ( For our example we will use YOURNAME , and pick a good password, please! )\u0026nbsp;\u003c/li\u003e\n\u003cli\u003eIf you are using Wifi , enter the WiFi information. If not don't worry, we will set up the Ethernet settings later. I strongly suggest using a Ethernet connection for this for security purposes.\u0026nbsp;\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eUnder the SERVICES tab\n\u003cul\u003e\n\u003cli\u003eEnable SSH\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eLet the installer work its magic, then install the SD card in the Pi and ensure it properly boots and that the touch screen is working.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch2\u003ePart Three : Configure the Pi\u003c/h2\u003e\n\u003cp\u003eAttach a keyboard and mouse to the Pi.\u003c/p\u003e\n\u003cp\u003eLog into the Pi using the credentials you set up ( YOURNAME and the good password you chose ).\u0026nbsp;\u003c/p\u003e\n\u003cp\u003ePerform the following commands from the shell :\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eEnsure that the operating system and installed software is up to date :\u0026nbsp;\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003esudo apt update\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003esudo apt full-upgrade\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eConfigure the Ethernet connection\u0026nbsp;\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003enmutl\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eIf you are like me and you think the older ways of verifying this is done correctly are better, run this command as well to bring back\u0026nbsp; ifconfig\u0026nbsp; and nslookup.\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003esudo apt install dnsutils\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eConfigure the Pi to auto login at startup. This will allow the Pi to run as a kiosk, and you can have it act as a control panel for Home Assistant as well as play your environmental sounds and samples.\u0026nbsp;\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003esudo raspi-config\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eSelect System Options, option 1 , then Express Autologin option B4 as the name you set when installing the OS\u0026nbsp; (B4)\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eConfigure the Pi to open the browser and go to your Home Assistant main menu at startup. Using your favorite editor ( I'll use vi here ) use the following command :\u0026nbsp;\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003esudo vi .config/wayfire.ini\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003eAdd the following lines to the end of the file :\u0026nbsp;\u003cbr\u003e\n\u003cpre class=\"highlight language-python\"\u003e\u003ccode class=\"language-python\"\u003e\u003cspan class=\"token punctuation\"\u003e[\u003c/span\u003eautostart\u003cspan class=\"token punctuation\"\u003e]\u003c/span\u003e\npanel \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e wfrespawn wf\u003cspan class=\"token operator\"\u003e-\u003c/span\u003epanel\u003cspan class=\"token operator\"\u003e-\u003c/span\u003epi\nbackground \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e wfrespawn pcmanfm \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003edesktop \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003eprofile LXDE\u003cspan class=\"token operator\"\u003e-\u003c/span\u003epi\nxdg\u003cspan class=\"token operator\"\u003e-\u003c/span\u003eautostart \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e lxsession\u003cspan class=\"token operator\"\u003e-\u003c/span\u003exdg\u003cspan class=\"token operator\"\u003e-\u003c/span\u003eautostart\nchromium \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e chromium\u003cspan class=\"token operator\"\u003e-\u003c/span\u003ebrowser https\u003cspan class=\"token punctuation\"\u003e:\u003c/span\u003e\u003cspan class=\"token operator\"\u003e//( YOUR HA ADDRESS AND MAIN MENU ) \u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003ekiosk \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003enoerrdialogs \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003edisable\u003cspan class=\"token operator\"\u003e-\u003c/span\u003einfobars \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003eno\u003cspan class=\"token operator\"\u003e-\u003c/span\u003efirst\u003cspan class=\"token operator\"\u003e-\u003c/span\u003erun \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003eozone\u003cspan class=\"token operator\"\u003e-\u003c/span\u003eplatform\u003cspan class=\"token operator\"\u003e=\u003c/span\u003ewayland \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003eenable\u003cspan class=\"token operator\"\u003e-\u003c/span\u003efeatures\u003cspan class=\"token operator\"\u003e=\u003c/span\u003eOverlayScrollbar \u003cspan class=\"token operator\"\u003e-\u003c/span\u003e\u003cspan class=\"token operator\"\u003e-\u003c/span\u003estart\u003cspan class=\"token operator\"\u003e-\u003c/span\u003emaximized\nswitchtab \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e bash \u003cspan class=\"token operator\"\u003e~\u003c/span\u003e\u003cspan class=\"token operator\"\u003e/\u003c/span\u003eswitchtab\u003cspan class=\"token punctuation\"\u003e.\u003c/span\u003esh\nscreensaver \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e false\ndpms \u003cspan class=\"token operator\"\u003e=\u003c/span\u003e false\u003cbr\u003e\u003cbr\u003e\u003c/code\u003e\u003c/pre\u003e\nReplace the part in paracentesis with your local Home Assistant address and main menu. For example :\u0026nbsp;\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003echromium = chromium-browser http://homeassistant.lan:8123/environmental-audio/default_view --kiosk --noerrdialogs --disable-infobars --no-first-run --ozone-platform=wayland --enable-features=OverlayScrollbar --start-maximized\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eThe next few steps may seem odd at first, but they will make sense once everything is in place.\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003cp\u003eTurn the volume on your stereo all the way down.\u003c/p\u003e\n\u003c/li\u003e\n\u003cli\u003eConnect the 3.5mm --\u0026gt; RCA cable to the audio out on the Pi, and to the AUX IN on the stereo.\u0026nbsp;\u003c/li\u003e\n\u003cli\u003eUsing your favorite method, transfer two files from your main computer to the ./Music directory on the pi. Make one of them an environmental sound file, and make the other a sample to play. For example let's make the first one \u003ca href=\"https://www.dropbox.com/scl/fi/ud6lxlq99bxqtekyc6gdm/oceanwaves.mp3?rlkey=9ryqpczknprjo4hearlgyyq7x\u0026amp;dl=0\"\u003eoceanwaves.mp3\u003c/a\u003e and the second one \u003ca href=\"https://www.dropbox.com/scl/fi/ecmncqutwf1lqjar1befo/huzzah.mp3?rlkey=0zqi3pke9v4o1a0o5kcnxa3zm\u0026amp;dl=0\"\u003ehuzzah.mp3\u003c/a\u003e\n\u003c/li\u003e\n\u003cli\u003eTurn the volume up slightly on your stereo, and test to ensure that the Pi is sending your audio out properly :\u0026nbsp;\n\u003cul\u003e\n\u003cli\u003e\n\u003ccode\u003evlc --play-and-exit ./Music/huzzah.mp3\u003c/code\u003e\u003cbr\u003e\u003cbr\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eYou should hear the grand call of \"Huzzah\" as done by Peter Dinklage.\u003c/li\u003e\n\u003cli\u003eNow we will make two batch files to play these files, and one to stop any that are repeating.\u003cbr\u003eThese batch files will be called by Home Assistant, and will be located in your home directory ( not in Music )\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003evi go-ocean.sh\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre class=\"highlight language-python\"\u003e\u003ccode class=\"language-python\"\u003e\u003cspan class=\"token punctuation\"\u003ekill -9 $(pgrep vlc)\u003cbr\u003e/usr/bin/cvlc -I dummy -R ./Music/oceanwaves.mp3\u0026amp; \u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003ccode\u003evi\u003c/code\u003e\u003ccode\u003ego-huzzah.sh\u003c/code\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre class=\"highlight language-python\"\u003e\u003ccode class=\"language-python\"\u003e\u003cspan class=\"token punctuation\"\u003e\u003cbr\u003e/usr/bin/cvlc -I dummy --play-and-exit ./Music/huzzah.mp3\u0026amp; \u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003ccode\u003evi\u003c/code\u003e\u003ccode\u003ego-silence.sh\u003c/code\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cpre class=\"highlight language-python\"\u003e\u003ccode class=\"language-python\"\u003e\u003cspan class=\"token punctuation\"\u003ekill -9 $(pgrep vlc)\u003cbr\u003e\u003cbr\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003cp\u003eNext we need to make sure that these files are executable from the command line, so ....\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ccode\u003echmod +x go-oceanwaves.sh\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003echmod +x go-huzzah.sh\u003c/code\u003e\u003c/li\u003e\n\u003cli\u003e\u003ccode\u003echmod +x go-silence.sh\u003c/code\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eIf we test these in order from the command line , here's what will happen :\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003e\n\u003ccode\u003e./go-oceanwaves.sh\u003c/code\u003e\n\u003cul\u003e\n\u003cli\u003eThe ocean waves will play on repeat, and you will get your command prompt back as it is running in the background.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003ccode\u003e./go-huzzah.sh\u003c/code\u003e\n\u003cul\u003e\n\u003cli\u003eWhile the ocean waves are playing, you will hear a shout of \"Huzzah!\". This plays once then exits to the command prompt.\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003e\n\u003ccode\u003e./go-silence\u003c/code\u003e\n\u003cul\u003e\n\u003cli\u003eThe ocean waves stop, and you will hear silence.\u0026nbsp;\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eNow that this is done, reboot the Pi and ensure that it comes back up in kiosk mode with your Home Assistant login page. Don't log in just yet, leave it like it is and we will come back to finish this part of the configuration.\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n  \n        \u003ch1\u003ePart Four : Configure Home Assistant\u003c/h1\u003e\n\u003cp\u003eSo now we have to do a few things to Home Assistant in order to make this magic work.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eFirst off , we need to establish passwordless communication between your HA server and the Pi that is playing the sounds. This is done using SSH and public/private key files.\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eLog in to your HA with administrator rights, and navigate to \"TERMINAL\"\u003c/li\u003e\n\u003cli\u003eCreate the keypair for your HA server in the /config/.ssh directory.\n\u003cul\u003e\n\u003cli\u003essh-keygen -t rsa -b 4096\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003cli\u003eThis will generate two files , id_rsa ( Private Key )\u0026nbsp; and id_rsa.pub ( Public Key )\u0026nbsp;\u003c/li\u003e\n\u003cli\u003eCopy the content of the PUBLIC key to your Pi into the file\u0026nbsp; .ssh/authorized_keys on your Pi.\u003c/li\u003e\n\u003cli\u003eTest the setup from your HA Terminal window :\u0026nbsp;\n\u003cul\u003e\n\u003cli\u003essh -i /config/.ssh/id_rsa (yourname)@(address of your pi)\u0026nbsp;\u003c/li\u003e\n\u003cli\u003eYou should get a shell prompt from your Pi. Type exit to return to the shell in your HA server.\u0026nbsp;\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eNext we need to configure your HA instance to send commands to your Pi, triggering the shell scripts you made.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eYou need to edit your /homeassistant/configuration.yaml file. I use the add-on file editor to do this. Make sure yto replace (yourname) and (YourPi) with the user ID and address of your Pi.\u003c/p\u003e\n\u003cp\u003eAll the following lines to the end of your configuration.yaml file :\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003eshell_command:\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003e\u003ccode\u003e\u0026nbsp; \u0026nbsp;sound_ocean: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa (yourname)@(yourpie) 'nohup ./go-ocean.sh \u0026gt; output.log 2\u0026gt;\u0026amp;1 \u0026amp; exit'\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003e\u0026nbsp; \u0026nbsp;\u0026nbsp; \u0026nbsp;\u003ccode\u003esound_huzzah: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa (yourname)@(yourpie) 'nohup ./go-huzzah.sh \u0026gt; output.log 2\u0026gt;\u0026amp;1 \u0026amp; exit'\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003e\u0026nbsp; \u0026nbsp; \u0026nbsp;\u003ccode\u003esound_silence: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa (yourname)@(yourpie) 'nohup ./go-silence.sh \u0026gt; output.log 2\u0026gt;\u0026amp;1 \u0026amp; exit'\u003c/code\u003e\u003c/p\u003e\n\u003cp\u003eOnce this is done restart your Home Assistant instance.\u0026nbsp;\u003c/p\u003e\n      \n\n\n\n\n\n\n\n\n\n\n\n\n\n","metadata":{}},{"element_type":"text","content":"\n  \n  \n        \u003cp\u003eNext we create the helper object :\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eFrom SETTINGS select HELPERS\u003c/li\u003e\n\u003cli\u003eSelect CREATE HELPER\u003c/li\u003e\n\u003cli\u003eSelect Create Helper\u003c/li\u003e\n\u003cli\u003eName : Environmental Audio\u003c/li\u003e\n\u003cli\u003eIcon : mdi:speaker\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eNow all that's left is to add the buttons to a dashboard to trigger these sounds.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eOpen whichever dashboard you would like to add these to in the dashboard editor and do the following :\u0026nbsp;\u003c/p\u003e\n\u003cul\u003e\n\u003cli\u003eSelect \"Add Card\"\u003c/li\u003e\n\u003cli\u003eEntity : Environmental Audio\u003c/li\u003e\n\u003cli\u003eName : Ocean\u003c/li\u003e\n\u003cli\u003eTap action : Call Service\u003c/li\u003e\n\u003cli\u003eService : shell command: sound_ocean\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eRepeat this for Huzzah and silence, replacing sound_ocean with sound_huzzah or sound_silence.\u003c/p\u003e\n\u003cp\u003eAfter saving your dashboard, load it up and try it out!\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n\n","metadata":{}},{"element_type":"text","content":"\n  \n        \u003ch1\u003eThat's it!\u0026nbsp;\u003c/h1\u003e\n\u003cp\u003eIt's been a long road, but this is what it looks like on my side. Note that I am using the LCARS theme so mine looks a bit trek-like , but it's the same stuff done here. My apartment now sounds like the engineering deck on the Enterprise-D and I can chalk up a few more nerd points!\u0026nbsp;\u003c/p\u003e\n\u003cp\u003eHappy hacking!\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n      \n","metadata":{}},{"element_type":"user_image","content":"https://cdn-learn.adafruit.com/user_assets/assets/000/000/563/original/e2.JPG?1703679789","metadata":{"caption":""}}]