Top
Best
New

Posted by quacky_batak 5 days ago

Show HN: I built a "Do not disturb" Device for my home office(apoorv.page)
91 points | 46 comments
rlue 1 day ago|
Like all the other commenters here, I also devised my own solution—but AFAICT, it's the only other solution that's automated!

Requirements:

  * macOS
  * Zoom
  * Home Assistant
  * A signal light/sign on a smart switch (like [0])
The Procedure:

First, create a script that checks whether you're currently on a Zoom call, and then turns your signal light on or off accordingly. Remember to chmod +x!

  #!/bin/sh

  if [ $(lsof -i 4UDP | grep zoom 2>/dev/null | wc -l) -gt 1 ]; then
    curl \
      -H "Authorization: Bearer ${HOME_ASSISTANT_ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -d '{"entity_id": "${ENTITY_ID}"}' \
      https://${HOME_ASSISTANT_DOMAIN}/api/services/switch/turn_on
  else
    curl \
      -H "Authorization: Bearer ${HOME_ASSISTANT_ACCESS_TOKEN}" \
      -H "Content-Type: application/json" \
      -d '{"entity_id": "${ENTITY_ID}"}' \
      https://${HOME_ASSISTANT_DOMAIN}/api/services/switch/turn_off
  fi
Then, create a LaunchAgent that monitors your Zoom Application Support directory for filesystem changes at ~/Library/LaunchAgents/local.${USER}.on-air.plist:

  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
  <dict>
      <key>Label</key>
      <string>local.${USER}.on-air</string>
      <key>ProgramArguments</key>
      <array>
          <string>${PATH_TO_SCRIPT}</string>
      </array>
      <key>WatchPaths</key>
      <array>
          <string>/Users/${USER}/Library/Application Support/zoom.us/data</string>
      </array>
  </dict>
  </plist>
Finally, load 'er up:

  $ launchctl load ../Library/LaunchAgents/local.${USER}.on-air.plist
[0]: https://www.amazon.com/dp/B09NJ8ZCHF
stevenhubertron 5 hours ago||
You can make this quite a bit easier you could just connect your Apple calendar or Google calendar to Home Assistant directly and just set up an automation there no script needed
OhSoHumble 21 hours ago||
I have something similar that I built a long while ago. It's a large Do Not Disturb sign. There is a raspberry pi mini that controls power going to it. There is a corresponding daemon running on a PC that checks Discord call status. In call? Power to sign. Not in call? No power to sign. The client/server daemons are in Golang and communicate over RPC.
teach 1 day ago||
> My router assigns dynamic IP addresses, meaning my server location kept changing.

I've had a similar problem in the past. It turns out that most routers have a way to assign an IP address statically based on the MAC address of the requesting device without affecting the other DHCP devices on the network.

I do this for my pi-hole, my NAS and my gaming PC.

lostlogin 1 day ago||
> Dynamic IPs

I thought that step one of geekdom was assigning a few static IPs.

Ruining the home network while ‘optimising’ has happened a few too many times.

hunter2_ 1 day ago|||
The wording can vary quite a bit: I've seen names like static, fixed, DHCP reservation, etc. -- I tend to like DHCP reservation, because from the client's perspective, "static" means not using DHCP, but this does use DHCP (just not the pool).
tzs 21 hours ago|||
Most home routers also have some addresses that are outside the range managed by DHCP, or if DHCP is set to manage the entire range of LAN address have a setting where you can reduce that range. This gives you a third way to manage static assignments.

Let's assume the LAN is 10.0.0/24, so addresses of devices on the LAN are 10.0.0.1-10.0.0.254. In the following I'll omit the 10.0.0. part of an address, so will just refer to addresses 1-254.

Find the range DHCP manages, which should be somewhere in the router settings. If it is 1-254 reduce it. Let's say it is 1-200 (either by default or after you have reduced it).

Then you can simply go the settings on your server or other device that you want to have a static address and configure it to use a hard coded address outside that range, such as 201.

A possible downside of that is that on some devices if you want to give it a hard coded address you also have to hard code the gateway address and the name servers.

Some devices though have an option to use a hard coded address but still get the gateway and name servers from DHCP.

In summary, there are three ways to manage address for a given device on most home routers.

1. DHCP assigns the address. It can choose any address in its pool. Each time the device needs an IP address, such as after a boot or when its lease expires, it could get a different IP address.

2. DHCP assigns the address, but you can tell it to give a specific address from the pool to a given device identified by the device's MAC address.

