rudders / homebridge-http

HTTP Plugin for Homebridge
Apache License 2.0
178 stars 110 forks source link

Realtime Polling #41

Open cybertza opened 8 years ago

cybertza commented 8 years ago

Hi

GREAT WORK!

Is it possible to create a configurable variable time for the realtime polling?

I am able to render a page from an Arduino with:

EthernetClient client = server.available(); client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connnection: close"); client.println(); client.println(1)); for on and 0 for off, works well delay(1) client.stop();

(not much reference code online so maybe this can help with documentation.

it updates the status's.

i have an problem when i request 8 lights status with the time it takes to come back, especially when the "switchHandling": "yes",

by the time its returned my ios device black out (power saving) unlocking restarts the process with updating.

its a limitation on the ard i think, but it takes a while for all the status's to return, so what i want to know if there is an way to do an "cached" pull?

so it will do an rolling status check as realtime, every staggered 1 per min for 8 mins or so (this is still nice for events), and if app loads it generates an decrease of that timer for you, and then gracefully updates the units over the next 1 min.

I believe this would let the bridge feel responsive, and as the status replies come in in the background it updates them,

alternatively a rolling update, so that the bridge replies from a chache/proxy base of the last known states and then updates them gracefully in the background.

My problem i guess may be because the bridge is not the only thing that can update the "light" i can do it from the localized http, or a pushbutton.

Once again Great work!

thanks so much for the effort going into this enabling me to do something that otherwise would be a mammoth task.