show entity count in device list, remove type

This commit is contained in:
Proddy
2023-10-17 22:55:47 +02:00
parent f9a176e09c
commit a1bb49359f
6 changed files with 31 additions and 18 deletions

View File

@@ -1,8 +1,8 @@
import CancelIcon from '@mui/icons-material/Cancel';
import CommentsDisabledOutlinedIcon from '@mui/icons-material/CommentsDisabledOutlined'; import CommentsDisabledOutlinedIcon from '@mui/icons-material/CommentsDisabledOutlined';
import EditIcon from '@mui/icons-material/Edit'; import EditIcon from '@mui/icons-material/Edit';
import EditOffOutlinedIcon from '@mui/icons-material/EditOffOutlined'; import EditOffOutlinedIcon from '@mui/icons-material/EditOffOutlined';
import DownloadIcon from '@mui/icons-material/GetApp'; import DownloadIcon from '@mui/icons-material/GetApp';
import HighlightOffIcon from '@mui/icons-material/HighlightOff';
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'; import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDownOutlined'; import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDownOutlined';
import KeyboardArrowUpOutlinedIcon from '@mui/icons-material/KeyboardArrowUpOutlined'; import KeyboardArrowUpOutlinedIcon from '@mui/icons-material/KeyboardArrowUpOutlined';
@@ -26,6 +26,7 @@ import {
Grid, Grid,
Typography Typography
} from '@mui/material'; } from '@mui/material';
import { useRowSelect } from '@table-library/react-table-library/select'; import { useRowSelect } from '@table-library/react-table-library/select';
import { useSort, SortToggleType } from '@table-library/react-table-library/sort'; 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'; import { Table, Header, HeaderRow, HeaderCell, Body, Row, Cell } from '@table-library/react-table-library/table';
@@ -135,7 +136,7 @@ const DashboardDevices: FC = () => {
common_theme, common_theme,
{ {
Table: ` 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: ` BaseRow: `
.td { .td {
@@ -417,7 +418,6 @@ const DashboardDevices: FC = () => {
<HeaderRow> <HeaderRow>
<HeaderCell stiff /> <HeaderCell stiff />
<HeaderCell resize>{LL.DESCRIPTION()}</HeaderCell> <HeaderCell resize>{LL.DESCRIPTION()}</HeaderCell>
<HeaderCell stiff>{LL.TYPE(0)}</HeaderCell>
</HeaderRow> </HeaderRow>
</Header> </Header>
<Body> <Body>
@@ -426,8 +426,10 @@ const DashboardDevices: FC = () => {
<Cell stiff> <Cell stiff>
<DeviceIcon type_id={device.t} /> <DeviceIcon type_id={device.t} />
</Cell> </Cell>
<Cell>{device.n}</Cell> <Cell>
<Cell stiff>{device.tn}</Cell> {device.n}
<span style={{ color: 'lightblue' }}>&nbsp;&nbsp;({device.e})</span>
</Cell>
</Row> </Row>
))} ))}
</Body> </Body>
@@ -485,8 +487,8 @@ const DashboardDevices: FC = () => {
}} }}
> >
<Box sx={{ border: '1px solid #177ac9' }}> <Box sx={{ border: '1px solid #177ac9' }}>
<Typography noWrap variant="subtitle1" color="warning.main" sx={{ mx: 1 }}> <Typography noWrap variant="subtitle1" color="warning.main" sx={{ ml: 1 }}>
{coreData.devices[deviceIndex].n} {coreData.devices[deviceIndex].tn}&nbsp;&#124;&nbsp;{coreData.devices[deviceIndex].n}
</Typography> </Typography>
<Grid container justifyContent="space-between"> <Grid container justifyContent="space-between">
@@ -511,7 +513,7 @@ const DashboardDevices: FC = () => {
</Typography> </Typography>
<Grid item zeroMinWidth justifyContent="flex-end"> <Grid item zeroMinWidth justifyContent="flex-end">
<IconButton onClick={resetDeviceSelect}> <IconButton onClick={resetDeviceSelect}>
<CancelIcon color="info" sx={{ fontSize: 18, verticalAlign: 'middle' }} /> <HighlightOffIcon color="primary" sx={{ fontSize: 18, verticalAlign: 'middle' }} />
</IconButton> </IconButton>
</Grid> </Grid>
</Grid> </Grid>

View File

@@ -69,6 +69,7 @@ export interface Device {
d: number; // deviceid d: number; // deviceid
p: number; // productid p: number; // productid
v: string; // version v: string; // version
e: number; // entities
} }
export interface TemperatureSensor { export interface TemperatureSensor {

View File

@@ -427,7 +427,8 @@ const emsesp_coredata = {
// n: 'Enviline/Compress 6000AW/Hybrid 3000-7000iAW/SupraEco/Geo 5xx/WLW196i/WSW196i', // n: 'Enviline/Compress 6000AW/Hybrid 3000-7000iAW/SupraEco/Geo 5xx/WLW196i/WSW196i',
d: 8, d: 8,
p: 123, p: 123,
v: '06.01' v: '06.01',
e: 69
}, },
{ {
id: 3, id: 3,
@@ -437,7 +438,8 @@ const emsesp_coredata = {
n: 'GB125/GB135/MC10', n: 'GB125/GB135/MC10',
d: 8, d: 8,
p: 123, p: 123,
v: '06.01' v: '06.01',
e: 73
}, },
{ {
id: 1, id: 1,
@@ -447,7 +449,8 @@ const emsesp_coredata = {
n: 'RC35', n: 'RC35',
d: 24, d: 24,
p: 86, p: 86,
v: '04.01' v: '04.01',
e: 57
}, },
{ {
id: 2, id: 2,
@@ -457,7 +460,8 @@ const emsesp_coredata = {
n: 'RC20/Moduline 300', n: 'RC20/Moduline 300',
d: 23, d: 23,
p: 77, p: 77,
v: '03.03' v: '03.03',
e: 6
}, },
{ {
id: 4, id: 4,
@@ -467,7 +471,8 @@ const emsesp_coredata = {
n: 'RC100/Moduline 1000/1010', n: 'RC100/Moduline 1000/1010',
d: 16, d: 16,
p: 165, p: 165,
v: '04.01' v: '04.01',
e: 3
}, },
{ {
id: 5, id: 5,
@@ -477,7 +482,8 @@ const emsesp_coredata = {
n: 'MM10', n: 'MM10',
d: 32, d: 32,
p: 69, p: 69,
v: '01.01' v: '01.01',
e: 6
}, },
{ {
id: 6, id: 6,
@@ -487,7 +493,8 @@ const emsesp_coredata = {
n: 'SM10', n: 'SM10',
d: 48, d: 48,
p: 73, p: 73,
v: '01.02' v: '01.02',
e: 22
}, },
{ {
id: 99, id: 99,
@@ -497,7 +504,8 @@ const emsesp_coredata = {
n: 'User defined entities', n: 'User defined entities',
d: 1, d: 1,
p: 1, p: 1,
v: '' v: '',
e: 1
} }
] ]
}; };

View File

@@ -243,7 +243,7 @@ bool DeviceValue::hasValue() const {
has_value = Helpers::hasValue(*(uint32_t *)(value_p)); has_value = Helpers::hasValue(*(uint32_t *)(value_p));
break; break;
case DeviceValueType::CMD: case DeviceValueType::CMD:
has_value = false; // commands don't have values! has_value = true; // we count command as an actual entity
break; break;
default: default:
break; break;

View File

@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.6.3-dev.3" #define EMSESP_APP_VERSION "3.6.3-dev.4"

View File

@@ -88,6 +88,7 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
obj["d"] = emsdevice->device_id(); // deviceid obj["d"] = emsdevice->device_id(); // deviceid
obj["p"] = emsdevice->product_id(); // productid obj["p"] = emsdevice->product_id(); // productid
obj["v"] = emsdevice->version(); // version 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["d"] = 0; // deviceid
obj["p"] = 0; // productid obj["p"] = 0; // productid
obj["v"] = 0; // version obj["v"] = 0; // version
obj["e"] = EMSESP::webCustomEntityService.count_entities(); // number of custom entities
} }
root["connected"] = EMSESP::bus_status() != 2; root["connected"] = EMSESP::bus_status() != 2;