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

@kamran

I believe this is what your circuit will need to look like. The only detail I am not sure of is exactly where in the old alarm panel’s wiring you were measuring the 13.4V and 0V readings based on the door being opened or closed. I am also not 100% sure about how the old panel’s end of line resistor is wired into the circuit.

Of course, I probably do not have your input pin on the ESP8266 correct. This is just for illustration if you were using D1 as an input pin. Also, there is a chance that adding this circuit to your alarm panel will cause the old panel to think someone has tampered with the wiring, thereby setting off the alarm. You may need to change the voltage-divider resistor values to much higher values, like 100kOhm and 33kOhms. Since I have never had an alarm panel, I am just using my best guess here.

1 Like

Thanks so much for making this! I updated wiring on where I was receiving the 0V and 13.3V. Please see the attached image.


Would the rest remain the same (since my wiring on the panel is a bit different).

And will I only have 4 connection to the comm for all of the 4 inputs (1 per sensor)? Or can I just use one comm for all 4 of them?

Same question for the resistors, would I need just two or will I need two for each input. So a total of 8?

Thanks again!!!

@ogiewon But I never tried measuring the voltage from before and after the resistor as you did in the picture. So I will use my multimeter to check the voltage for that and let you know

Also, this is how the alarm (according to the manual) sees the status of the door:

Open: 8.9-13.9 VDC
Normal: 2.5-8.5 VDC
Short: 0.0-2.0 VDC

@ogiewon Just tested the voltage as you showed in the diagram (before/after the resistor). And that also provided a 0 & 13V combination. Would you like me to do the connection using that route or the other method (my previous post with the attachment) that shows the 0V/13V being obtained differently?
And it would me much appreciated if you could answer my question about the comm & resistors from that post.

Thanks again for all of your help!

Thanks Nate! Yeah, my 5 x 96 cent relays are coming from China (AliExpress) and will probably take 2 to 3 weeks to arrive. I burned up all the ‘smarthouse tolerance’ my wife has while playing with my “new” security sensors (thanks again) this weekend… I was trying to sync the various door sensors up with my smart locks, etc. I think I was driving her crazy open and closing doors waiting for them to relock, etc. Anyway, the last thing I need to do anytime soon is play with a siren. :grimacing:

Tyler lol, good luck with the testing of the siren, I was driving my wife and the dog nuts lol. she almost broke the siren on me.

Hi Nate, I had an incident early this morning where my wife opened the door to let the cat in, and closed it. Later I noticed that ST was notifying me that the door had been left open. The door was closed and locked. I had to open/close the door to get the door to show up as closed in ST. I’m sure something like this is always bound to happen. Do you think there might be a way to audit the sensors every x minutes to correct any missed events like that?

Yes, I’ve had these kind of out-of-sync problems occasionally, too. I’m not 100% sure what exactly causes it. But be assured that I am working on a solution. Your idea to audit/poll the sensors periodically is a good one, and I’ve considered that. It’s probably a quick fix.

I also am thinking about implementing a “Refresh” capability on the device so that you can tap a refresh button in the ST app to force the sensor to refresh its current state.

In any case, I’m still actively working on improving this library and have a few other NodeMCU ESP8266 / SmartThings projects in mind, so you can definitely look forward to some updates and improvements. :wink:

1 Like

How difficult is it to update ESP8226 after the initial setup? I would assume bringing a laptop to the alarm panel would be more simple than disconnecting everything? And from a software perspective is it simple or difficult to update changes.

Hopefully this will make more sense to me when I actually receive my ESP8226 and follow your instructions.

Hopefully the software will be more stable by the time I receive my ESP8226 so I won’t have to update it. I am using a pollster smart app for some of my devices currently, not sure if that could be used with ESP8226

Glad to hear Nate, you have done a lot and done an amazing job. I figured out how to create a flash finally and was able to get the OLED working. Still on the old firmware though. I dug through the new firmware but I’m new to Lua and haven’t found an issue yet.
I changed the coding a little. When I powered the esp8266 up, I had to go around, open and close the doors. Did a little updating of the code. Now when it fires up, it sends out the sensor states to st to avoid running around. I haven’t figured out the polling yet. I have voice setup through st, if I force it to update. I would have all kinds of voice ques. Looking forward to what you get going with that.

Thanks for everything you’ve done so far.

