Supereg / homebridge-http-switch

Powerful http switch for Homebridge: https://github.com/homebridge/homebridge
ISC License
219 stars 36 forks source link

Stateless switch with too long delay() #43

Closed LAKY911 closed 4 years ago

LAKY911 commented 4 years ago

Hi, first of all, thank you for this plugin, it's perfect!

I have a stateless switch with delay(13000) between two URLs.

"onUrl": [
  "http://localhost/api/switch1On",
  "delay(13000)",
  "http://localhost/api/switch2On"
]

The problem is, that the delay is too long. When I ask Siri to turn the switch on, she replies "Sorry, I couldn't hear back from your devices". Is there a way you could add a typical "timeout : 1000" response, the same way it works with single URL switches? So before it executes rest of the onUrl, it already replies to Homebridge.

Thank you. Best regards and Merry Christmas. Lukas

Supereg commented 4 years ago

I find that a bit tricky. Currently all responses from all responses are analyzed and then reported back to HomeKit. If some where unsuccessful it whole operation would be considered unsuccessful. If I would decouple this, seeing a successful operation in HomeKit, we couldn't be sure that all urls actually returned successfully, meaning all defined actions where executed correctly and we need to guess the status code (successful not successful) we return to HomeKit.

I'm checking what's possible for those who absolutely know what they are doing. Out of interest, what's the use case that you want so long delays?

LAKY911 commented 4 years ago

Hi, thanks, I solved this in my Arduino. I used this to control my window blinds (RF transmitter - sends down command, waits 13 sec, sends stop command).

Supereg commented 4 years ago

Sorry for the long response time. And great to hear. I think is this also the better and easier solution 😃