Adafruit Magnetic contact switch

I want to buy one Adafruit Magnetic contact switch so I can know if my door is open or not using my Raspberry Pi 2 and HA but how would I make this work. I can’t seem to find any good instructions for how to connect the Adafruit Magnetic contact switch to HA and a RPi from A to B. I have no idea about what code to use and things like what GPIO ports to use?

How would I do this?

Thanks :slight_smile:

This will help

Binary Sensor, But wondering if your door is so close to where your HA is, and the run of your cable to it. Could just try a wireless solution

If I did do the wireless solution or the wire solution how would I do that because I am still learning about HA.

Well @Dylanmurphy, if doing the wired, you can simple connect your sensor to pins 11 (or any pins you want to use) and GND (I believe they are two wired) on the RPi as illustrated above in the link. This I have tested but doesn’t use, but really works fine.

On wireless solutions, the beauty abt HA is that it covers many devices, that you can use so many but before deciding you can consider a couple of things

  • cost
  • easy of use
  • zwave, RF or Wifi (the later being not so friendly to batteries)

One cheap way I do it, is to get a Sonoff Basic, load it up with the Tasmota firmware, and if I control a socket close to my door or window, I use the same Sonoff for power control and connecting it to the magnetic sensor also sense my Window or door. This solution to be honest isn’t so elegant, and ease of use is one of them meanest, but its cheap and works :slight_smile:

You can use RF, as I am in the process of testing one with the Sonoff Bridge and DW1 sensors, but can’t comment on that as I know not how good it it. Maybe there might be someone else in the forum that knows more abt that, ending when I get my kit in. There might be other wireless and more user friendly ones, as I am one that focuses on cost first before another thing else, I haven’t tried my hands on other techs.

If money is not your issue, them my friend just go zwave. I have no zwave device at home but from my little research, its quite reliable and you can get good looking ones. Wireless and so more elegant and I believe easy to use. Try those from Aeotec, heard a lot abt them and they have a bunch of other cool stuffs.

Hope this helps? Regards

Thanks, @Odianosen25 Ill have a go at one of them.