ESP8266 into existing alarm DSC System

Since I was already using the AsyncWebServer, for an alternative OTA upload method, I’ve added AsyncElegantOTA support to the sketch. It’s a nice tool. See here for details: ESP32 OTA (Over-the-Air) Updates - AsyncElegantOTA Arduino | Random Nerd Tutorials

@Dilbert66 Good news! It’s working.

Only tested briefly, both Telegram and VirtualKeypad are working. As it was before, the first Telegram command was ignored. Other than that, all commands that I’ve tested work as expected.

I haven’t tested the build that with Elegant OTA features yet.

Awesome! On the issue with the first command being ignored, I did that on purpose. It’s an oddity with the Telegram API that I have to address. For example if you send a reboot command or send a command that for some reason causes the ESP to reboot, on restart, the ESP will get the previoius cmd as new again, and cause a reboot loop. I have to work out a better solution then ignoring the first cmd on startup.

I think it does not matter much as long as you knew it.

The Tools->port on my Arduino IDE still greyed. It must be some settings in my home network. I believe I still have to make a trip down to the basement, climb up a ladder (mounted on celling of store room) and pull the WT32-ETH01 out everytime I make an sketch update!

Thank you so much anyway.

That’s why I added the async elegant tool. You just need to go to the /update path on the web page. You don’t need the ide except to export the binary. Read the info in the link I provided above. It creates a special web page that you access directly. It doesnt matter if the IDE can see the esp. As long as you can access the virtualkeypad you can access the /update subdirectory at http://<ipaddress>/update

That’s awesome! Will try it later tonight.

I uploaded the build you pushed couple of hours ago using ElegantOTA. It works but not without any problem. I have no problem invoking the update screen (except it asked for username of which I don’t know!). Upload of firmware to WT32-ETH01 was smooth and fast. I then upload ‘index.html’ using Filesystem radio button, as I can only chose file instead of uploading folder and ‘index’ is the only file that has been changed.

Telegram part runs without any issues but not the VirtualKeypad. I guess it is because the ‘data’ folder (or some files of it) was not uploaded properly. I then upload the ‘data’ folder with the old way (connect to laptop via USB programmer) and VirtualKeypad is running again. However I found data entered through Telegram command (e.g. /addzones, /setnotifyflag) was lost. Is there a properly way to upload ‘data’ folder using ElegantOTA?

Anyway, upload firmware alone using ElegantOTA already made my life much easier.

The username/password I setup is to use the same as the otaaccesscode for both. So if you set your otaccesscode to be 1234, then the username will be 1234 and password will be 1234. If you don’t want a password at all, you can just not put anything for the otapassword.

Secondly, to upload the data folder requires another step. You will need to follow the instructions as explained in one of the links I sent you. Read this section about 3/4 of the way down the page:

Upload Files to Filesystem OTA (Over-the-Air) Updates – ESP32

in this page:

Basically it involves using the Export Sketch data upload function again, but instead of having it upload, it will fail but still create the “bin” file. You just upload that file itself using the OTA.

As to the config parameters, those are stored in the SPIFFS folder so whenever you upload a new one, you will lose the stored version since it uploads the whole partition and not just individual files.

If keeping your settings is important, I can show you how to create a json formatted file that you can edit on your local pc and place in the data folder so when uploaded, it will have all your settings.

If you want to keep your settings on every upload of the spiffs data, create a plain text file called: configFile and place it in the data directory. The contents are a json string with these variables:

{"zones":[1,7,8],"ids":["12345679","12345678"],"notificationflag":255,"password":"1234","accesscode":"1234","otaaccesscode":"1234"}

Of course, the values will depend on your own setup.

Oh I see! I found the SPIFFS.bin was generated in Arduino IDE log after running ‘Export Sketch Binary’ but didn’t pay attention to its path. I finally found it somewhere in AppData folder.

My settings is not that important. It is only a few settings afterall. However, you can push a sample json formatted setting file to the GitHub if you have spare time. Is the json formatted ‘Settings’ file also stored in ‘data’ folder?

May I ask is there any reason you did not use any Arduino Telegram library such as AsyncTelegram2 or UniversalTelegramBot?

