Convert Your Wired Alarm System into a SmartThings Smart Home Monitor System for Under $25 with NodeMCU ESP8266 (2017)

0 means closed, so this event shouldn’t have caused an intrusion alert. Are you sure this is the right log message?

It’s the right smartApp (Cloud Sensor) from the live log and the only entry. It’s the sensor that SHM said caused the intrusion. I’m not sure why the live log didn’t catch both events that the ST app shows in this screenshot.

I went ahead and reverted the Cloud Sensor smartApp code shortly after this event, even though the change seems benign, just because I can easily rule that out before I start randomly wiggling wires. There have been no false events since the rollback of the cloud sensor code, but I’ll see what happens in the next 24 hours. If I have no false events, I’ll reintroduce the latest code to see if it starts happening again.

It’s not possible for that one-line change to have caused this.

You might want to try adding another log debug line in the handle_event() function in the SmartApp higher up to capture every event that’s coming in from your device in your live logs. I would add a debug line just after event is assigned on line 55:

def handle_event() {
  def event = request.JSON
  log.debug event

Hi, I have an Spectra 1738 board. I am not sure how to wire my existant cable to the NodeMCU ESP8266.
Anyone can help me? Thanks

Nate, I have an old Honeywell LynxR-2 Series Alarm. All the sensors connected to the alarm system are Honeywell 5816 wireless sensors. Will your program work with this system?

I have no wired sensors connected to the LynxR-2.

No, as far as I can tell the Honeywell LynxR-2 does not have wired outputs that you can tap in to. Sorry.

Hi Nate,

Great work on this Release. Looks really good.

Is it possible to add a GSM SIM Shield to the NodeMCU as a backup internet connection? Internet goes down a lot, and having such a reliance on the ST Cloud could be more risk than some are happy with.

What do you think?

Also, does it matter if I buy the LoLin or Amica boards? Quite hard to find the board and it’s accompanying base. I assume I’ll need a base for more inputs [5 doors, 3PIR, 2 Panic buttons, 2 Sirens]

I assume I’ll also need 5 relays for the powered PIR and Sirens, does the NodeMCU support that many?

Thanks in advance for your help.

Thanks Nate. Ok so the LynxR2 won’t work but I can upgrade to a 20P which does have the necessary taps. My question is this…

Will the program work with a Honeywell 20P with all wireless sensors? I have no hard wired sensors.


@Vyker Adding a backup GSM internet connection to the NodeMCU board may be possible but I haven’t looked into it and I doubt that it would be simple to do. You’d most likely need to do all the programming yourself to detect when a connection is down and switch over. I don’t know if this is even possible/feasible.

Instead, if internet drops are a common occurrence for you, I would suggest investing in a backup ISP and a Multi-WAN capable router for your home Wifi network. This way, you don’t have to configure anything special for NodeMCU board, as the backup internet connection would kick in transparently at the router level. TP Link has a consumer model that seems like it would do the trick. At my work we use a pfSense gateway/firewall which has great multi-WAN support and a bunch of other networking and security features.

Functionally, the LoLin vs Amica boards both behave the same. The Amica board should be used with a breadboard to do the wiring and connections. The LoLin version is too wide for a single breadboard, which is why the purpose-built base is convenient for connecting those devices. The base does not give you any more inputs (it just may be a bit easier to make the connections), so with that many inputs/outputs, I would recommend buying two boards. Each board only gives you 6 or 7 usable GPIO pins. The reason I like the LoLin board with base is that the base has a built-in voltage regulator that accepts a wider range of input power (6V - 24V) so you can power it directly from the 12V output from your alarm panel as I have done.

If you’re willing to wait a few weeks, you can get the LoLin version boards/base cheap from China via Aliexpress. I’ve had good experience with these: board, base

I’ve received a lot of questions about the different ESP8266 board versions, and I’m working on building more extensive documentation on this. Coming soon!

Regarding the PIR motion sensors, you do not need a relay for these. Most (all?) of the wired PIR sensors that I’ve seen have four wires. The black/red pair is for the 12V power and needs to be continuously connected (these are probably already connected to the 12V power output of your alarm panel – just leave them be!). The other pair (yellow/green usually) is for the signal, and that does’t have any specific voltage requirements. Just hook them up to the NodeMCU board just like a contact sensor and it should behave the same way.

You can use a single relay to power both sirens, unless you wanted to be able to set up and trigger the two sirens independently, then you would need two relays. Right now my code only supports one “Alarm” output per board, but the SmartThings Alarm capability allows for a “siren” and a “strobe” so technically you could use two separate relays for the same device. For simplicity though, I would suggest just wiring them both together.


@hionhifi I don’t have any specific experience with these Honeywell systems, but in theory you should be able to make it work if you can program the necessary outputs. Based on the datasheet that I just found online by Googling for the 20P, it sounds like the outputs are 12V and need to be programmed. You’d have to step this down to 3.3V to avoid frying the ESP8266. It would also require some modification to the code to disable the internal pullup resistors, because the Honeywell panel would be providing the signal current.

The short answer is, that this project wasn’t really designed with connecting wireless sensors via 12V relays in mind, so it may work, but probably not easily.

I understand. Thank you.

Bought - Thanks :slight_smile:

Any recommendations on which relays to buy?

Edit: bought this one… Relay

I see, how about a completely separate Arduino board that has a SIM and Sketch that outputs to RJ45, and then just add an Ethernet shield to the NodeMCU? [I have very little experience in all this, so feel free to send me to the manual :stuck_out_tongue: ]

Hello again

Going through your guide, which is great and detailed. I’ve fallen over at the POST request.

Is ST oauth down or something? Getting Error 500.

Any troubleshooting tips would be great.


Edit, spotted a typo in redirect_url - changed to uri and the error is the same. 500.

Yes, that’s the same exact relay that I’m using. It works great.

how about a completely separate Arduino board that has a SIM and Sketch that outputs to RJ45, and then just add an Ethernet shield to the NodeMCU?

Hah, you make it sound so easy! Unfortunately, there’s no plug-and-play “Ethernet shield” for the ESP8266, and no libraries that currently exist in the NodeMCU firmware that would enable ethernet communication. If you do a google search for it, it looks like there are some people who have successfully connected an ESP8266 to ethernet, but it doesn’t look like it’ll work with the standard NodeMCU firmware.

Even if you were able to give the NodeMCU a backup internet connection, you wouldn’t completely solve the problem in the case of a network outage. If an intrusion alert were to happen while WiFi is down, then the signal from SmartThings to your Hub, and from the Hub to the ESP8266 that instructs it to turn on the siren would not work.

If internet flakyness is really a concern, again I would suggest setting up a backup ISP and failover at your home router level.

Regarding the 500 error on SmartThings, I’ve seen this caused by one of the following:

  1. You forgot to Save and/or Publish the SmartApp
  2. You need to enable OAuth in the SmartApp settings and then Save/Publish again
1 Like


That alone is enough reason to bin the idea of a secondary connection. The risk:cost ratio of the Wifi going down versus the cost of an additional ISP + new router, doesnt make it worthwhile, thanks for taking the time to have a think about it nonetheless.

Oauth is on, and published. Just re-updated and re-published - ran the POST and same 500 Internal Error.
Maybe they changed something?
Does being on make a difference? [even though I tried both EU West and Graph direct.]

Error in more detail :

I’m not sure, you might want to try getting another code (repeat the first GET request) because they can expire.
If that doesn’t work, contact SmartThings support? Unfortunately that error message isn’t specific enough to know what the problem is.

Hi Nate,

We’ve chatted before and you answered a number of my questions and guided me towards the right items to buy. I’ve received everything—including the relay for my siren. I purchased 3 NodeMCUs because I have 18 devices (17 sensors & 1 siren). Do you have a special version of the Variable.lua file that addresses each NodeMCU’s digital pins? Also, you mentioned that the NodeMCU has 6 or 7 pins that can be used reliably. Are there some pins I should always avoid using, or is it going to be a hit or miss process? Lastly, what else do I need to utilize 3 NodeMCUs (besides daisy-chaining the power from one MCU to the next from my security system’s board)?

[quote=“heythisisnate, post:9, topic:84285”]

Unfortunately, that’s correct.[/quote]

Forgive me if I missed an already existent answer to this in my skimming of this thread, but have you worked out a way to make your solution an adjunct to the existing security monitoring system rather than a complete replacement of it? By that I mean wiring it such that the existing security monitoring continues as-is, but so that your board also receives the needed signaling so that it can inform ST of hard-wired sensor events and status? It seems that that would constitute the best of both worlds or people like me who already have monitoring services they’re quite happy with, and that offer the significant benefit of not being knocked out by internet failures.

Yes, it is possible but requires more complicated wiring. I have helped others accomplish this with both my ST_Anything project as well as Nate’s solution. The details are in the thread below and does require some minor code changes to use Nate’s solution.


1 Like

Thanks. I’ll look into that in more detail later this evening.

1 Like