Connect wired alarm system sensors to SmartThings with a NodeMCU ESP8266 [deprecated]

I would try it, and if that doesn’t work then try this - disconnect the siren pins, fire up your Node and let it connect to WiFi, and then reconnect them. My siren is on D5 and it only works when I connect the pins after the Node is already turned on.

I’ve searched this thread so I apologize if this is already posted and I can’t find it. My wired contact switches for windows and doors have 2 twisted pair wires. I’m unclear where I attach these wires to on my Adruino MEGA board. On the contact itself they are attached to 2 terminals but not sure where I connect these on the board. Sorry for the basic question this is my first attempt with the boards. I’m a software engineer but the wiring part is new to me. When I had my house built I had it wired but I’ve never put in an alarm system so I don’t have an existing alarm panel to look at for reference.

Hi with the set up you have are you only using the sensors with smartthings or are you still using the alarm panel as and alarm interested with smartthings?
Thankyou

I don’t have an alarm panel just the wires. I had it prewired when I built it but didn’t put an alarm panel in. I will only be using it with SmartThings.

So is yours not used for security or can you still use it for security?

Eric,

Just trying to help from afar… Your door/window magnetic reed switch has four wires attached to it. I have not seen this before. Are there actually four screw terminals on the contact switch, one for each wire? Or are some of the wires doubled up? Can you take a picture of the side of the switch where the wires attach?

At the point in your house where all of the wires come out of the wall (i.e. where your alarm panel would be installed, if you had one), do you have 4 wires per sensor? In other words, do you have 1 gray cable (with 4 wires inside, white, red, green, black) for every contact sensor? I am curious if the pre-wiring was done in a “zone configuration” with only one set of wires coming back to the alarm panel area per a gorup/zone of doors/windows.

Usually a magnetic contact sensor, like the one you have pictured above, is simply a single pair of normally open contacts. When a magnet is placed near it, these contacts are closed, completing the circuit. In this way, if a wire is cut (intentionally or accidentally) the alarm will be triggered, the same as if the door/window was opened causing the magnet to move away from the switch.

You should only need to use 1 pair of wires per door/window switch, attached to whatever processor you choose to use. You mention using an Arduino, however this discussion thread is specific to using an NodeMCU ESP8266 board. Which processor are you planning on using? If you’re using an Arduino, you may want to look at my ST_Anything project. ST_Anything works with both Arduino’s as well as ESP8266 based boards.

Regardless of the processor you choose, typically you will wire one side of the contact door/window contact switch to the GND terminal on your Arduino/ESP8266. The other side is wired to one of the digital input pins on your board. By using the “Internal Pullup” feature, the board will send a +5v or +3.3v out the digital input pin to the switch. If the door/window is closed, the switch will be closed, thereby connected GND to the corresponding pin on your board. This will be detected as a “LOW” state of the pin by the software. When the door/window is opened, the circuit opens up, causing the Internal Pullup feature to put 5v or 3.3v on the pin, resulting in a HIGH condition being seen by the software.

Hopefully this helps explain the wiring. I am still confused by your contact sensors having 4 wires attached to them, though…

Dan

Dan,

I should have taken the picture of the other side of the sensor so you could see the terminals but I think I can easily explain. Each pair of wires are twisted together at the ends and there are 2 terminals on the contact switch like it sounds like you expect. So each terminal has two wires connected to it because they are twisted together. I read somewhere that installers will do this (use 4 wire) for future expansion (but for what I don’t know).

On the other end where they came out of the wall and where my alarm panel would be I do have 4 wires per sensor so I doubt they are setup in a zone configuration. I think it’s a case of them using more wire to do the job than is actually required. Maybe on some alarm systems there is a use for the 4 wires but your explanation actually helps and I think it answers my question on how to wire it to the board. I can probably just twist the pairs together like they are at the contact and effectively use it like it’s two wires and connect it as you have described in your last paragraph and I should be fine.

Thanks for providing the link to your ST_Anything project and I see there are sketches for the Arduino Mega board there. I did order a NodeMCU ESP8266 as well because they are so cheap and I’m sure I’ll find a use for both of them in my security setup as I have many sensors. I will probably continue with the Arduino at this point mostly because it seems like I can connect more sensors to it than the ESP8266. If that’s the way I go I’ll post in the other thread you gave me instead.

It’s nice that everything is pre-wired but having an existing panel would have been nice too so I could see how things were terminated at the panel. I have to use a line toner to figure out every wire, which I’d never done before. I built my house 5 years ago and am just now getting around to this and finding out that the guys who did my low voltage structured wiring really didn’t do that great of a job. They didn’t wire at least one door. They didn’t put both sides of the contact switch in (the non-wired magnet side) and a few that are just placed wrong. I will have to end up also using some wireless sensors in a few places because of this, which irritates me. The upside is that I will probably learn more this way but will take me a little longer.

Did I answer all the questions you had for me? If you still need a picture let me know but thought I could explain it just as easy.

Thank you for your reply! I think based on what you told me I can get it wired up and try it out.

Eric,

It sounds like you’ve got a good starting point. I also had a home that was pre-wired for an alarm, and I also used a toner to figure out my wiring. You should label each cable as you figure them out to make sure you know what’s what later on should you ever need to rewire the controller.

Good luck and have fun!

Dan

