Matthew Garrett ([personal profile] mjg59) wrote2020-06-23 08:45 pm
Entry tags:

Making my doorbell work

I recently moved house, and the new building has a Doorbird to act as a doorbell and open the entrance gate for people. There's a documented local control API (no cloud dependency!) and a Home Assistant integration, so this seemed pretty straightforward.

Unfortunately not. The Doorbird is on separate network that's shared across the building, provided by Monkeybrains. We're also a Monkeybrains customer, so our network connection is plugged into the same router and antenna as the Doorbird one. And, as is common, there's port isolation between the networks in order to avoid leakage of information between customers. Rather perversely, we are the only people with an internet connection who are unable to ping my doorbell.

I spent most of the past few weeks digging myself out from under a pile of boxes, but we'd finally reached the point where spending some time figuring out a solution to this seemed reasonable. I spent a while playing with port forwarding, but that wasn't ideal - the only server I run is in the UK, and having packets round trip almost 11,000 miles so I could speak to something a few metres away seemed like a bad plan. Then I tried tethering an old Android device with a data-only SIM, which worked fine but only in one direction (I could see what the doorbell could see, but I couldn't get notifications that someone had pushed a button, which was kind of the point here).

So I went with the obvious solution - I added a wifi access point to the doorbell network, and my home automation machine now exists on two networks simultaneously (nmcli device modify wlan0 ipv4.never-default true is the magic for "ignore the gateway that the DHCP server gives you" if you want to avoid this), and I could now do link local service discovery to find the doorbell if it changed addresses after a power cut or anything. And then, like magic, everything worked - I got notifications from the doorbell when someone hit our button.

But knowing that an event occurred without actually doing something in response seems fairly unhelpful. I have a bunch of Chromecast targets around the house (a mixture of Google Home devices and Chromecast Audios), so just pushing a message to them seemed like the easiest approach. Home Assistant has a text to speech integration that can call out to various services to turn some text into a sample, and then push that to a media player on the local network. You can group multiple Chromecast audio sinks into a group that then presents as a separate device on the network, so I could then write an automation to push audio to the speaker group in response to the button being pressed.

That's nice, but it'd also be nice to do something in response. The Doorbird exposes API control of the gate latch, and Home Assistant exposes that as a switch. I'm using Home Assistant's Google Assistant integration to expose devices Home Assistant knows about to voice control. Which means when I get a house-wide notification that someone's at the door I can just ask Google to open the door for them.

So. Someone pushes the doorbell. That sends a signal to a machine that's bridged onto that network via an access point. That machine then sends a protobuf command to speakers on a separate network, asking them to stream a sample it's providing. Those speakers call back to that machine, grab the sample and play it. At this point, multiple speakers in the house say "Someone is at the door". I then say "Hey Google, activate the front gate" - the device I'm closest to picks this up and sends it to Google, where something turns my speech back into text. It then looks at my home structure data and realises that the "Front Gate" device is associated with my Home Assistant integration. It then calls out to the home automation machine that received the notification in the first place, asking it to trigger the front gate relay. That device calls out to the Doorbird and asks it to open the gate. And now I have functionality equivalent to a doorbell that completes a circuit and rings a bell inside my home, and a button inside my home that completes a circuit and opens the gate, except it involves two networks inside my building, callouts to the cloud, at least 7 devices inside my home that are running Linux and I really don't want to know how many computational cycles.

The future is wonderful.

(I work for Google. I do not work on any of the products described in this post. Please god do not ask me how to integrate your IoT into any of this)
lovingboth: (Default)

[personal profile] lovingboth 2020-06-24 08:57 am (UTC)(link)
I am reminded of the villain's plan in Skyfall, which will only work if MI6 put him in a cell with an electronic lock rather than a mechanical one.

(I nearly said 'hackable electronic lock', but...)
bens_dad: (Default)

[personal profile] bens_dad 2020-06-24 10:42 am (UTC)(link)
Since both ends are their customers, I hope Monkeybrains are working on a simpler solution for you.
(I wonder whether the NATed addresses are not routed *between* the internal networks.)

Repley to MJG59

(Anonymous) 2020-06-24 12:11 pm (UTC)(link)
As a Google employee you must know that Google can be evil, because they together with Apple and Facebook spy on their users with there products and track your every move you make. Take your privacy back. :)

Reminds me of Bureaucracy

(Anonymous) 2020-06-25 10:47 am (UTC)(link)
Maybe Infocom should do an updated version where you have to get your home automation to work.

Re: Reminds me of Bureaucracy

(Anonymous) 2020-06-28 11:09 am (UTC)(link)
Oh come on that's too sadistic even for people who enjoyed _Bureaucracy_. It would never get any players, except the same sort of people who play _Dwarf Fortress_ specifically so they can torment the dwarves.

You seriously need a concierge

(Anonymous) 2020-06-26 01:38 pm (UTC)(link)
Fuck technological solutions to things that are done better by human beings.

Re: You seriously need a concierge

(Anonymous) 2020-06-28 11:12 am (UTC)(link)
Well, there's also the low-tech solution of having a doorbell that makes a ringing noise and then you get up and answer it. I suppose that doesn't work over the Internet, but I can't really figure out why I'd want to let anyone without a key into my house when I wasn't there. (But then I live a very simple life.)

(I often think I have far too little geekery in my life for a geek. I can't even close my blinds automatically. I can't even figure out how one might do that without replacing one's blinds, probably light bulbs, likely light-bulb holders too, and tying oneself to a mass of impossible-to-configure, half-proprietary nightmares that go obsolete in two years and leave you with blinds and lights you can't turn on at all. The only tempting thing about your setup to me is that it's got a lot of free software components which probably will not go immediately obsolete, and at least you found a doorbell that wasn't mandatorily tied to the cloud...)

+1 for doorbird

(Anonymous) 2020-06-30 07:17 pm (UTC)(link)
I run homeassistant at home, and when someone rings the doorbird I have it send an image still to the chromecast on the living room TV, and recently added support for my Meural picture frame to show the image as well.

I think that may have been the killer feature that made my partner be ok with the quest for automating all the things.

Re: +1 for doorbird

(Anonymous) 2020-06-30 07:19 pm (UTC)(link)
(just realized I posted this anonymously, and that openid is no longer a real thing. How long did I sleep? Anyway, this was thomasvs@)