mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
84
interface/package-lock.json
generated
84
interface/package-lock.json
generated
@@ -12,10 +12,10 @@
|
|||||||
"@emotion/styled": "^11.9.3",
|
"@emotion/styled": "^11.9.3",
|
||||||
"@msgpack/msgpack": "^2.7.2",
|
"@msgpack/msgpack": "^2.7.2",
|
||||||
"@mui/icons-material": "^5.8.4",
|
"@mui/icons-material": "^5.8.4",
|
||||||
"@mui/material": "^5.9.1",
|
"@mui/material": "^5.9.2",
|
||||||
"@table-library/react-table-library": "4.0.10",
|
"@table-library/react-table-library": "4.0.10",
|
||||||
"@types/lodash": "^4.14.182",
|
"@types/lodash": "^4.14.182",
|
||||||
"@types/node": "^18.0.6",
|
"@types/node": "^18.6.1",
|
||||||
"@types/react": "^18.0.15",
|
"@types/react": "^18.0.15",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
@@ -3044,13 +3044,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/base": {
|
"node_modules/@mui/base": {
|
||||||
"version": "5.0.0-alpha.90",
|
"version": "5.0.0-alpha.91",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.90.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.91.tgz",
|
||||||
"integrity": "sha512-hNKwzr+RkiuGsGrakz8Q2i5ezr4Dz4b4Qsdipt9SiMrhuFAra/i501VSaEIzwec9LC4G+vtW4fE7yJBB0XaAYw==",
|
"integrity": "sha512-/W5amPDz+Lout4FtX5HOyx2Q+YL/EtZciFrx2DDRuUm4M/pWnjfDZAtM+0aqimEvuk3FU+/PuFc7IAyhCSX4Cg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.17.2",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@emotion/is-prop-valid": "^1.1.3",
|
"@emotion/is-prop-valid": "^1.1.3",
|
||||||
"@mui/types": "^7.1.4",
|
"@mui/types": "^7.1.5",
|
||||||
"@mui/utils": "^5.9.1",
|
"@mui/utils": "^5.9.1",
|
||||||
"@popperjs/core": "^2.11.5",
|
"@popperjs/core": "^2.11.5",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
@@ -3101,14 +3101,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/material": {
|
"node_modules/@mui/material": {
|
||||||
"version": "5.9.1",
|
"version": "5.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.9.2.tgz",
|
||||||
"integrity": "sha512-c09SbaMm7Rl7Df9JRkXwPWNbnfrutmHERTJC46OJ9OMAM9+HGQihIbGln1k2Xj65jb3E+G498FZFAoSrrBDvwQ==",
|
"integrity": "sha512-FItBuj9bPdVier2g5OBG2HHlQLou4JuH3gdnY43tpJOrCpmWrbDVJZqrSufKJFO00qjvTYaGlJedIu+vXn79qw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.17.2",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@mui/base": "5.0.0-alpha.90",
|
"@mui/base": "5.0.0-alpha.91",
|
||||||
"@mui/system": "^5.9.1",
|
"@mui/system": "^5.9.2",
|
||||||
"@mui/types": "^7.1.4",
|
"@mui/types": "^7.1.5",
|
||||||
"@mui/utils": "^5.9.1",
|
"@mui/utils": "^5.9.1",
|
||||||
"@types/react-transition-group": "^4.4.5",
|
"@types/react-transition-group": "^4.4.5",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
@@ -3201,14 +3201,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/system": {
|
"node_modules/@mui/system": {
|
||||||
"version": "5.9.1",
|
"version": "5.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.9.2.tgz",
|
||||||
"integrity": "sha512-ZixTmc2+sYp++avoYJ38eM70nfwwudN06vYCU4kfwa4nQPiH+bhLYZnfYkcXRKiDR/hfT0dptbOOfQGZqBYczQ==",
|
"integrity": "sha512-iOvt9tVeFapHL7f7M6BSIiKGMx6RTRvAmc8ipMnQ/MR5Qsxwnyv7qKtNC/K11Rk13Xx0VPaPAhyvBcsr3KdpHA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.17.2",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@mui/private-theming": "^5.9.1",
|
"@mui/private-theming": "^5.9.1",
|
||||||
"@mui/styled-engine": "^5.8.7",
|
"@mui/styled-engine": "^5.8.7",
|
||||||
"@mui/types": "^7.1.4",
|
"@mui/types": "^7.1.5",
|
||||||
"@mui/utils": "^5.9.1",
|
"@mui/utils": "^5.9.1",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"csstype": "^3.1.0",
|
"csstype": "^3.1.0",
|
||||||
@@ -3240,9 +3240,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mui/types": {
|
"node_modules/@mui/types": {
|
||||||
"version": "7.1.4",
|
"version": "7.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/types/-/types-7.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/types/-/types-7.1.5.tgz",
|
||||||
"integrity": "sha512-uveM3byMbthO+6tXZ1n2zm0W3uJCQYtwt/v5zV5I77v2v18u0ITkb8xwhsDD2i3V2Kye7SaNR6FFJ6lMuY/WqQ==",
|
"integrity": "sha512-HnRXrxgHJYJcT8ZDdDCQIlqk0s0skOKD7eWs9mJgBUu70hyW4iA6Kiv3yspJR474RFH8hysKR65VVSzUSzkuwA==",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@types/react": "*"
|
"@types/react": "*"
|
||||||
},
|
},
|
||||||
@@ -3954,9 +3954,9 @@
|
|||||||
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "18.0.6",
|
"version": "18.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.1.tgz",
|
||||||
"integrity": "sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw=="
|
"integrity": "sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg=="
|
||||||
},
|
},
|
||||||
"node_modules/@types/parse-json": {
|
"node_modules/@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@@ -19908,13 +19908,13 @@
|
|||||||
"integrity": "sha512-rYEi46+gIzufyYUAoHDnRzkWGxajpD9vVXFQ3g1vbjrBm6P7MBmm+s/fqPa46sxa+8FOUdEuRQKaugo5a4JWpw=="
|
"integrity": "sha512-rYEi46+gIzufyYUAoHDnRzkWGxajpD9vVXFQ3g1vbjrBm6P7MBmm+s/fqPa46sxa+8FOUdEuRQKaugo5a4JWpw=="
|
||||||
},
|
},
|
||||||
"@mui/base": {
|
"@mui/base": {
|
||||||
"version": "5.0.0-alpha.90",
|
"version": "5.0.0-alpha.91",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.90.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.91.tgz",
|
||||||
"integrity": "sha512-hNKwzr+RkiuGsGrakz8Q2i5ezr4Dz4b4Qsdipt9SiMrhuFAra/i501VSaEIzwec9LC4G+vtW4fE7yJBB0XaAYw==",
|
"integrity": "sha512-/W5amPDz+Lout4FtX5HOyx2Q+YL/EtZciFrx2DDRuUm4M/pWnjfDZAtM+0aqimEvuk3FU+/PuFc7IAyhCSX4Cg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.17.2",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@emotion/is-prop-valid": "^1.1.3",
|
"@emotion/is-prop-valid": "^1.1.3",
|
||||||
"@mui/types": "^7.1.4",
|
"@mui/types": "^7.1.5",
|
||||||
"@mui/utils": "^5.9.1",
|
"@mui/utils": "^5.9.1",
|
||||||
"@popperjs/core": "^2.11.5",
|
"@popperjs/core": "^2.11.5",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
@@ -19931,14 +19931,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@mui/material": {
|
"@mui/material": {
|
||||||
"version": "5.9.1",
|
"version": "5.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/material/-/material-5.9.2.tgz",
|
||||||
"integrity": "sha512-c09SbaMm7Rl7Df9JRkXwPWNbnfrutmHERTJC46OJ9OMAM9+HGQihIbGln1k2Xj65jb3E+G498FZFAoSrrBDvwQ==",
|
"integrity": "sha512-FItBuj9bPdVier2g5OBG2HHlQLou4JuH3gdnY43tpJOrCpmWrbDVJZqrSufKJFO00qjvTYaGlJedIu+vXn79qw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.17.2",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@mui/base": "5.0.0-alpha.90",
|
"@mui/base": "5.0.0-alpha.91",
|
||||||
"@mui/system": "^5.9.1",
|
"@mui/system": "^5.9.2",
|
||||||
"@mui/types": "^7.1.4",
|
"@mui/types": "^7.1.5",
|
||||||
"@mui/utils": "^5.9.1",
|
"@mui/utils": "^5.9.1",
|
||||||
"@types/react-transition-group": "^4.4.5",
|
"@types/react-transition-group": "^4.4.5",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
@@ -19970,14 +19970,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@mui/system": {
|
"@mui/system": {
|
||||||
"version": "5.9.1",
|
"version": "5.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.9.1.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/system/-/system-5.9.2.tgz",
|
||||||
"integrity": "sha512-ZixTmc2+sYp++avoYJ38eM70nfwwudN06vYCU4kfwa4nQPiH+bhLYZnfYkcXRKiDR/hfT0dptbOOfQGZqBYczQ==",
|
"integrity": "sha512-iOvt9tVeFapHL7f7M6BSIiKGMx6RTRvAmc8ipMnQ/MR5Qsxwnyv7qKtNC/K11Rk13Xx0VPaPAhyvBcsr3KdpHA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/runtime": "^7.17.2",
|
"@babel/runtime": "^7.17.2",
|
||||||
"@mui/private-theming": "^5.9.1",
|
"@mui/private-theming": "^5.9.1",
|
||||||
"@mui/styled-engine": "^5.8.7",
|
"@mui/styled-engine": "^5.8.7",
|
||||||
"@mui/types": "^7.1.4",
|
"@mui/types": "^7.1.5",
|
||||||
"@mui/utils": "^5.9.1",
|
"@mui/utils": "^5.9.1",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
"csstype": "^3.1.0",
|
"csstype": "^3.1.0",
|
||||||
@@ -19985,9 +19985,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@mui/types": {
|
"@mui/types": {
|
||||||
"version": "7.1.4",
|
"version": "7.1.5",
|
||||||
"resolved": "https://registry.npmjs.org/@mui/types/-/types-7.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/@mui/types/-/types-7.1.5.tgz",
|
||||||
"integrity": "sha512-uveM3byMbthO+6tXZ1n2zm0W3uJCQYtwt/v5zV5I77v2v18u0ITkb8xwhsDD2i3V2Kye7SaNR6FFJ6lMuY/WqQ==",
|
"integrity": "sha512-HnRXrxgHJYJcT8ZDdDCQIlqk0s0skOKD7eWs9mJgBUu70hyW4iA6Kiv3yspJR474RFH8hysKR65VVSzUSzkuwA==",
|
||||||
"requires": {}
|
"requires": {}
|
||||||
},
|
},
|
||||||
"@mui/utils": {
|
"@mui/utils": {
|
||||||
@@ -20491,9 +20491,9 @@
|
|||||||
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
"integrity": "sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw=="
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "18.0.6",
|
"version": "18.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.1.tgz",
|
||||||
"integrity": "sha512-/xUq6H2aQm261exT6iZTMifUySEt4GR5KX8eYyY+C4MSNPqSh9oNIP7tz2GLKTlFaiBbgZNxffoR3CVRG+cljw=="
|
"integrity": "sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg=="
|
||||||
},
|
},
|
||||||
"@types/parse-json": {
|
"@types/parse-json": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
|||||||
@@ -8,10 +8,10 @@
|
|||||||
"@emotion/styled": "^11.9.3",
|
"@emotion/styled": "^11.9.3",
|
||||||
"@msgpack/msgpack": "^2.7.2",
|
"@msgpack/msgpack": "^2.7.2",
|
||||||
"@mui/icons-material": "^5.8.4",
|
"@mui/icons-material": "^5.8.4",
|
||||||
"@mui/material": "^5.9.1",
|
"@mui/material": "^5.9.2",
|
||||||
"@table-library/react-table-library": "4.0.10",
|
"@table-library/react-table-library": "4.0.10",
|
||||||
"@types/lodash": "^4.14.182",
|
"@types/lodash": "^4.14.182",
|
||||||
"@types/node": "^18.0.6",
|
"@types/node": "^18.6.1",
|
||||||
"@types/react": "^18.0.15",
|
"@types/react": "^18.0.15",
|
||||||
"@types/react-dom": "^18.0.6",
|
"@types/react-dom": "^18.0.6",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import {
|
|||||||
ToggleButtonGroup,
|
ToggleButtonGroup,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
Grid,
|
Grid,
|
||||||
TextField
|
TextField,
|
||||||
|
Link
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
|
|
||||||
import { Table } from '@table-library/react-table-library/table';
|
import { Table } from '@table-library/react-table-library/table';
|
||||||
@@ -26,11 +27,6 @@ import { useSnackbar } from 'notistack';
|
|||||||
import SaveIcon from '@mui/icons-material/Save';
|
import SaveIcon from '@mui/icons-material/Save';
|
||||||
import CancelIcon from '@mui/icons-material/Cancel';
|
import CancelIcon from '@mui/icons-material/Cancel';
|
||||||
|
|
||||||
// import EditOffOutlinedIcon from '@mui/icons-material/EditOffOutlined';
|
|
||||||
// import StarIcon from '@mui/icons-material/Star';
|
|
||||||
// import VisibilityOffOutlinedIcon from '@mui/icons-material/VisibilityOffOutlined';
|
|
||||||
// import CommentsDisabledOutlinedIcon from '@mui/icons-material/CommentsDisabledOutlined';
|
|
||||||
|
|
||||||
import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
|
import SettingsBackupRestoreIcon from '@mui/icons-material/SettingsBackupRestore';
|
||||||
import KeyboardArrowUpOutlinedIcon from '@mui/icons-material/KeyboardArrowUpOutlined';
|
import KeyboardArrowUpOutlinedIcon from '@mui/icons-material/KeyboardArrowUpOutlined';
|
||||||
import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDownOutlined';
|
import KeyboardArrowDownOutlinedIcon from '@mui/icons-material/KeyboardArrowDownOutlined';
|
||||||
@@ -48,13 +44,15 @@ import { extractErrorMessage } from '../utils';
|
|||||||
|
|
||||||
import { DeviceShort, Devices, DeviceEntity, DeviceEntityMask } from './types';
|
import { DeviceShort, Devices, DeviceEntity, DeviceEntityMask } from './types';
|
||||||
|
|
||||||
|
export const APIURL = window.location.origin + '/api/';
|
||||||
|
|
||||||
const SettingsCustomization: FC = () => {
|
const SettingsCustomization: FC = () => {
|
||||||
const { enqueueSnackbar } = useSnackbar();
|
const { enqueueSnackbar } = useSnackbar();
|
||||||
|
|
||||||
const [deviceEntities, setDeviceEntities] = useState<DeviceEntity[]>([{ id: '', v: 0, n: '', m: 0, w: false }]);
|
const [deviceEntities, setDeviceEntities] = useState<DeviceEntity[]>([{ id: '', v: 0, n: '', m: 0, w: false }]);
|
||||||
const [devices, setDevices] = useState<Devices>();
|
const [devices, setDevices] = useState<Devices>();
|
||||||
const [errorMessage, setErrorMessage] = useState<string>();
|
const [errorMessage, setErrorMessage] = useState<string>();
|
||||||
const [selectedDevice, setSelectedDevice] = useState<number>(0);
|
const [selectedDevice, setSelectedDevice] = useState<number>(-1);
|
||||||
const [confirmReset, setConfirmReset] = useState<boolean>(false);
|
const [confirmReset, setConfirmReset] = useState<boolean>(false);
|
||||||
const [selectedFilters, setSelectedFilters] = useState<number>(0);
|
const [selectedFilters, setSelectedFilters] = useState<number>(0);
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
@@ -94,7 +92,6 @@ const SettingsCustomization: FC = () => {
|
|||||||
Row: `
|
Row: `
|
||||||
background-color: #1e1e1e;
|
background-color: #1e1e1e;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
.td {
|
.td {
|
||||||
border-top: 1px solid #565656;
|
border-top: 1px solid #565656;
|
||||||
@@ -107,11 +104,6 @@ const SettingsCustomization: FC = () => {
|
|||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover .td {
|
|
||||||
border-top: 1px solid #177ac9;
|
|
||||||
border-bottom: 1px solid #177ac9;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:nth-of-type(odd) .td {
|
&:nth-of-type(odd) .td {
|
||||||
background-color: #303030;
|
background-color: #303030;
|
||||||
}
|
}
|
||||||
@@ -194,7 +186,15 @@ const SettingsCustomization: FC = () => {
|
|||||||
} else if (de.n === '') {
|
} else if (de.n === '') {
|
||||||
return 'Command: ' + de.id;
|
return 'Command: ' + de.id;
|
||||||
}
|
}
|
||||||
return de.n + ' (' + de.id + ')';
|
return (
|
||||||
|
<>
|
||||||
|
{de.n} (
|
||||||
|
<Link target="_blank" href={APIURL + devices?.devices[selectedDevice].t + '/' + de.id}>
|
||||||
|
{de.id}
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getMaskNumber = (newMask: string[]) => {
|
const getMaskNumber = (newMask: string[]) => {
|
||||||
@@ -239,20 +239,12 @@ const SettingsCustomization: FC = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
function compareDevices(a: DeviceShort, b: DeviceShort) {
|
|
||||||
if (a.s < b.s) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (a.s > b.s) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const changeSelectedDevice = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const changeSelectedDevice = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
const selected_device = parseInt(event.target.value, 10);
|
if (devices) {
|
||||||
setSelectedDevice(selected_device);
|
const selected_device = parseInt(event.target.value, 10);
|
||||||
fetchDeviceEntities(selected_device);
|
setSelectedDevice(selected_device);
|
||||||
|
fetchDeviceEntities(devices?.devices[selected_device].i);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetCustomization = async () => {
|
const resetCustomization = async () => {
|
||||||
@@ -267,7 +259,7 @@ const SettingsCustomization: FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const saveCustomization = async () => {
|
const saveCustomization = async () => {
|
||||||
if (deviceEntities && selectedDevice) {
|
if (devices && deviceEntities && selectedDevice !== -1) {
|
||||||
const masked_entities = deviceEntities
|
const masked_entities = deviceEntities
|
||||||
.filter((de) => de.m !== de.om)
|
.filter((de) => de.m !== de.om)
|
||||||
.map((new_de) => new_de.m.toString(16).padStart(2, '0') + new_de.id);
|
.map((new_de) => new_de.m.toString(16).padStart(2, '0') + new_de.id);
|
||||||
@@ -279,7 +271,7 @@ const SettingsCustomization: FC = () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await EMSESP.writeMaskedEntities({
|
const response = await EMSESP.writeMaskedEntities({
|
||||||
id: selectedDevice,
|
id: devices?.devices[selectedDevice].i,
|
||||||
entity_ids: masked_entities
|
entity_ids: masked_entities
|
||||||
});
|
});
|
||||||
if (response.status === 200) {
|
if (response.status === 200) {
|
||||||
@@ -305,13 +297,13 @@ const SettingsCustomization: FC = () => {
|
|||||||
<Typography variant="body2">Select a device and customize each of its entities using the options:</Typography>
|
<Typography variant="body2">Select a device and customize each of its entities using the options:</Typography>
|
||||||
<Typography variant="body2">
|
<Typography variant="body2">
|
||||||
<OptionIcon type="favorite" isSet={true} />
|
<OptionIcon type="favorite" isSet={true} />
|
||||||
=mark as a favorite
|
=mark as favorite
|
||||||
<OptionIcon type="readonly" isSet={true} />
|
<OptionIcon type="readonly" isSet={true} />
|
||||||
=disable write action
|
=disable write action
|
||||||
<OptionIcon type="api_mqtt_exclude" isSet={true} />
|
<OptionIcon type="api_mqtt_exclude" isSet={true} />
|
||||||
=exclude from MQTT and API outputs
|
=exclude from MQTT and API
|
||||||
<OptionIcon type="web_exclude" isSet={true} />
|
<OptionIcon type="web_exclude" isSet={true} />
|
||||||
=hide from Web Dashboard
|
=hide from Dashboard
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
<ValidatedTextField
|
<ValidatedTextField
|
||||||
@@ -324,11 +316,11 @@ const SettingsCustomization: FC = () => {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
select
|
select
|
||||||
>
|
>
|
||||||
<MenuItem disabled key={0} value={0}>
|
<MenuItem disabled key={0} value={-1}>
|
||||||
Select a device...
|
Select a device...
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
{devices.devices.sort(compareDevices).map((device: DeviceShort, index) => (
|
{devices.devices.map((device: DeviceShort, index) => (
|
||||||
<MenuItem key={index} value={device.i}>
|
<MenuItem key={index} value={index}>
|
||||||
{device.s}
|
{device.s}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -104,9 +104,10 @@ export interface CoreData {
|
|||||||
|
|
||||||
export interface DeviceShort {
|
export interface DeviceShort {
|
||||||
i: number; // id
|
i: number; // id
|
||||||
d: number; // deviceid
|
d?: number; // deviceid
|
||||||
p: number; // productid
|
p?: number; // productid
|
||||||
s: string; // shortname
|
s: string; // shortname
|
||||||
|
t?: string; // device type name
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Devices {
|
export interface Devices {
|
||||||
|
|||||||
@@ -347,18 +347,21 @@ const emsesp_devices = {
|
|||||||
d: 23,
|
d: 23,
|
||||||
p: 77,
|
p: 77,
|
||||||
s: 'Thermostat (RC20/Moduline 300)',
|
s: 'Thermostat (RC20/Moduline 300)',
|
||||||
|
t: 'thermostat1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
i: 2,
|
i: 2,
|
||||||
d: 8,
|
d: 8,
|
||||||
p: 123,
|
p: 123,
|
||||||
s: 'Boiler (Nefit GBx72/Trendline/Cerapur/Greenstar Si/27i)',
|
s: 'Boiler (Nefit GBx72/Trendline/Cerapur/Greenstar Si/27i)',
|
||||||
|
t: 'boiler',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
i: 4,
|
i: 4,
|
||||||
d: 16,
|
d: 16,
|
||||||
p: 165,
|
p: 165,
|
||||||
s: 'Thermostat (RC100/Moduline 1000/1010)',
|
s: 'Thermostat (RC100/Moduline 1000/1010)',
|
||||||
|
t: 'thermostat2',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
@@ -1224,8 +1227,8 @@ rest_server.get(GET_CUSTOMIZATIONS_ENDPOINT, (req, res) => {
|
|||||||
|
|
||||||
// start server
|
// start server
|
||||||
const expressServer = rest_server.listen(port, () =>
|
const expressServer = rest_server.listen(port, () =>
|
||||||
|
console.log(`EMS-ESP REST API server running on http://localhost:${port}/api`),
|
||||||
)
|
)
|
||||||
console.log(`EMS-ESP Rest API listening to http://localhost:${port}/api`)
|
|
||||||
|
|
||||||
// start websocket server
|
// start websocket server
|
||||||
const websocketServer = new WebSocket.Server({
|
const websocketServer = new WebSocket.Server({
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ std::string EMSdevice::device_type_2_device_name(const uint8_t device_type) {
|
|||||||
// returns device_type from a string
|
// returns device_type from a string
|
||||||
uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
|
uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return DeviceType::UNKNOWN; // nullptr
|
return DeviceType::UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert topic to lowercase and compare
|
// convert topic to lowercase and compare
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ MAKE_PSTR(bufferedflow, "Durchlaufspeicher")
|
|||||||
MAKE_PSTR(layeredbuffer, "Schichtspeicher")
|
MAKE_PSTR(layeredbuffer, "Schichtspeicher")
|
||||||
MAKE_PSTR(maintenance, "Wartung")
|
MAKE_PSTR(maintenance, "Wartung")
|
||||||
MAKE_PSTR(heating, "Heizen")
|
MAKE_PSTR(heating, "Heizen")
|
||||||
MAKE_PSTR(cooling, "K<EFBFBD>hlen")
|
MAKE_PSTR(cooling, "K<EFBFBD>hlen")
|
||||||
|
|
||||||
// boiler lists
|
// boiler lists
|
||||||
MAKE_PSTR_LIST(tpl_date, F("Format: < dd.mm.yyyy >")) // template for text input
|
MAKE_PSTR_LIST(tpl_date, F("Format: < dd.mm.yyyy >")) // template for text input
|
||||||
@@ -312,7 +312,7 @@ MAKE_PSTR(winter, "Winter")
|
|||||||
MAKE_PSTR(outdoor, "Aussentemperatur")
|
MAKE_PSTR(outdoor, "Aussentemperatur")
|
||||||
MAKE_PSTR_WORD(mpc)
|
MAKE_PSTR_WORD(mpc)
|
||||||
MAKE_PSTR(room, "Raum")
|
MAKE_PSTR(room, "Raum")
|
||||||
MAKE_PSTR(room_outdoor, "Raum+Au<41>en")
|
MAKE_PSTR(room_outdoor, "Raum+Au<41>en")
|
||||||
MAKE_PSTR(power, "Leistung")
|
MAKE_PSTR(power, "Leistung")
|
||||||
MAKE_PSTR(constant, "konstant")
|
MAKE_PSTR(constant, "konstant")
|
||||||
MAKE_PSTR(simple, "einfach")
|
MAKE_PSTR(simple, "einfach")
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// SUrlParser from https://github.com/Mad-ness/simple-url-parser
|
|
||||||
|
|
||||||
#include "emsesp.h"
|
#include "emsesp.h"
|
||||||
|
|
||||||
using namespace std::placeholders; // for `_1` etc
|
using namespace std::placeholders; // for `_1` etc
|
||||||
|
|||||||
@@ -165,22 +165,27 @@ void WebCustomizationService::devices(AsyncWebServerRequest * request) {
|
|||||||
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_LARGE_DYN);
|
auto * response = new AsyncJsonResponse(false, EMSESP_JSON_SIZE_LARGE_DYN);
|
||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
|
// list is already sorted by device type
|
||||||
|
// controller is ignored since it doesn't have any associated entities
|
||||||
JsonArray devices = root.createNestedArray("devices");
|
JsonArray devices = root.createNestedArray("devices");
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if (emsdevice->has_entities()) {
|
if (emsdevice->has_entities()) {
|
||||||
JsonObject obj = devices.createNestedObject();
|
JsonObject obj = devices.createNestedObject();
|
||||||
obj["i"] = emsdevice->unique_id(); // a unique id
|
obj["i"] = emsdevice->unique_id(); // its unique id
|
||||||
|
obj["s"] = emsdevice->device_type_name() + " (" + emsdevice->name() + ")"; // shortname
|
||||||
|
|
||||||
|
// device type name. We may have one than one (e.g. multiple thermostats) so postfix name with index
|
||||||
|
// code block not needed - see https://github.com/emsesp/EMS-ESP32/pull/586#issuecomment-1193779668
|
||||||
/*
|
/*
|
||||||
uint8_t device_index = EMSESP::device_index(emsdevice->device_type(), emsdevice->unique_id());
|
uint8_t device_index = EMSESP::device_index(emsdevice->device_type(), emsdevice->unique_id());
|
||||||
if (device_index) {
|
if (device_index) {
|
||||||
char s[10];
|
char s[10];
|
||||||
obj["s"] = emsdevice->device_type_name() + Helpers::smallitoa(s, device_index) + " (" + emsdevice->name() + ")"; // shortname - we prefix the count to make it unique
|
obj["t"] = Helpers::toLower(emsdevice->device_type_name()) + Helpers::smallitoa(s, device_index);
|
||||||
} else {
|
} else {
|
||||||
obj["s"] = emsdevice->device_type_name() + " (" + emsdevice->name() + ")";
|
obj["t"] = Helpers::toLower(emsdevice->device_type_name());
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
obj["s"] = emsdevice->device_type_name() + " (" + emsdevice->name() + ")";
|
obj["t"] = Helpers::toLower(emsdevice->device_type_name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,10 +74,10 @@ void WebDataService::core_data(AsyncWebServerRequest * request) {
|
|||||||
JsonObject root = response->getRoot();
|
JsonObject root = response->getRoot();
|
||||||
|
|
||||||
// list is already sorted by device type
|
// list is already sorted by device type
|
||||||
// Ignore Contoller
|
|
||||||
JsonArray devices = root.createNestedArray("devices");
|
JsonArray devices = root.createNestedArray("devices");
|
||||||
char buffer[3];
|
char buffer[3];
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
|
// ignore controller
|
||||||
if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::CONTROLLER || emsdevice->count_entities() > 0)) {
|
if (emsdevice && (emsdevice->device_type() != EMSdevice::DeviceType::CONTROLLER || emsdevice->count_entities() > 0)) {
|
||||||
JsonObject obj = devices.createNestedObject();
|
JsonObject obj = devices.createNestedObject();
|
||||||
obj["id"] = Helpers::smallitoa(buffer, emsdevice->unique_id()); // a unique id as a string
|
obj["id"] = Helpers::smallitoa(buffer, emsdevice->unique_id()); // a unique id as a string
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * se
|
|||||||
void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
|
case ARDUINO_EVENT_WIFI_STA_DISCONNECTED:
|
||||||
EMSESP::logger().info(F("WiFi disconnected. Reason code=%d"), info.wifi_sta_disconnected.reason); // IDF 4.0
|
EMSESP::logger().warning(F("WiFi disconnected. Reason code=%d"), info.wifi_sta_disconnected.reason); // IDF 4.0
|
||||||
WiFi.disconnect(true);
|
WiFi.disconnect(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ void WebStatusService::WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
case ARDUINO_EVENT_ETH_DISCONNECTED:
|
||||||
EMSESP::logger().info(F("Ethernet disconnected"));
|
EMSESP::logger().warning(F("Ethernet disconnected"));
|
||||||
EMSESP::system_.ethernet_connected(false);
|
EMSESP::system_.ethernet_connected(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user