Hacker News new | ask | show | jobs
by dirktheman 2229 days ago
It's a cool project, but for these kind of things I'd rather use a Shelly1. Runs locally, can easily be flashed with Tasmota firmware and it connects to my Home Assistant instance. This thing has never failed me and it's only $15, way cheaper than a Pi (keep the RBPi as your Home Assistant server!)
4 comments

Or an ESP8266, using MQTT to "press" buttons on a standard garage door remote control through a relay module. I uploaded mine here: https://imgur.com/a/l2wt40w (green and blue are ground and 5V, gray and white are the pulses to the relays).
This is great. Question - why did you use the relays and not just the GPIO pins on the ESP to short circuit the contact on the remote for a brief moment?
You can't use GPIO pins to short 2 contacts together.

The best you can do is apply voltage to the contacts (which might be workable, depending on how the remote is designed).

To short the contacts you need either a relay or a transistor.

Assuming one of the contacts is connected to either ground or Vcc, one thing you can do is connect a GPIO pin to the other contact. Then when the GPIO is made an input the switch is "open", to close it you first write the value the other contact was connected to, and then you make the GPIO an output. Whether this works depends on the current that is sinked by the remote. This was my plan initially but then I went with the relays.
Ah yes, of course. Perhaps a transistor could work as well for low voltage?
Yes but I wasn't too comfortable with hacking the remote control because I wasn't sure if the button shorted the two contacts towards Vcc or ground (so if I needed an NMOS or PMOS). My knowledge of electronics is super minimal, I can read schematics, design simple circuits, size resistors, etc. but reverse engineering is beyond my level.

Also I used this remote control only because one of the switches was broken, I didn't have a spare one so I couldn't afford breaking it.

An optocoupler would be better but I figured maybe one day I will repurpose the relay shields for something else, or unsolder the relays. Actually my next project involves both optocouplers (for efficient 12V->3.3V conversion) and relays to drive AC but I will probably have a PCB manufactured for that one!

Yes, though you will need to determine whether it should be pull up or pull down, and to what voltage level. And make sure not to provide it with too high a load (too low resistance), or too high a voltage, which may damage the circuit. Since the voltage levels might be different from your microcontroller, so I would probably recommend an optocoupler to simplify the interfacing. Gives the isolation of a relay but without the mechanical operation and size of one.
Yep, should work fine since you only need current flow in one direction!
I second this. Pi is well suited for HA if you don't do have database stuff. And the Shelly allows to still keep manual controls in case your automation is broken.

Although I've grown cautious of products like Shelly which use Wifi as they will become obsolete once their Wifi security protocol becomes broken (like WEP en WPA). But then again the same probably goes for more expensive Zigbee and Zwave devices.

My WiFi-connected IOT devices run on a separate network, with outgoing connections disabled, but that's more out of a privacy concern.

I'm a big fan of IOT and home automation, with one exception: door locks. I wouldn't trust any electronic device with my door lock. There's just so much more that can go wrong, both from a technical and a security standpoint. Also, electronic door locks aren't THAT more convenient than my physical house key.

With locks it's kinda reverse that a homebrew solution might actually be more secure than a commercial one (consumer grade at least). Mostly due to security by obscurity. The average thief won't take the time to reverse engineer your lock solution but just pick the next best break-in option which would be smashing a window or breaking the lock/frame. (Unless of course you have really dedicated enemies that want to specifically get something, but then no solution would be perfect. They will just bash your door in with an axe). But a thief might scan for Bluetooth signatures of known broken lock systems and just do drive by brake ins that way.

I'm thinking of building a elektronic lock solution myself because it would actually increase security for me. As currently I often neglect to lock the doors when going to the back of the yard. Mostly because I don't have the key on me. And my kids are at an age that they will still neglect it for many years. A quick drive-by thief could be in and out in no time. An electric lock with a rfid and keypad would be a proper solution as it always locks when you close the door and are never locked out (unless the power fails but then you use a backup key stored somewhere safe).

An electronic lock doesn't have to be impenetrable, just take more than 5 minutes to break into. This is about as long as a determined thief might spend picking/breaking your regular lock before they're in or they move on to the next target. If you add a bit of obscurity in the mix you could be just as safe. A smartlock that looks like a regular lock, or has all the "smart components" on the inside of the door (like smart bolt-on key turners) would not stand out.
I have a story for you. You see my daughter had hard time turning the key in the old lock. Somebody else had to open the door for her all the time when she was coming home from nearby playground. Even she had her own key she was lacking physical power to turn the key.

So my solution was to buy an electromagnetic lock, which also could be opened by key in case of power outage. And I did exactly this - an RPi was in charge of opening the door via my private WiFi network so when my daughter was coming home, she was connecting her smartphone to my WiFi, launch an app I also wrote and used that to open the door.

Now the funny thing is that the electromagnetic lock was so sensitive that it required a lot less power to open it via its mechanical key so she ended using that most of the time, only in rare occasions of a new friend she was showing off that she is able to open the door via phone.

Thanks for sharing! Will try it out ;)
A RPi Zero W is only $10 where I live and sometimes is on sale for less.