From a1bb49359fc92c0d19a6509a76d6017293457fae Mon Sep 17 00:00:00 2001 From: Proddy Date: Tue, 17 Oct 2023 22:55:47 +0200 Subject: [PATCH] show entity count in device list, remove type --- interface/src/project/DashboardDevices.tsx | 18 ++++++++-------- interface/src/project/types.ts | 1 + mock-api/server.js | 24 ++++++++++++++-------- src/emsdevicevalue.cpp | 2 +- src/version.h | 2 +- src/web/WebDataService.cpp | 2 ++ 6 files changed, 31 insertions(+), 18 deletions(-) diff --git a/interface/src/project/DashboardDevices.tsx b/interface/src/project/DashboardDevices.tsx index 09dd0dfcb..2ee1932db 100644 --- a/interface/src/project/DashboardDevices.tsx +++ b/interface/src/project/DashboardDevices.tsx @@ -1,8 +1,8 @@ -import CancelIcon from '@mui/icons-material/Cancel'; import CommentsDisabledOutlinedIcon from '@mui/icons-material/CommentsDisabledOutlined'; import EditIcon from '@mui/icons-material/Edit'; import EditOffOutlinedIcon from '@mui/icons-material/EditOffOutlined'; import DownloadIcon from '@mui/icons-material/GetApp'; +import HighlightOffIcon from '@mui/icons-material/HighlightOff'; import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDownOutlined'; import KeyboardArrowUpOutlinedIcon from '@mui/icons-material/KeyboardArrowUpOutlined'; @@ -26,6 +26,7 @@ import { Grid, Typography } from '@mui/material'; + import { useRowSelect } from '@table-library/react-table-library/select'; import { useSort, SortToggleType } from '@table-library/react-table-library/sort'; import { Table, Header, HeaderRow, HeaderCell, Body, Row, Cell } from '@table-library/react-table-library/table'; @@ -135,7 +136,7 @@ const DashboardDevices: FC = () => { common_theme, { Table: ` - --data-table-library_grid-template-columns: 40px repeat(1, minmax(0, 1fr)) 130px; + --data-table-library_grid-template-columns: 40px repeat(1, minmax(0, 1fr)); `, BaseRow: ` .td { @@ -417,7 +418,6 @@ const DashboardDevices: FC = () => { {LL.DESCRIPTION()} - {LL.TYPE(0)} @@ -426,8 +426,10 @@ const DashboardDevices: FC = () => { - {device.n} - {device.tn} + + {device.n} +   ({device.e}) + ))} @@ -485,8 +487,8 @@ const DashboardDevices: FC = () => { }} > - - {coreData.devices[deviceIndex].n} + + {coreData.devices[deviceIndex].tn} | {coreData.devices[deviceIndex].n} @@ -511,7 +513,7 @@ const DashboardDevices: FC = () => { - + diff --git a/interface/src/project/types.ts b/interface/src/project/types.ts index 74f0dded6..0e1ff3706 100644 --- a/interface/src/project/types.ts +++ b/interface/src/project/types.ts @@ -69,6 +69,7 @@ export interface Device { d: number; // deviceid p: number; // productid v: string; // version + e: number; // entities } export interface TemperatureSensor { diff --git a/mock-api/server.js b/mock-api/server.js index b12b379db..d2c4e3089 100644 --- a/mock-api/server.js +++ b/mock-api/server.js @@ -427,7 +427,8 @@ const emsesp_coredata = { // n: 'Enviline/Compress 6000AW/Hybrid 3000-7000iAW/SupraEco/Geo 5xx/WLW196i/WSW196i', d: 8, p: 123, - v: '06.01' + v: '06.01', + e: 69 }, { id: 3, @@ -437,7 +438,8 @@ const emsesp_coredata = { n: 'GB125/GB135/MC10', d: 8, p: 123, - v: '06.01' + v: '06.01', + e: 73 }, { id: 1, @@ -447,7 +449,8 @@ const emsesp_coredata = { n: 'RC35', d: 24, p: 86, - v: '04.01' + v: '04.01', + e: 57 }, { id: 2, @@ -457,7 +460,8 @@ const emsesp_coredata = { n: 'RC20/Moduline 300', d: 23, p: 77, - v: '03.03' + v: '03.03', + e: 6 }, { id: 4, @@ -467,7 +471,8 @@ const emsesp_coredata = { n: 'RC100/Moduline 1000/1010', d: 16, p: 165, - v: '04.01' + v: '04.01', + e: 3 }, { id: 5, @@ -477,7 +482,8 @@ const emsesp_coredata = { n: 'MM10', d: 32, p: 69, - v: '01.01' + v: '01.01', + e: 6 }, { id: 6, @@ -487,7 +493,8 @@ const emsesp_coredata = { n: 'SM10', d: 48, p: 73, - v: '01.02' + v: '01.02', + e: 22 }, { id: 99, @@ -497,7 +504,8 @@ const emsesp_coredata = { n: 'User defined entities', d: 1, p: 1, - v: '' + v: '', + e: 1 } ] }; diff --git a/src/emsdevicevalue.cpp b/src/emsdevicevalue.cpp index 7454a0c8b..99fe80062 100644 --- a/src/emsdevicevalue.cpp +++ b/src/emsdevicevalue.cpp @@ -243,7 +243,7 @@ bool DeviceValue::hasValue() const { has_value = Helpers::hasValue(*(uint32_t *)(value_p)); break; case DeviceValueType::CMD: - has_value = false; // commands don't have values! + has_value = true; // we count command as an actual entity break; default: break; diff --git a/src/version.h b/src/version.h index 72d6c2ace..2f10b99be 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.6.3-dev.3" +#define EMSESP_APP_VERSION "3.6.3-dev.4" diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index 92ab854d1..77185d233 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -88,6 +88,7 @@ void WebDataService::core_data(AsyncWebServerRequest * request) { obj["d"] = emsdevice->device_id(); // deviceid obj["p"] = emsdevice->product_id(); // productid obj["v"] = emsdevice->version(); // version + obj["e"] = emsdevice->count_entities(); // number of entities } } @@ -102,6 +103,7 @@ void WebDataService::core_data(AsyncWebServerRequest * request) { obj["d"] = 0; // deviceid obj["p"] = 0; // productid obj["v"] = 0; // version + obj["e"] = EMSESP::webCustomEntityService.count_entities(); // number of custom entities } root["connected"] = EMSESP::bus_status() != 2;