3. Tell the device to use an address outside the router's DHCP pool. It's up to you to decide how to assign these address and how to make sure no conflicts arise.

For #2 if you want some device to have a fixed IP address but you don't actually care what that address is, many routers have an easy way to do that. Connect the device under #1, so DHCP picks the address.

Then go find the table in the router's web interface that shows all currently connected devices and find your device. Many routers will have a toggle in there to tell it to switch to #2 for that device. From then on the device's current address will be reserved for it.

That's a little easier than going through their "assign an IP" dialog, because that usually makes you enter the MAC address. If you go through the connection table details it doesn't have to ask you for the MAC address.

bartvk 1 day ago||
What's bizarre is that my previous TP-Link routers alawys had this ability, but when I upgraded two years ago, it was gone.
galleywest200 1 day ago||
My current TP-Link router hides this behind the "Advanced" settings toggle.
bartvk 12 hours ago||
I've got a TP-Link Archer C7, hardware version 5. No such toggle unfortunately, but thanks nevertheless. Perhaps I should try and flash it with OpenWRT.
cuu508 23 hours ago||
Here's my low tech do-not-disturb device ;-)

https://i.imgur.com/rnwEGIZ.jpeg

3eb7988a1663 17 hours ago||
I like to imagine you spent more effort right-sizing the wood vs installing a door knob with a lock.
cuu508 13 hours ago||
I happened to have a piece of scrap wood of the right length already. Making the hole with a hand drill took maybe 2 minutes. Don't think sourcing and installing a lock mechanism would be quicker :-)
unangst 16 hours ago||
1. Turn handle down, realizing door is locked. 2. Turn handle up to unlock door. 3. Profit.
pavel_lishin 1 day ago||
I have an old, broken crosswalk sign that I keep meaning to set up as a "meeting indicator" - red hand meaning that I'm in a meeting, and the seconds countdown as an indicator of how many minutes are left until I'm out of meetings.

But as it turns out, since my spouse & I both work from home, separated by an entire floor of a house, there ain't that much need for it, so it sits on my shelf.

brandon272 5 hours ago||
Anytime I see something like this my mind immediately thinks of the 'Full House' episode where Uncle Jesse keeps getting interrupted in his basement recording studio so he installs a red light at the top of the stairs. Red light = DND.
dripton 1 day ago||
I needed something like this for my basement home office. But I was lazy, so rather than actually building anything, I just bought some color-changing light bulbs ($7 on Amazon including remote) and installed them on the basement stairs. If I have a do-not-disturb meeting, I make the light red.
apparent 1 day ago||
> One does not simply get the camera status on a MacBook.

What you need is a sensor right near the green dot that detects whether it's turned on or not. Could use a full-blown camera, but probably a simpler sensor would work too.

Only half-kidding.

NitpickLawyer 1 day ago|
> One does not simply get the camera status on a MacBook.

? OverSight [1] seems to work just fine. It pops up whenever something uses the mic or camera (the usage for this tool is to "monitor" for unwanted access from rogue apps). Since it's open source it should be possible to check how they get the status?

- https://github.com/objective-see/OverSight

shermantanktop 1 day ago||||
That's what I use. Oversight runs scripts on events, which is great. However! now you have the problem of rapid events with overlapping scripts ending up with inconsistent state. I solved that with a lock file, but still get stuck states sometimes.
dhosek 1 day ago|||
Skimming the code, I think it also monitors log events.
rnoorda 1 day ago||
I made a simple ON AIR sign with LEDs inside that I change to reflect what I was doing. Red means I am in a meeting or totally focused, blue means I'm working, but someone can interrupt me if needed. Green means I'm not working, come on in!

The only issue with my setup- I work from home. My wife does not. No one is there to care if they can come in or not. It was building something fun to solve a problem I never had.

Would do again.

lam0x86 1 day ago||
Nice. I built something similar using a Rust-based daemon running on my Mac. It listens to the microphone state (not the camera) via a Core Audio property listener (AudioObjectPropertyListenerProc), rather than log monitoring or polling, so it works even when the camera is turned off. When the mic status changes, the daemon toggles a light by sending a simple message via zigbee2mqtt. I also installed a fire alarm plate above my door, powered by a cheap Zigbee socket, similar to this one: https://ampac.net/wp-content/uploads/2017/05/4210-0131-Warni...
JoeBOFH 1 day ago|
We historically have used Blynclights for this exact thing. Used them in office then we all migrated to working from home a lot of us brought them with and use them. I have a wireless one that sits on a table just outside my office.
More comments...