I was looking at passive monitoring of my alarm panel also and ran across this video … https://www.youtube.com/watch?v=4zM6cMby_QQ.

A bit painful to watch in its entirety but around the 12 minute mark you will see an implementation of the 4 wire interface. Basically your 4-wire contact gives you the best option for EOL resistor configuration: the convenience of being able to place the EOL resistor at the panel while giving you the best troubleshooting visibility into the physical wiring.

I thought it interesting as I’ve never seen this before you posted the photo.

Hi Nate, I am still working away at this, I finally have my relay now (ordered two for good measure) they are the 5V ones, but you said they should work fine, although i have a doubt. I have tested the relay with the blink example code ,and connecting a light socket & bulb, and it switches on and off fine. So i know the really is working. However i think i am missing something on the alarm side. So i have everything uploaded to the NodeMCU, i have all my sensors setup on ST (only contact, no motion), I also have my ALARM setup on ST. For testing purposes I have only one contact sensor in the variables code, and the details for the strobe. (I want to test with the light bulb, as not to upset the neighbors with my siren!). So i connect everything, ( just breadboard testing, not actually connected to the alarm system yet). Upon “plugging in” the blue light flashes on the NodeMCU, it connects to wifi (viewing Esplorer window) and on the relay, the red led comes on. If i disconnect the wire connected to D6 (Front Door) it reflects in ST saying OPEN. I am assuming, if i turn the ALARM button on in ST, then upon disconnecting D6, the siren / strobe / light should come on, right? How can i test the siren part is working correctly?. Cheers in advance.
FYI: i have the strobe pin set as 1, the port as 8100 and the deviceID from ST.

Matt,

Head over to if you haven’t heard of the latest announcement. We’ve come up with a 2.0 solution, which is a lot more stable and easier for you to install.

Thanks @copyninja appreciate the reply, and wow, great work, Congratulations to you and @heythisisnate!! I have a meeting now, but the second i finish i will be jumping straight into 2.0! Cheers

Hey @copyninja, quick question, reading through the docs there are some links not working, as i am sure you are aware, I assume I can just follow the original instructions form @heythisisnate, curious if there is any specific change due to the new version. The links i found that are broken are:
Install Device Handlers - Can use the Original guide?
Add Connected to Smart Things
Wiring a Siren / Strobe - Can use the Original guide?
Assign Device Pins to Things
Set up Smart Home Monitor.
Also, this might be a stupid question, but it says in the Getting Started you need a SmartThings Hub, and links to Amazon to buy one, i was under the impression you didn’t need the hub for the project, do you now need one with V2?
Cheers, for the great work.

No, for Device Handlers, follow instructions like installing SmartApp except that you need to do it in My Device Handlers section. http://docs.konnected.io/security-alarm-system/install-smartapp/

Yes, you can follow the original guide for this one

SmartThings Hub communicates with Cloud and your home network. Without it, you’ll have to expose ports out through your router, which can be a security concern and too technical for some folks.

This device should work with Hub V1, doesn’t have to be Hub V2. As of now, we cannot confirm if this would work with
Samsung Connect Home.

@copyninja thanks for the quick reply. Actually when i said V2, i was referring to the new Konnected version, wasn’t even aware there was V1 & V2 of the Smart Hub lol. I should be ok with opening ports, i think, i will let you know once i get to that point, if i have any issues. Cheers.

You do need a SmartThings Hub on the same LAN as the Konnected device at least for the initial setup and if you want SmartThings to be able to trigger the siren.

I thought you needed a SmartThings Hub to even have a SmartThings account in the first place. How do you have a ST account without a Hub?

For now we do not support port forwarding and we most likely will not since it will spin off a different version of SmartApp. I doubt that you can use Smart Home Monitoring without SmartThings Hub at all.

@heythisisnate @copyninja I went to the Smart Things website and signed up for an account and that was it. I followed all your steps in the first guide, there was no mention anywhere of a hub, or i completely missed it, and got as far as i told you, i can have the app opened on my iPhone / iPad and connecting / disconnecting the jumper wire reflects that the “sensor” is open or closed, I have literally just tried this with my iPad on the same WiFi network, and my iPhone on 4G data, and IT WORKS, the change is reflected. I never got as far as setting up the Siren, as was waiting on the Relays, and then couldn’t get it to trigger, hence my message a couple of days ago. I may be missing something, but why do i need the Smart Things hub, if the changes are being reflected in the app? If i DO need one, then this is no longer a “less than $25 USD” project, it is now a $100+ project, as i am sure i would have to order a Hub form the US and have it shipped here, as the prices here are super elevated. (for Example, Amazon US the ST Hub is $79, Amazon Mexico it is $3,079 pesos, which converts to $175 USD!!!). I hope it is possible without the hub., I already spent a fortune on Philips Hue / ATV4s etc. lol.

Unfortunately, Konnected Security 2.0 will require SmartThings Hub. The reason it’s mentioned as $25 because we assumed everyone in SmartThings Community will at least own a SmartThings Hub. If you’re still interested to use your NodeMCU/ESP8266 without SmartThings on an alarm panel, you can find that there’s a lot of implementations through youtube or google. For example:

@copyninja @heythisisnate Can I not just continue to use the “original” code? Shame, i had super high hopes for this, it was exactly what i was looking for.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.