Better handle enabled / disabled relays
This commit is contained in:
parent
2262b98952
commit
9c45e541dd
@ -140,7 +140,7 @@ impl EnergyEngine {
|
|||||||
// Forcefully turn off disabled relays
|
// Forcefully turn off disabled relays
|
||||||
for d in devices {
|
for d in devices {
|
||||||
for r in &d.relays {
|
for r in &d.relays {
|
||||||
if !r.enabled {
|
if !r.enabled || !d.enabled {
|
||||||
new_relays_state.get_mut(&r.id).unwrap().on = false;
|
new_relays_state.get_mut(&r.id).unwrap().on = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import CheckIcon from "@mui/icons-material/Check";
|
|
||||||
import DeleteIcon from "@mui/icons-material/Delete";
|
|
||||||
import RefreshIcon from "@mui/icons-material/Refresh";
|
import RefreshIcon from "@mui/icons-material/Refresh";
|
||||||
import {
|
import {
|
||||||
IconButton,
|
IconButton,
|
||||||
@ -13,15 +11,10 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Device, DeviceApi, DeviceRelay } from "../api/DeviceApi";
|
import { DeviceRelay } from "../api/DeviceApi";
|
||||||
import { useAlert } from "../hooks/context_providers/AlertDialogProvider";
|
import { RelayApi } from "../api/RelayApi";
|
||||||
import { useConfirm } from "../hooks/context_providers/ConfirmDialogProvider";
|
|
||||||
import { useLoadingMessage } from "../hooks/context_providers/LoadingMessageProvider";
|
|
||||||
import { useSnackbar } from "../hooks/context_providers/SnackbarProvider";
|
|
||||||
import { AsyncWidget } from "../widgets/AsyncWidget";
|
import { AsyncWidget } from "../widgets/AsyncWidget";
|
||||||
import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer";
|
import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer";
|
||||||
import { TimeWidget } from "../widgets/TimeWidget";
|
|
||||||
import { RelayApi } from "../api/RelayApi";
|
|
||||||
|
|
||||||
export function RelaysListRoute(): React.ReactElement {
|
export function RelaysListRoute(): React.ReactElement {
|
||||||
const loadKey = React.useRef(1);
|
const loadKey = React.useRef(1);
|
||||||
@ -84,7 +77,13 @@ function RelaysList(p: {
|
|||||||
sx={{ "&:last-child td, &:last-child th": { border: 0 } }}
|
sx={{ "&:last-child td, &:last-child th": { border: 0 } }}
|
||||||
>
|
>
|
||||||
<TableCell>{row.name}</TableCell>
|
<TableCell>{row.name}</TableCell>
|
||||||
<TableCell>{row.enabled ? "YES" : "NO"}</TableCell>
|
<TableCell>
|
||||||
|
{row.enabled ? (
|
||||||
|
<span style={{ color: "green" }}>YES</span>
|
||||||
|
) : (
|
||||||
|
<span style={{ color: "red" }}>NO</span>
|
||||||
|
)}
|
||||||
|
</TableCell>
|
||||||
<TableCell>{row.priority}</TableCell>
|
<TableCell>{row.priority}</TableCell>
|
||||||
<TableCell>{row.consumption}</TableCell>
|
<TableCell>{row.consumption}</TableCell>
|
||||||
<TableCell>TODO</TableCell>
|
<TableCell>TODO</TableCell>
|
||||||
|
Loading…
Reference in New Issue
Block a user