Power on with USB-C Docking Station

My current Lenovo Thinkpad Docking Station (type 40AN) is really bad. Although there’s a 170W power supply connected, it fails to reliably deliver power to any non-Lenovo laptop. (sidenote: Namely to my Framework 13. Sometimes it works, sometimes it powers it for a few minutes, then stops, then starts again, then stops. Other times it doesn’t send power at all.) When laptop is turned off or disconnected, the dock bricks my entire network because it broadcasts a packet storm over Ethernet and starts overheating. Yep, there are so many packets that my router shits itself and the dock is too hot to touch. I had to permanently disconnect Ethernet cable from it. Also, there’s one slightly broken USB-A port, which doesn’t work. Sometimes.

This dock is so bad that I started looking for a universal USB-C Thunderbolt dock. One of the problems with these docks is the “power on” button… or rather, lack of it. (sidenote: Other problem is that they generally suck. They overheat, often have only 2 USB-A ports, support HDMI 1.4 or have 100Mbps RJ-45 port, so you have to very carefully read the specs before you buy one. Assuming there is a spec.) It sucks when you want to keep the lid closed but have to open it juuuust a little bit every time you want to use the damn machine. My workaround is enabling the BIOS setting which boots the system automatically when power supply connects.

There’s a problem with this. If you keep the power supply connected to the laptop/dock all the time and there’s a blackout, laptop boots automatically whenever electricity is restored. We have short blackouts here every 3-4 months. I keep a drawer full of candles.

I’d like to have a dock that would turn itself off automatically when the laptop turns off (e.g. by measuring power drain) and that I could turn on with a button press. There’s no magic involved, I just need a button to enable/disable power passthrough. I wonder why no one ever designed something like this.

There’s an ongoing effort to change this ridiculous situation. Power Delivery (PD) 3.1 defines the Extended Alert Event Type which dock could send to PD controller on laptop, and trigger a boot. Which docks and PD controllers support this feature? Good luck finding out. Maybe in a few years fully compliant hardware will dominate the market so we won’t have to worry about it anymore. Or not.

But hey, I’m an engineer, I live off designing solutions to virtual problems and overcoming imaginary limitations. The solution (sidenote: Truly, another workaround.) here is Home Assistant + smart zigbee plug.

[ ELECTRICAl GRID ] → [ SMART PLUG ]
                            
                         [ DOCK ]
                            
                        [ LAPTOP ]

Most smart plugs these days (Blitzwolf, Tuya, others) have two functions: the switch (controlled remotely or by a physical button) and power meter. Both are crucial. I turn on the plug manually. To prevent the “blackout situation”, the plug constantly monitors power consumption and when it drops below a certain value, (sidenote: 3W for me; my system draws ~8W when it’s idle.) Home Assistant turns the plug off.

That’s it. Simple and effective workaround for the real life problem. Here’s the automation, but it’ll be quicker to just set it up in GUI than to copy-paste.

triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.plug_dock_active_power
    for:
      hours: 0
      minutes: 0
      seconds: 30
    below: 3
actions:
  - action: switch.turn_off
    target:
      entity_id: switch.plug_dock_switch
mode: single

By the way, did you know that monitoring the power consumption of any plug is effective trigger for many useful automations, because it tells, between the lines, a lot more than a wattage?