ratgdo / homekit-ratgdo

A native HomeKit implementation of a Security+ 2.0 garage door controller based on ratgdo hardware
https://ratgdo.github.io/homekit-ratgdo/
GNU General Public License v3.0
214 stars 21 forks source link

Complete browser cache support, improve cosmetics of unpair #113

Closed dkerr64 closed 9 months ago

dkerr64 commented 9 months ago

Completes support for browser-side caching of CSS/JS/Images. Updates the cosmetics of un-pair/reset HomeKit and reboots the device.

jgstroud commented 9 months ago

@dkerr64 let me know if or when you are ready to merge and I'll do a quick test build and merge.

dkerr64 commented 9 months ago

Hi @jgstroud the only thing left (that I can think of) is to investigate if I can have the server notify the browser of status changes. Right now the browser polls the server every 10 seconds asking for updates to status (door open, paired, etc). This is hardly best practice.

However I will have to investigate if this can be done and I haven't started that.

In the meantime, this PR provides a couple of needed updates... better unpair cosmetics and reboot as part of that, and adding paired status to the 10-second-polling. So I do think worthwhile merging.

Thanks

rayr007 commented 9 months ago

To send updates to the browser from the server, you could use WebSockets and stream messages back. Or possibly use this mechanism: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

dkerr64 commented 9 months ago

To send updates to the browser from the server, you could use WebSockets and stream messages back. Or possibly use this mechanism: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

yes, I found example of server sent events here.. https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/ServerSentEvents/ServerSentEvents.ino and this looks to be fairly simple.

There are also examples for WebSockets but I suspect it might be too heavyweight and use more memory than necessary.

jgstroud commented 9 months ago

To send updates to the browser from the server, you could use WebSockets and stream messages back. Or possibly use this mechanism: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

yes, I found example of server sent events here.. https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WebServer/examples/ServerSentEvents/ServerSentEvents.ino and this looks to be fairly simple.

There are also examples for WebSockets but I suspect it might be too heavyweight and use more memory than necessary.

This seems like overkill. The web status is nice, but it's more diagnostic than anything and not having it realtime isn't a big deal IMHO.

dkerr64 commented 9 months ago

I am closing this in favor of PR #117