watou / vera-ecobee

Vera Plugin for ecobee Thermostat
7 stars 5 forks source link

Auth token discarded too eagerly #18

Closed watou closed 9 years ago

watou commented 9 years ago

Whenever there was a failure to refresh tokens, the plugin would immediately discard the auth_token, leading to the need to retrieve and register a new PIN at ecobee.com. When stale tokens were being used due to a Vera problem, this was the correct course of action. But in other cases where refreshing the token failed, it is better to try some number of times before giving up and discarding the auth_token. This change tries up to five times to refresh tokens (over a minimum space of 15 minutes), before giving up and requiring a new PIN.