Skip to content

Commit

Permalink
Don't wait for the app init against homey. Set timezone for process
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Kling committed Apr 23, 2023
1 parent 09e6549 commit 3ece0d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ export class HeatingSchedulerApp {
*/
export default class App extends HomeyApp {
public async onInit() {
await BootStrapper(this);
// we don't let homey wait for the init cycle to finish
async () => {
await BootStrapper(this);

// we let the container do our stuff
const app = container.resolve(HeatingSchedulerApp);
await app.run(this);
// we let the container do our stuff
const app = container.resolve(HeatingSchedulerApp);
await app.run(this);
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/app/services/bootstrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export async function BootStrapper(app: HomeyApp, silent = false) {
// tslint:disable-next-line: no-console
if (!silent) { console.info(`********* APPLICATION STARTUP v${__VERSION} (${__BUILD}) *********`); }

// global hack
process.env.TZ = app.homey.clock.getTimezone();

// depends on logger -> settings -> ...
const settingsManager: SettingsManagerService = container.resolve(SettingsManagerService);
await settingsManager.init(app.homey.settings);
Expand Down
3 changes: 3 additions & 0 deletions src/app/services/heating-scheduler/HeatingSchedulerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ export class HeatingSchedulerService {
let taskFunc = this.scheduleTask.bind(this);
let { date: nextDate, plans: plansToExecute } = await this.determineNextSchedule();




// If we have a setpoint neat EOD, we still have to cleanup
if (nextDate == null || nextDate >= END_OF_DAY) {
nextDate = END_OF_DAY;
Expand Down

0 comments on commit 3ece0d3

Please sign in to comment.