ESP8266 into existing alarm DSC System

I like your setup for your esp board. Very clean and easy access. I have my main one in the panel in the basement. The dev panel is on my bench. Why I like OTA and ESPHOME api. Saves me a trip to the basement.

I just pieced some scrap (wall plate, PVC profile) together.

I started working on WT32-ETH01 yesterday but got stuck! Now study code from here: https://github.com/khoih-prog/WebServer_WT32_ETH01. Also I can upload sketch to WT32-ETH01 without issues but not the data folder to SPIFF, seems Arduino IDE uses different python to upload sketch and data. I probably test only the Telegram part first and leave the VirtualKeypad later.

I still could not manage OTA, I meant for the ESP32. After couple of OTA and quit Arduino IDE, I could not get it back. Even though I set all WiFi networks to private and turn off Windows Defender, Tools->port of Arduino IDE kept greyed. Anyway I will keep ESP32 running as is in the meantime.

I will see if I can setup test rig for WT32-ETH01 to avoid travel back and forth to the basement.

This web server might be more appropriate as itā€™s the async version. Odd about the Spiffs and the OTA. I do have a wt32-eth01 here somewhere so Iā€™ll give it a shot.

Great if you have the WT32-ETH01 as well. Yeah, I will look into the AsyncWebServer_WT32_ETH01. If you also have USB programmer, you can try upload the data folder on your end.

Thanks for your advice.

The ota data can also be uploaded via command line without needing arduino. Iā€™ll lookup the required file and command line parameters and give it a try. It bypasses the need for the mdns entry to show up on the arduino. Itā€™s a weird mdns issue I believe. I donā€™t have issues here so my network is different than yours.

After you fixed the time update issue in dscalarm.yaml (ESPhome) and VirtualKeypad on ESP32 is fairly stable, I am not really concern about OTA. Might come back to this later.

I fiddle with the WT32-ETH01 programming for a while and seems I can upload data folder but there is a new problem. It now complains ā€˜memory fullā€™! I used Minimal SPIFFS partition for WT32-ETH01 and size of SPIFFS is only 190Kb. Is that enough for your data folder? I did use the same Minimal SPIFFS configuration for Wemos D1 mini ESP32 but it did not state size of SPIFFS on Arduino IDE.

Anyway, I hook up serial monitor and Ethernet and got the following:
Web Server started
IP address 0.0.0.0
Queue message ā€¦
Send task fail to connect to Telegram api
Reconnect to WiFi

I tried comment out VirtualKeypad but got compilation errors.

Ok, I flashed my wt32_eth01 with the current exact version of the code (wifi still) and then flashed the spiffs data folder. Everything works fine over wifi. Have not tried to set it up as ethernet yet though. I use the same device: Esp32 dev module. OTA works fine also. So there is something different with your network. Possibly your router setup.

That is odd. I did not make any changes to the config on virtualkeypad and everything is ok on wifi anyhow. I still donā€™t know about ethernet yet. Yes, 190kb is plenty for the data folder as the web page data is about 90kb, leaving about 100kb for config storage which really only needs about 1kb. Looks like your device is not connecting to wifi /ethernet router and getting the dhcp address.
Iā€™ve fixed the compilation error when not using the virtualkeypad option.

Compilation errors only happened after you added those ā€˜passwordā€™ commands. In fact, I started testing on ESP32 with VirtualKeypad disable there was no compilation problem.

Yeah, I believe it was not connected to the router through ethernet as well.

Yes, thatā€™s correct. The set password cmd was trying to access variables that are not available when the virtualkeypad is not used.

I made a little progress!

  1. Every upload, no matter it is sketch or data, needs a hardware reset (for me power reset) of the WT32-ETH01, even between upload of sketch and data.
  2. Under Minimal SPIFFS partition setting, 190kB size SPIFFS is insufficient to hold your data folder. Perhaps file storage is not as efficient as we thought. I noticed it failed when copying one of the index file and gave the following message:
    SPIFFS_write error (-10001): File system is full
    error adding file!
    I then removed one of the index file (about 25kB in size) then SPIFFS creates okay.

Now I move on to make the ethernet connection work.

