diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 3c4283b9..060d10b1 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -8,4 +8,4 @@ "davidanson.vscode-markdownlint", "redhat.vscode-yaml" ] -} \ No newline at end of file +} diff --git a/src/clock-weather-card.ts b/src/clock-weather-card.ts index 256d8ea1..8657b3d8 100644 --- a/src/clock-weather-card.ts +++ b/src/clock-weather-card.ts @@ -68,9 +68,9 @@ export class ClockWeatherCard extends LitElement { constructor () { super() this.currentDate = DateTime.now() - const msToNextMinute = (60 - this.currentDate.second) * 1000 - setTimeout(() => setInterval(() => { this.currentDate = DateTime.now() }, 1000 * 60), msToNextMinute) - setTimeout(() => { this.currentDate = DateTime.now() }, msToNextMinute) + const msToNextSecond = (1000 - this.currentDate.millisecond) + setTimeout(() => setInterval(() => { this.currentDate = DateTime.now() }, 1000), msToNextSecond) + setTimeout(() => { this.currentDate = DateTime.now() }, msToNextSecond) } public static getStubConfig (_hass: HomeAssistant, entities: string[], entitiesFallback: string[]): Record {