Congrats, you’re done with the setup on Opnsense. I’m assuming you know how to create firewall rules for your network, but the specific rule you need is to allow traffic from your HomeAssitant instance to “This Firewall” on either HTTP or HTTPS (depending on whether you have HTTPS enabled on Opnsense). Depending on how you have your firewall rules set up, you probably need to create one to allow HomeAssistant to connect to the REST API on Opnsense.You’ll be prompted to download a txt file that will have the user/key you’ll need later. Then scroll down and create an API key by clicking the plus button. Click the edit button and search for “Services: Wake On Lan”. Edit the user and scroll down to “Effective Privileges”. You’ll need to give it permission to access to the API. By default the user can’t do anything.Pick a username (doesn’t matter) and enter a stupidly long/secure password (you’ll probably never need it). You could use an existing Opnsense user but I’d suggest creating a separate one just for HASS. Next step is creating a REST API token.I think this step is optional given the later steps but it can’t hurt to add. Go to Services->Wake on Lan and click the plus icon in the bottom right corner next to “Wake All”, and add your device/MAC address along with the interface.Install the os-wol plugin in Opnsense by going to System->Firmware->Plugins.I wanted to target mine since I have a few that I like to sleep/wake up so I kept digging a bit. Their solution was simply to wake all devices. However, the Reddit post from /u/abstractbarista linked above got me 90% of the way there. The documentation for the WOL API on Opnsense is….lacking. ![]() Opnsense has a REST API that you can call prettily easily, particularly when combined with HomeAssistant’s REST API command integration. But that’s just too much effort when you can get it into HomeAssistant! Opnsense Setup Worst case I could just log into Opnsense, go to the WOL service and wake up my homelab server. I discovered Opnsense has a WOL plugin and found it worked great. You can do so much on your router if you run Opnsense/PFsense (depending on which is your cup of tea, not getting into the debate between the two here) it really is worth it. The main thing I’m really loving is all the plugins and tools that are available. Coming from an Edgerouter the difference is just night and day. I’ve been running Opnsense as my firewall for about 2 months now and I have to say I love it. Well I don’t have a Wifi network for my Homelab VLAN so I can’t use a Pi Zero, and I really didn’t want to use a full Pi for something as simple as WOL.Įnter Opnsense. Instead of having to shut it down/turn it back on (requiring me to trudge down to my basement) I figured I’d try using WOL and just suspending the server when I’m not using it. However I’ve been playing around with a homelab (my old retired server) but I didn’t want it running 24/7 wasting power when I only use it sporadically. My bigger problem was that I needed a Pi Zero on the same subnet which usually wasn’t a problem. ![]() ![]() It worked great but having to poke firewall rules, having SSH keys on HomeAssistant, etc always made me a little uncomfortable. I then set up SSH keys and added it to HomeAssistant, along with a script I could call via a shell_command. To get around this, my solution for a long time was to have a Raspberry Pi Zero on the subnet I wanted with the wakeonlan package. My biggest annoyance is with my network setup, I have multiple VLANs/subnets, and WOL doesn’t really like to be routed across subnets for reasons I only barely understand so I’m not going to try to explain. WakeOnLAN is one of those things that you love to hate. The main differences being 1) little bit improved layout/format (subjective) and 2) I figured out how to do a call to just wake a single device. Most of the steps below come from their guide. Note: Significant hat tip here to /u/abstractbarista for this guide.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |