Supereg / homebridge-http-switch

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

Timeout on stateless #71

Closed jameswestcott closed 1 year ago

jameswestcott commented 3 years ago

Regardless of the timeout parameter on stateless switches, it appears to default to 1 second.

Supereg commented 3 years ago

What timeout value did you set? Would you mind providing the relevant parts of your config file?

jameswestcott commented 3 years ago

Have tried different timeouts, but was wanting 5 seconds. Is it due to there being no offUrl? The reason for a timeout is so a button in an iOS app animates properly.

{ "name": "Entryway Door Lock", "switchType": "stateless", "timeout": 5000, "onUrl": "http://****", "accessory": "HTTP-SWITCH" }

Supereg commented 3 years ago

So to understand you: You have a stateless switch which when turned on should only return to the off state after 5 seconds right? And to your observation it doesn't do that?

jameswestcott commented 3 years ago

That is correct.

jameswestcott commented 3 years ago

Did you get to the bottom as to why the timeout value on a stateless switch isn't work? Regardless of the value set, it seems to default to immediate.

grahamhar commented 3 years ago

I've just hit this issue also, I added some debug and the values for the timeout report to be correct.

Could the issue be that the main home bridge code use async/ await and this plugin doesn't? Also a quick google indicates that setTimeout is not awaitable.

mrei-kiel commented 2 years ago

Same for me. Stateless switch, wanted a 20s timeout, put "timeout: 20000" in the config, but I'm getting an "instant" return to original state. Could we please get a fix for this? Thank you!