Web Client analyse HTML response

MAIN QUESTION:
How can I make an Arduino Mega with Ethernet Shield / ESP8266 based micro controller connect to my routers configuration page at 192.168.1.254 and analyse the HTML response in order to see which devices are connected.

DETAILED INFORMATION:
I want to write a program to go on either an Arduino Mega with Ethernet Shield or ESP8266 based micro controller to tell my home automation system when I'm connected to the WiFi.

My current system uses Node RED to ping the static IP of my phone every 60 seconds, however it's an iPhone so after 20 seconds of being locked the WiFi chip goes into sleep mode and the ping returns an error.

I could use IFTTT to trigger an action every time I enter / leave my house, but this requires my location services being on all the time draining battery and using data.

The best way of seeing what devices are connected is on my routers home page for configuration at 192.168.1.254 (which is not affected by devices going into sleep mode). If the Arduino could connect to the web server at the IP address above, and receive a HTML page as a response, then the code could be analysed and it would be possible to see which devices are connected.

The problems I anticipate are:

  • If i want to see if multiple devices are connected, not just my phone but say also my sisters phone, I do not know where in the table the devices will be as the order changes with each device connecting and disconnecting (I see no logical order to the list such as A-Z or ascending IP address)
  • The HTML response is very long
  • The web client may not receive a web page at all when it sends a HTTP request to connect to the web server.

I would appreciate any ideas on how to achieve this. Please let me know if you have any questions. Thank you in advance.

Hi

assuming your arduino manages to connect (https / login) then you need to write a parser that waits for a specific cString to arrive that matches whatever is just before what you want to extract from the HTML page.

you do this by receiving and storing in a small circular buffer that has the size of the text you expect and every time you have a new char you check against your expected string. functions from those C libraries will come handy for that: stdlib.h and string.h

Once you have received a correct "signal" you read and store somewhere "safe" the incoming data until another type of marker which denotes the ends of one of the connected device.

then you repeat until the end of the web page