status => stats
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
type GristRecord_PersonalGoals,
|
||||
type HomeAssistantDeskPositionResult,
|
||||
type ServiceResult,
|
||||
StatusComponent,
|
||||
StatsComponent,
|
||||
type TidalGetCurrent,
|
||||
type WsService,
|
||||
} from "@dpu/shared";
|
||||
@@ -75,11 +75,11 @@ export class HomepageService extends BaseService<null> {
|
||||
try {
|
||||
const [desk, temp, tidal, personal_goals] = await this._getAll();
|
||||
const updates: ComponentUpdate[] = [
|
||||
createComponentUpdate(StatusComponent.HA_DESK_POSITION, desk),
|
||||
createComponentUpdate(StatusComponent.HA_TEMP, temp),
|
||||
createComponentUpdate(StatusComponent.TIDAL_CURRENT, tidal),
|
||||
createComponentUpdate(StatsComponent.HA_DESK_POSITION, desk),
|
||||
createComponentUpdate(StatsComponent.HA_TEMP, temp),
|
||||
createComponentUpdate(StatsComponent.TIDAL_CURRENT, tidal),
|
||||
createComponentUpdate(
|
||||
StatusComponent.GRIST_PERSONAL_GOALS,
|
||||
StatsComponent.GRIST_PERSONAL_GOALS,
|
||||
personal_goals,
|
||||
),
|
||||
];
|
||||
@@ -171,26 +171,26 @@ export class HomepageService extends BaseService<null> {
|
||||
const updates: ComponentUpdate[] = [];
|
||||
for (const component of components) {
|
||||
switch (component.component) {
|
||||
case StatusComponent.HA_DESK_POSITION: {
|
||||
case StatsComponent.HA_DESK_POSITION: {
|
||||
this.updateHaDesk(
|
||||
(component.data as API_HA_DeskPosition) ?? (await this._getDesk()),
|
||||
updates,
|
||||
);
|
||||
break;
|
||||
}
|
||||
case StatusComponent.HA_TEMP:
|
||||
case StatsComponent.HA_TEMP:
|
||||
this.updateHaTemp(
|
||||
(component.data as string) ?? (await this._getTemp()),
|
||||
updates,
|
||||
);
|
||||
break;
|
||||
case StatusComponent.TIDAL_CURRENT:
|
||||
case StatsComponent.TIDAL_CURRENT:
|
||||
this.updateTidal(
|
||||
(component.data as TidalGetCurrent) ?? (await this._getTidal()),
|
||||
updates,
|
||||
);
|
||||
break;
|
||||
case StatusComponent.GRIST_PERSONAL_GOALS:
|
||||
case StatsComponent.GRIST_PERSONAL_GOALS:
|
||||
this.updateGristPG(
|
||||
(component.data as GristRecord_PersonalGoals) ??
|
||||
(await this._getGristPG()),
|
||||
@@ -220,7 +220,7 @@ export class HomepageService extends BaseService<null> {
|
||||
this.lastPoll.ha_desk_position = new_ha_desk_position;
|
||||
updates.push(
|
||||
createComponentUpdate(
|
||||
StatusComponent.HA_DESK_POSITION,
|
||||
StatsComponent.HA_DESK_POSITION,
|
||||
new_ha_desk_position,
|
||||
),
|
||||
);
|
||||
@@ -230,7 +230,7 @@ export class HomepageService extends BaseService<null> {
|
||||
updateHaTemp(new_ha_temp: string | null, updates: ComponentUpdate[]): void {
|
||||
if (this.lastPoll.ha_temp !== new_ha_temp) {
|
||||
this.lastPoll.ha_temp = new_ha_temp;
|
||||
updates.push(createComponentUpdate(StatusComponent.HA_TEMP, new_ha_temp));
|
||||
updates.push(createComponentUpdate(StatsComponent.HA_TEMP, new_ha_temp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ export class HomepageService extends BaseService<null> {
|
||||
) {
|
||||
this.lastPoll.tidal_current = new_tidal_current;
|
||||
updates.push(
|
||||
createComponentUpdate(StatusComponent.TIDAL_CURRENT, new_tidal_current),
|
||||
createComponentUpdate(StatsComponent.TIDAL_CURRENT, new_tidal_current),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -274,7 +274,7 @@ export class HomepageService extends BaseService<null> {
|
||||
this.lastPoll.grist_personal_goals = new_grist_personal_goals;
|
||||
updates.push(
|
||||
createComponentUpdate(
|
||||
StatusComponent.GRIST_PERSONAL_GOALS,
|
||||
StatsComponent.GRIST_PERSONAL_GOALS,
|
||||
new_grist_personal_goals,
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user