Supereg / homebridge-http-switch

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

Configure state request socket timeout #31

Closed aflemm closed 5 years ago

aflemm commented 5 years ago

I'm using http-switch to connect to the Nissan Leaf online service to get the status of the charger. The http request for the charger state is working, but it seems to be slightly too slow to respond.

I typically get "ESOCKETTIMEDOUT" errors, with the occasional state request working. I'd love to be able to configure the socket timeout for this request to be more forgiving.

Supereg commented 5 years ago

You can actually already configure that. There's a property requestTimeout to be configured inside a urlObject. This represents the timeout in milliseconds, default is 20s. Also pushed a commit which correctly documents this property.