I have a few ESP8266, I update a new one. Take it to the panel and swap it out on the breadboard. If you have a laptop you can take it to the 8266. Its easy to update, takes a few seconds after you get it going. Software itself is pretty stable. Mostly what you see here is everyone looking for features or additions. I haven’t had any missed statuses as of yet. But with my additional code, it may have slowed it down some so I don’t have that issue.

1 Like

Thanks for the info! Also, it would be much appreciated if you guys can post some pictures of your setup. I plan to follow @ogiewon’s diagram but pictures will allow me to better visualize where I should connect everything.

This is my first time doing something like this and I don’t want to damage anything, especially my alarm panel.

Thanks everyone!

@kamran I just take my laptop into my closet where the alarm panel is to update the code. It only takes a few seconds. I’ve read about a few approaches for over-the-air updates. Maybe one day!

@JimVb Yeah I had one other person request the ability to update the state of the sensors immediately after boot-up. This should be easy (sounds like you’ve already done it). I’ll try to add this capability, too.

If you guys have other feature requests and/or issues please post issues on Github: https://github.com/heythisisnate/nodemcu-smartthings-sensors/issues. This allows others to +1 them so I can get a gauge for how much demand there is for the feature. As I said before, I do plan on continuing to improve and add to this, and your feedback will definitely help guide my priorities. Also this thread is getting a little hard to follow sometimes.

1 Like

I have an odd setup. I had a panel and sensors but no alarm installed. I ripped the guts of the panel out and started new so it was a clean setup. I glued the breadboard to the back of the panel. Knocked a pop out to put the OLED in. Used Cat 5E to run everywhere as its low voltage.

2 Likes

@kamran

Can you please draw and post the exact wiring configuration of one of your Alarm Panel Door/Window sensors circuits?

I need to understand exactly how that resistor is wired in before I can tell you where to get the signals for the ESP8266 circuit.

There should be at least three components - 1) The Alarm Panel Circuit Board, 2) the resistor, 3) the magnetic reed switch at your door (and the associated wiring, of course.)

Specifically, I need to know if the magnetic switch is wired in series or parallel with the resistor as shown in your panel’s wiring diagram for circuits 2, 3, 4, 5, 6. Parallel is represented by the horizontal switches in the following diagram. Series is shown by the vertical switches below. There should be only one way that they are wired, hopefully.

1 Like

Thanks for your assistance. Hopefully this better illustrates my wiring:

Here are some additional pics & info that may be helpful:

1 Like

@kamran

OK, so I have been thinking about it some more. I believe you should wire the circuit the way I drew it. This ensures that the Comm/Gnd of the two devices is always at the same potential for consistent voltage readings. It also prevents your Alarm Panel from seeing a closed circuit through the voltage divider when the door switch is open. I am guessing that wiring it the way you changed my diagram would result in your alarm panel no longer working as expected.

You may need to invert your HIGH/LOW (i.e. OPEN/CLOSED) logic in the LUA code. Not 100% sure.

Yes, you will need a voltage divider circuit (pair of resistors) for each zone/circuit you want to monitor.

All of the COMM terminals on your Alarm Panel should be at the same potential, so connecting just one of them to the Gnd on the ESP8266 should be fine.

1 Like

Thanks again, once I receive everything I will go ahead and wire it as you did in the original diagram.

I am not sure either if I will have to invert it or not, the only thing I will modify initially is to disable the internal pull as you suggested.

And for testing before I mount it to the panel, I just connected the ground to the input (D1, D2)?

Here is a picture showing the voltage:

Thanks again for your help

For testing, while completely disconnected from the alarm panel, connect D1 to Gnd OR D1 to 3.3v on the NodeMCU ESP8266 board. This will simulate the two states of the door switch.

Before hooking up the NodeMCU to the Alarm Panel, verify your wiring by checking the voltage with a meter between the wires that would be connected to D1 and Gnd on the NodeMCU board. The voltage should toggle between 0 and ~3.3v instead of the 0 and 13.4v.

The reason for turning off the internal pull-up resistor is due to the fact that when it is turned on, the NodeMCU board will output 3.3v on the D1 pin (or any other pin it is enabled for). Having two voltage sources connected together would be bad, as they will fight with one another.

1 Like

I just updated the code with one feature that many have asked for: the ability to report each sensor to SmartThings on startup to set the initial state. Plus I’ve also cleaned up the code a bit and added more comments.

If you’re updating an existing installation, you only have to update the application.lua and take a look at variables.lua.example for a new variable introduced that you’ll have to set.

The new feature is in master on Github.

3 Likes