Thatā€™s very odd about the spiffs spacing issue. It works fine on my end. And 190kb is plenty. Can you double check what files you do have in the ā€œdataā€ folder? I suspect you have something there that shouldnt be. Also , yes the eth01 needs a hardware reset since to program I need to connect io0 to grd, then remove it to run which also requires a hardware reset to put the esp in run mode

I have fonts directory with four files in it, same filename but 4 different file extensions, and then favicon.ico, index.html, index - Copy.html and style.css. Is both index.html needed? Is only the index.html required?

On my end, only change the IO0 and GNG pin does not work. Maybe I disconnect IO0 and GND and reconnect again leads to undefined input state of IO0.

Anyway after I change the Partition Scheme to Huge APP (3MB no OTA/1MB SPIFFS), I got no issues upload all files in my data folder.

remove the index -copy.html. Thatā€™s not needed. I will correct the git. Either way, I donā€™t get
why you get the space issue. Doesnt make sense. You do have the ā€œdataā€ folder in the sketch directory correct?
Unfortunately, OTA will not work with that option you used though.

Yes, I have the ā€œdataā€ folder in the sketch directory. Did you mean you have no space issue with ESP32? I also didnā€™t run into any space issue with my D1 mini ESP32 at all but the partition scheme is different from WT32-ETH01, at least for the ā€˜Minimal SPIFFSā€™. Once ā€˜Index - Copy.htmlā€™ file removed, the whole space folder can fit into SPIFFS of WT32-ETH01 under ā€˜Minimal SPIFFSā€™ partition scheme and can have OTA back. I can see from Serial monitor on reset, each and every file uploaded will be copied. The log on Serial monitor looks like this:
FILE: favicon.ico
FILE: keypad_icons.eot
FILE: keypad_icons.svg
FILE: keypad_icons.ttf
FILE: keypad_icons.woff
FILE: index - Copy.html
FILE: index.html
FILE: style.css
Web server started: http://dscKeypad-ETH.local
Ready
IP address: 0.0.0.0

Ok, I got ethernet to work with the wt32-eth01. Need to use the ETH.h library instead of wifi.h. Also need to set these defines before the include.
#define ETH_PHY_ADDR 1
#define ETH_PHY_TYPE ETH_PHY_LAN8720
#define ETH_PHY_POWER 16
#define ETH_PHY_MDC 23
#define ETH_PHY_MDIO 18
#define ETH_CLK_MODE ETH_CLOCK_GPIO0_IN // ETH_CLOCK_GPIO17_OUT
#define SHIELD_TYPE ā€œETH_PHY_LAN8720ā€

I also needed to correct a line in the telegram lib to work as well.
Iā€™ll post an update that will include defines to select the working mode.

And yes, thatā€™s correct I never had issues with out of space on the spiffs folder for the wt32-eth01. Also the unmodified sketch worked out of the box on it using wifi.
Why would the partition scheme be different?? I use the ā€œESP32 Devā€ config for all devices and had no issues so the scheme should have been the same for all.

@Dilbert66 Good news, my WT32-ETH01 was actually connected to my router, just I didnā€™t aware of it. The VirtualKeyboard was working too! It simply responds ā€˜DSC bus disconnectedā€™ as it is lying beside my laptop. The IP address 0.0.0.0 was output inside the program ā€˜loopā€™ as it shows WiFi.local, not ETH.local. I already print out IP address of ETH.local in ā€˜setupā€™. It would take me some time to change all your reference to WiFi for Telegram messages output and handling.

We are half way there.

I have the code done to be dual mode. I will do a quick test and post shortly! Iā€™ve been wanting to get ethernet working on the arduino for while and never had time. Thanks for your help with the testing!

Then I better wait for your latest build. Thanks so much.

Edit: I am now using Minimal SPIFFS partition scheme and Index - Copy.html removed. Sketch and ā€˜data folderā€™ upload without any issues and Virtualkeypad is working, just not the Telegram.

Yes, telegram has a check for wifi being connected which doesnt work with ethernet. Iā€™ve removed the line.
Iā€™ve pushed an update that adds the changes . Just ucomment the "useWT32ETHERNET define.