No major question here, just thought you might find this interesting. It's an example of the kind of (off-the-wall) things you can do with HA that aren't immediately obvious. When I was starting out with HA, I enjoyed reading these examples, because it gave me ideas for my own setup. And, I wrote many automations that should really be scripts, so hopefully this will help someone avoid that and recognize the power of scripts early.
At home, my laptop from work sits (closed) on a stand under the monitors. I have a docking station for it, but the docking station doesn't have a power button to start the laptop (the official Dell docking stations have a power button, but other brand of docking stations don't). So, since I got that stand a few weeks ago, I've been pulling the laptop out and opening juuuuuuust enough that I could reach the power button, then closing it and sliding it back into the stand. There had to be a better way that didn't involve buying an expensive Dell docking station.
The docking station power is on a Sonoff S31 outlet (flashed with Tasmota, not that that's important here) that is remotely controllable. Long ago, I set up HA automations that turned on the S31 when the laptop was detected on the network, and shut off the S31 after the laptop dropped off the network at the end of the day (leaving in a time delay so it didn't shut off if there was a momentary network glitch). So, I'd boot the laptop, and a moment later the docking station would kick on and connect the mouse and monitors to it. And the end of the day, I shut down the laptop, and a few minutes later the docking station shuts off automatically.
I recently discovered the Wake on LAN integration. So, after setting that up, I wrote a script that turns on the S31, waits a while*, then triggers the Wake-on-LAN for the laptop...and it boots up! With HA, I can start the boot process while I'm still relaxing in the living room before starting work; in theory I'll go into the office and it'll be ready for me to log in.
Heck, if HA knew for certain it was a workday, it could boot the laptop for me.....hmmm. Maybe something to think about for the future.
*How long? Well, 30 seconds seems to be too short; the laptop doesn't respond to the WoL command after just 30 seconds with power applied. It did work this morning when I waited several minutes to try it again. I just changed the delay to 1 minute and will see how that works tomorrow.
I also added a repeat loop (starting after that 1 minute timer) with three components:
- A condition that looks for the laptop being "Away" on the network. (If it is "Home" on the network, the condition will end the script.)
- If it is, then it tries the WoL command again.
- Then waits 30 seconds and repeat.
The repeat loop counter is set to 3, for a total of 4 attempts to start the laptop. I'll check the traces and see when it starts working, and set the initial delay accordingly, so that in general it shouldn't need the repeat loop.
If people want, I can post (sanitized) YAML. But I do like explaining the process rather than just posting code.
Yeah, I've seen some used Dell ones cheap. But then I might want to use it for my personal non-Dell laptop, and who knows how that will work.
The one I have came from Amazon 3 years ago, and it has worked perfectly. We've been full-time work from home in those three years, so it has gotten a good bit of use.
The docks will work with anything that has Thunderbolt 3/4. It's only the power switch that won't work, and you can't do the breaking USB spec of charging over 100 watts @20v. The downside is those OEM docks tend to be Thunderbolt only, and if you connect it to a USB only device it will either not work at all, or have SEVERELY limited functions.
Is yours a dock dock or just a big hub? I don't really have much experience with the dock docks, but I know the overgrown hubs we use at work love to burn out the HDMI converter chips, but usually work well enough besides that.
I'm not sure if it's a dock dock or a big hub. It's a USB-C connection, so maybe the latter. It's definitely not one of the old style with the proprietary connector.