Skip to content

Commit

Permalink
refactor(platform): put update interval in settings.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
johannrichard committed Nov 28, 2020
1 parent 7292333 commit 6bf9522
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
PLUGIN_NAME,
DINGZ_DISCOVERY_PORT,
DINGZ_CALLBACK_PORT,
STATE_UPDATE_INTERVAL,
} from './settings';

// TODO: Some refactoring for better event handling, cleanup of the code and separation of concerns
Expand Down Expand Up @@ -117,7 +118,7 @@ export class DingzDaHomebridgePlatform implements DynamicPlatformPlugin {

setInterval(() => {
this.eb.emit(PlatformEvent.REQUEST_STATE_UPDATE);
}, 5000);
}, STATE_UPDATE_INTERVAL);
});
}

Expand Down
1 change: 1 addition & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const DINGZ_CALLBACK_PORT = 18081;
*/
export const REQUEST_RETRIES = 7;
export const RETRY_TIMEOUT = 3000;
export const STATE_UPDATE_INTERVAL = 5000;
/**
* This must match the name of your plugin as defined the package.json
*/
Expand Down

0 comments on commit 6bf9522

Please sign in to comment.