Sure, I can place a sample config in the “data” folder on github.
The reason I did not use any of the existing telegram libraries is that they all have problems. The universal bot, is not async and will incur delays when polling or pushing messages to telegram. This can cause loss of data. This might not be as necessary with the DSC library but it is very problematic with the Vista alarm system that I also develop for. Being async is very important when using long polling as the bot will wait up to 1 minutes on a connection waiting for data. FYI, long polling is used to minimize excessive traffic and connections to the telegram API. As to the Async Telegram library, it has issues with sending data while polling. It will lose messages at times when it’s waiting for updates. Those were all very problematic as I needed to ensure no data was lost. So the only solution was to write my own version tailored to the needs of this app.

Edit: now this was quite a few months ago so perhaps the issues I noted are no longer a problem but since I already have telegram working the way I want, I don’t feel the need to migrate over.

Thanks so much for sharing all these insights. Really learned a lot through this project.

Edit: I forgot to mention right after I plug Ethernet cable back to the laptop, the WT32-ETH01 device is shown under Tools->Port in Arduino IDE! I don’t know why but now I can upload sketch and data through OTA under Arduino IDE or using ElegantOTA.

I have not discovered yet the mystery of why sometimes the devices are not seen. I have not spent too much time looking into it. It’s possible that you need to make sure that your are on the same network. If not, the router has to broadcast the mdns messages to the other networks. I’m not sure. Not a network expert. This seems to also be a problem at times with ESPhome devices not always seen.
At least having two ways to upload the sketch will save you a lot of climbing and agravation! I know it saves my knees from the stairs ! haha.

Hi all,

Firstly, thank you for all the excellent work you’ve done putting this together @Dilbert66!

I’m relatively new to HA and have been dabbling with the basic things and this was exactly what I wanted to get up and running next. I set this up (custom DIY board setup), customized the yaml from the Master branch to what I needed to suit my requirements and plugged it into my DSC PS1616 board. While things came online and I started seeing some of the sensors update accordingly, what I did notice was that the Trouble Status sensor was flapping between detected and not detected.

I pulled it offline thinking I might have messed something up with the yaml, so uploaded the yaml exactly how it is on the master branch with some small tweaks to work with my wemos D1 mini etc. At this point, I received a phone call from the company that monitor my alarm advising that the panic button had been triggered. I asked them to stand down, however, I noticed the same issue as before.

I also tried the Dev branch and had the same issue with this as well. After receiving the call 3 times, I called it quits and figured I should ask here if there was something obvious I was doing wrong. I have tried two different wemos D1 boards (both from a working implementation in the house) and regardless of what I do, the moment I plug it into the board and power it up, the panic mode gets triggered and I see the Trouble status bounce between detected and cleared.

I didn’t manage to get logs of the first couple of attempts due to the phone calls and needing to pull it offline.

Any pointers would be massively appreciated.

First thing I should note though that when working on your alarm system you should call your alarm company first and tell them to put your system on test (or use their online app to do it) for some period of time so that their system will ignore any events during that time. You could also disconnect the phone line from the unit as well so it doesnt try and dialout. It will give you a trouble indication though about a comm error so be aware of that.

Now as to the issue you are having points to either a wiring issue. I’ve never tested on a pc1616 so have no idea if it works but as far as I’ve read it should. The fact that you’re getting false key presses is odd though but still points to a wiring or pin misconfiguraton issue. Logs would be helpful to know if you are indeed getting valid data.

1 Like

@Dilbert66 did you workaround to no longer need this?

Today I was able to perform and OTA without switching off frontend switch :open_mouth:
Thank you,

1 Like

@Nish , I experienced similar situation (trigger Trouble status) long ago when I mistakenly shorted the CLK and DATA. I would suggest disconnect the D8 from the DATA bus as you don’t need it to get a log from your D1 mini.

1 Like

Hmmm, I checked for connectivity/continuity before pluging it in. Might go back to a breadboard and test again and get some logs.

Might also order some PCB’s as to rule out any soldering issues on my side as well.

thanks either way. Gives me something to look into.

Yes, I added a turn off action in the ota section.

1 Like

Check your ground also. Make sure that’s connected ok to the black wire.

1 Like