Skip to content

Commit

Permalink
Add wind alert to AlertsModal
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Aug 28, 2024
1 parent 4c6f2ab commit 942217f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/components/LVMWebRoot/AlertsModal/AlertsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ export default function AlertsModal(props: AlertsModalProps) {
tempAlerts.push('Rain detected');
}

if (alerts.wind_alert) {
tempAlerts.push('Wind is above 35 mph');
}

setActiveAlerts(tempAlerts);
}, [alerts]);

Expand Down
4 changes: 3 additions & 1 deletion src/hooks/use-alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface AlertsResponse {
camera_alerts: { [key in CameraAlerts]: boolean };
o2_alert: boolean;
o2_room_alerts: { [key in O2Rooms]: boolean };
wind_alert: boolean;
rain: boolean;
door_alert: boolean;
}
Expand Down Expand Up @@ -68,7 +69,8 @@ export default function useAlerts(interval: number = 15000): AlertsModel | undef

const newAlerts = {
...alertsAPI,
global_alert: alertsAPI.temperature_alert || alertsAPI.rain,
global_alert:
alertsAPI.temperature_alert || alertsAPI.rain || alertsAPI.wind_alert,
camera_active_alerts: tempAlerts as CameraAlerts[],
o2_active_alerts: o2Alerts as O2Rooms[],
};
Expand Down

0 comments on commit 942217f

Please sign in to comment.