Setting the Target: We begin by specifying the target machine's IP address, which allows us to precisely identify the system we want to awaken and interact with.Ĭhecking the Samba Share: Our script first verifies the contents of a designated Samba share folder. Its primary objective is to initiate the wake-up and execution sequence for a target machine, such as a Windows PC, using a Raspberry Pi. This script serves as the core component of our automation process. (just the AMD server alone, Im looking at just over $42 a year by not running it 24/7) Wake on LAN played a crucial role in achieving these goals, offering substantial energy savings. Once a week wake up the gaming PC, execute system updates, and shut down.Once a week, wake up my backup Linux server, perform a backup, and shut down.If found, wake up the gaming PC, run the encoding script, and shut down when finished. Every day at 6:30 am, check for videos to encode on my network share.My goals, driven by cron jobs, were clear: This led me to utilize the "efficiency cores" of a Raspberry Pi 3 for automation. How to automate video transcoding seamlessly.How to keep my Windows PC up to date with software updates and apps.How to keep my backup Linux PC in sync with my home lab so if my machine ever went down, cutover would be nearly seamless.Going through the above, I had three problems I wanted to solve: I knew about Wake on LAN but never explored it until I had two idle PCs: the old home lab and Windows Gaming PC. Meanwhile, my home lab, running on Ubuntu Server, saw substantial power consumption reduction over the years, thanks to moving from a AMD 5350 to an Intel J1900 CPU/motherboard combo and Raspberry Pi devices. When it did, it was usually for video transcoding, light gaming, or overdue Windows updates. With a decent setup in my kitchen area, because of the whole, work from home privilege many of us have seen over the last few years, my gaming PC seldom saw use. However, it often took a back seat to my Framework Laptop due to its compatibility with my kitchen workstation setup, and the ease of hot-swapping using USB-C with my work laptop, an M1 Apple MacBook. In 2020, I built a gaming PC equipped with a mid-tier Zen 3 CPU, 16 GB of RAM, and an Nvidia 3060. I'm constantly seeking ways to optimize existing technologies. ![]() Add this line last in the file: hass ALL=NOPASSWD:/usr/sbin/pm-suspend, where you replace hass with the name of your user on the target, if different, and /usr/sbin/pm-suspend with the command of your choice, if different.Efficiency has always fascinated me as a software engineer. On the target, using an account with sudo access (typically your main account), sudo visudo.On my system, this is /usr/sbin/pm-suspend. First, get the full path: which pm-suspend. Here is it pm-suspend, use poweroff to turn off the computer. On the target, we need to let the hass user execute the program needed to suspend/shut down the target computer.On the server, verify that you can reach your target machine without password by ssh TARGET.Enter the password you created in step 3. On the server, transfer your public SSH key by ssh-copy-id where TARGET is your target machine’s name or IP address.If you do, you can leave out in the SSH commands below. It’s recommended using the same user name as on the server. Just press enter on all questions except password. ![]() On the target, create a new account that Home Assistant can ssh into: sudo adduser hass.On the server, create SSH keys by running ssh-keygen.On the server, log in as the user account Home Assistant is running under.Suggested recipe for letting the turn_off script suspend a Linux computer (the target)įrom Home Assistant running on another Linux computer (the server). ![]() Here are some real-life examples of how to use the turn_off variable.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |