From f75b7b1a5991d4777eb105b0abd4a58f66541636 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 9 Nov 2025 14:56:50 +0100 Subject: [PATCH 1/2] add is_system to analog and temperature sensors, highlight in Sensors page, remove from Dashboard, change button icon to be consistent when updating --- interface/src/app/main/Sensors.tsx | 44 ++++--- .../src/app/main/SensorsAnalogDialog.tsx | 15 ++- .../src/app/main/SensorsTemperatureDialog.tsx | 15 ++- interface/src/app/main/types.ts | 5 +- mock-api/restServer.ts | 63 ++++++---- src/core/analogsensor.cpp | 15 ++- src/core/analogsensor.h | 16 +-- src/core/emsesp.cpp | 17 ++- src/core/temperaturesensor.cpp | 41 ++++--- src/core/temperaturesensor.h | 16 ++- src/test/test.cpp | 2 +- src/web/WebCustomizationService.cpp | 110 +++++++++++------- src/web/WebCustomizationService.h | 7 +- src/web/WebDataService.cpp | 32 +++-- 14 files changed, 270 insertions(+), 128 deletions(-) diff --git a/interface/src/app/main/Sensors.tsx b/interface/src/app/main/Sensors.tsx index 22a629ff2..bbb8fd636 100644 --- a/interface/src/app/main/Sensors.tsx +++ b/interface/src/app/main/Sensors.tsx @@ -96,6 +96,7 @@ const common_theme = { } &:hover .td { background-color: #177ac9; + color: white; } `, Cell: ` @@ -297,7 +298,12 @@ const Sensors = () => { const onTemperatureDialogSave = useCallback( async (ts: TemperatureSensor) => { - await sendTemperatureSensor({ id: ts.id, name: ts.n, offset: ts.o }) + await sendTemperatureSensor({ + id: ts.id, + name: ts.n, + offset: ts.o, + is_system: ts.s + }) .then(() => { toast.success(LL.UPDATED_OF(LL.SENSOR(1))); }) @@ -342,7 +348,8 @@ const Sensors = () => { t: 0, f: 1, d: false, - o_n: '' + o_n: '', + s: false }); setAnalogDialogOpen(true); }, []); @@ -357,7 +364,8 @@ const Sensors = () => { factor: as.f, uom: as.u, type: as.t, - deleted: as.d + deleted: as.d, + is_system: as.s }) .then(() => { toast.success(LL.UPDATED_OF(LL.ANALOG_SENSOR(2))); @@ -431,20 +439,25 @@ const Sensors = () => { - {tableList.map((a: AnalogSensor) => ( - updateAnalogSensor(a)}> - {a.g} - {a.n} - {AnalogTypeNames[a.t]} - {(a.t === AnalogType.DIGITAL_OUT && - a.g !== GPIO_25 && - a.g !== GPIO_26) || - a.t === AnalogType.DIGITAL_IN || - a.t === AnalogType.PULSE ? ( - {a.v ? LL.ON() : LL.OFF()} + {tableList.map((as: AnalogSensor) => ( + updateAnalogSensor(as)} + > + {as.g} + {as.n} + {AnalogTypeNames[as.t]} + {(as.t === AnalogType.DIGITAL_OUT && + as.g !== GPIO_25 && + as.g !== GPIO_26) || + as.t === AnalogType.DIGITAL_IN || + as.t === AnalogType.PULSE ? ( + {as.v ? LL.ON() : LL.OFF()} ) : ( - {a.t !== AnalogType.NOTUSED ? formatValue(a.v, a.u) : ''} + {as.t !== AnalogType.NOTUSED ? formatValue(as.v, as.u) : ''} )} @@ -506,6 +519,7 @@ const Sensors = () => { {tableList.map((ts: TemperatureSensor) => ( updateTemperatureSensor(ts)} diff --git a/interface/src/app/main/SensorsAnalogDialog.tsx b/interface/src/app/main/SensorsAnalogDialog.tsx index fbbd35466..ee5087d12 100644 --- a/interface/src/app/main/SensorsAnalogDialog.tsx +++ b/interface/src/app/main/SensorsAnalogDialog.tsx @@ -1,6 +1,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import CancelIcon from '@mui/icons-material/Cancel'; +import DoneIcon from '@mui/icons-material/Done'; import RemoveIcon from '@mui/icons-material/RemoveCircleOutline'; import WarningIcon from '@mui/icons-material/Warning'; import { @@ -441,6 +442,18 @@ const SensorsAnalogDialog = ({ )} + {editItem.s && ( + + + + {LL.SYSTEM(0)} {LL.SENSOR(0)} + + + )} {!creating && ( @@ -465,7 +478,7 @@ const SensorsAnalogDialog = ({ {LL.CANCEL()}