trympet / homebridge-volvo

Volvo plugin for Homebridge
https://npm.im/homebridge-volvo
Apache License 2.0
26 stars 6 forks source link

Show "No Response" in HomeKit when vehicle is not responding #39

Open drakkhen opened 1 year ago

drakkhen commented 1 year ago

We were recently on vacation and after a few days the accessories exposed by homebridge-volvo showed "on" statuses, unexpectedly. According into the API docs "When the car has not been used for more than 3-5 days, the invocation command request may not be able to perform because is set in standby mode", and includes a table of the possible error status values here: https://developer.volvocars.com/apis/connected-vehicle/details/#vehicle-sleep-and-error-modes

I'm still super new to homebridge plugin development, but I believe we could throw this error in accessories' onGet (and onSet?) methods to immediately cause HomeKit to show accessories as "No Response", which I think would be the best and most accurate status since the vehicle's communication equipment is temporarily disabled.

throw new HapStatusError(HAPStatus.SERVICE_COMMUNICATION_FAILURE);
trympet commented 1 year ago

Good suggestion! Have you tried it out on a local build on your instance?

If you submit a PR, I'd be happy to review it.