GladysProject/Gladys

View on GitHub
server/services/netatmo/lib/netatmo.init.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * @description Initialize service with properties and connect to devices.
 * @example netatmo.init();
 */
async function init() {
  await this.getConfiguration();
  this.configured = true;
  await this.getAccessToken();
  await this.getRefreshToken();
  const response = await this.refreshingTokens();
  if (response.success) {
    await this.pollRefreshingToken();
    await this.refreshNetatmoValues();
    await this.pollRefreshingValues();
  }
}

module.exports = {
  init,
};