mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
Call read commands from Web #2116
This commit is contained in:
@@ -48,6 +48,7 @@ For more details go to [www.emsesp.org](https://www.emsesp.org/).
|
|||||||
- internal ESP32 temperature sensor on the S3 [#2077](https://github.com/emsesp/EMS-ESP32/issues/2077)
|
- internal ESP32 temperature sensor on the S3 [#2077](https://github.com/emsesp/EMS-ESP32/issues/2077)
|
||||||
- MQTT status topic (used in connect and last will) set to Retain [#2086](https://github.com/emsesp/EMS-ESP32/discussions/2086)
|
- MQTT status topic (used in connect and last will) set to Retain [#2086](https://github.com/emsesp/EMS-ESP32/discussions/2086)
|
||||||
- Czech language [2096](https://github.com/emsesp/EMS-ESP32/issues/2096)
|
- Czech language [2096](https://github.com/emsesp/EMS-ESP32/issues/2096)
|
||||||
|
- Developer Mode and send EMS Read Commands from WebUI [#2116](https://github.com/emsesp/EMS-ESP32/issues/2116)
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,24 @@ import { useEffect, useRef, useState } from 'react';
|
|||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
import DownloadIcon from '@mui/icons-material/GetApp';
|
import DownloadIcon from '@mui/icons-material/GetApp';
|
||||||
|
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
||||||
import WarningIcon from '@mui/icons-material/Warning';
|
import WarningIcon from '@mui/icons-material/Warning';
|
||||||
import { Box, Button, Checkbox, MenuItem, TextField, styled } from '@mui/material';
|
import {
|
||||||
|
Box,
|
||||||
|
Button,
|
||||||
|
Checkbox,
|
||||||
|
IconButton,
|
||||||
|
MenuItem,
|
||||||
|
TextField,
|
||||||
|
styled
|
||||||
|
} from '@mui/material';
|
||||||
import Grid from '@mui/material/Grid2';
|
import Grid from '@mui/material/Grid2';
|
||||||
|
|
||||||
|
import { API } from 'api/app';
|
||||||
import { fetchLogES, readLogSettings, updateLogSettings } from 'api/system';
|
import { fetchLogES, readLogSettings, updateLogSettings } from 'api/system';
|
||||||
|
|
||||||
import { useSSE } from 'alova/client';
|
import { useRequest, useSSE } from 'alova/client';
|
||||||
|
import type { APIcall } from 'app/main/types';
|
||||||
import {
|
import {
|
||||||
BlockFormControlLabel,
|
BlockFormControlLabel,
|
||||||
BlockNavigation,
|
BlockNavigation,
|
||||||
@@ -80,9 +91,20 @@ const SystemLog = () => {
|
|||||||
update: updateLogSettings
|
update: updateLogSettings
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const { send } = useRequest(
|
||||||
|
(data: string) => API({ device: 'system', cmd: 'read', id: 0, value: data }),
|
||||||
|
{
|
||||||
|
immediate: false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const [readValue, setReadValue] = useState('');
|
||||||
|
const [readOpen, setReadOpen] = useState(false);
|
||||||
const [logEntries, setLogEntries] = useState<LogEntry[]>([]);
|
const [logEntries, setLogEntries] = useState<LogEntry[]>([]);
|
||||||
const [autoscroll, setAutoscroll] = useState(true);
|
const [autoscroll, setAutoscroll] = useState(true);
|
||||||
|
|
||||||
|
const ALPHA_NUMERIC_DASH_REGEX = /^[a-fA-F0-9 ]+$/;
|
||||||
|
|
||||||
const updateFormValue = updateValueDirty(
|
const updateFormValue = updateValueDirty(
|
||||||
origData,
|
origData,
|
||||||
dirtyFlags,
|
dirtyFlags,
|
||||||
@@ -150,6 +172,17 @@ const SystemLog = () => {
|
|||||||
}
|
}
|
||||||
}, [logEntries.length]);
|
}, [logEntries.length]);
|
||||||
|
|
||||||
|
const sendReadCommand = () => {
|
||||||
|
if (readValue === '') {
|
||||||
|
setReadOpen(!readOpen);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void send(readValue);
|
||||||
|
console.log('send read command', readValue); // TODO remove
|
||||||
|
setReadOpen(false);
|
||||||
|
setReadValue('');
|
||||||
|
};
|
||||||
|
|
||||||
const content = () => {
|
const content = () => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return <FormLoader onRetry={loadData} errorMessage={errorMessage} />;
|
return <FormLoader onRetry={loadData} errorMessage={errorMessage} />;
|
||||||
@@ -163,7 +196,7 @@ const SystemLog = () => {
|
|||||||
name="level"
|
name="level"
|
||||||
label={LL.LOG_LEVEL()}
|
label={LL.LOG_LEVEL()}
|
||||||
value={data.level}
|
value={data.level}
|
||||||
sx={{ width: '15ch' }}
|
sx={{ width: '10ch' }}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onChange={updateFormValue}
|
onChange={updateFormValue}
|
||||||
margin="normal"
|
margin="normal"
|
||||||
@@ -218,24 +251,49 @@ const SystemLog = () => {
|
|||||||
label={LL.AUTO_SCROLL()}
|
label={LL.AUTO_SCROLL()}
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Button
|
<Grid>
|
||||||
startIcon={<DownloadIcon />}
|
|
||||||
variant="outlined"
|
|
||||||
color="secondary"
|
|
||||||
onClick={onDownload}
|
|
||||||
>
|
|
||||||
{LL.EXPORT()}
|
|
||||||
</Button>
|
|
||||||
{dirtyFlags && dirtyFlags.length !== 0 && (
|
|
||||||
<Button
|
<Button
|
||||||
startIcon={<WarningIcon color="warning" />}
|
startIcon={<DownloadIcon />}
|
||||||
variant="contained"
|
variant="outlined"
|
||||||
color="info"
|
color="secondary"
|
||||||
onClick={saveSettings}
|
onClick={onDownload}
|
||||||
>
|
>
|
||||||
{LL.APPLY_CHANGES(dirtyFlags.length)}
|
{LL.EXPORT()}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
{dirtyFlags && dirtyFlags.length !== 0 && (
|
||||||
|
<Button
|
||||||
|
startIcon={<WarningIcon color="warning" />}
|
||||||
|
variant="contained"
|
||||||
|
color="info"
|
||||||
|
onClick={saveSettings}
|
||||||
|
>
|
||||||
|
{LL.APPLY_CHANGES(dirtyFlags.length)}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
{readOpen && (
|
||||||
|
<TextField
|
||||||
|
value={readValue}
|
||||||
|
onChange={(event) => {
|
||||||
|
const value = event.target.value;
|
||||||
|
if (value !== '' && !ALPHA_NUMERIC_DASH_REGEX.test(value)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setReadValue(value);
|
||||||
|
}}
|
||||||
|
focused={true}
|
||||||
|
label="Send Read command"
|
||||||
|
variant="outlined"
|
||||||
|
helperText="<deviceID> <type ID> [offset] [length]"
|
||||||
|
size="small"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<IconButton onClick={sendReadCommand}>
|
||||||
|
<PlayArrowIcon color="primary" />
|
||||||
|
</IconButton>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
|||||||
@@ -344,6 +344,7 @@ const cz: Translation = {
|
|||||||
DASHBOARD: 'Dashboard',
|
DASHBOARD: 'Dashboard',
|
||||||
NO_DATA: 'Žádná data nejsou k dispozici',
|
NO_DATA: 'Žádná data nejsou k dispozici',
|
||||||
DASHBOARD_1: 'Přizpůsobte si dashboard označením EMS entit jako Oblíbené pomocí modulu Přizpůsobení.',
|
DASHBOARD_1: 'Přizpůsobte si dashboard označením EMS entit jako Oblíbené pomocí modulu Přizpůsobení.',
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default cz;
|
export default cz;
|
||||||
|
|||||||
@@ -343,7 +343,8 @@ const de: Translation = {
|
|||||||
AUTO_SCROLL: 'Automatisches Scrollen',
|
AUTO_SCROLL: 'Automatisches Scrollen',
|
||||||
DASHBOARD: 'Dashboard',
|
DASHBOARD: 'Dashboard',
|
||||||
NO_DATA: 'Keine Daten verfügbar',
|
NO_DATA: 'Keine Daten verfügbar',
|
||||||
DASHBOARD_1: 'Passen Sie Ihr Dashboard an, indem Sie EMS-Entitäten mithilfe des Moduls „Anpassungen“ als Favorit markieren.'
|
DASHBOARD_1: 'Passen Sie Ihr Dashboard an, indem Sie EMS-Entitäten mithilfe des Moduls „Anpassungen“ als Favorit markieren.',
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default de;
|
export default de;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const en: Translation = {
|
|||||||
READONLY: 'Enable read-only mode (blocks all outgoing EMS Tx Write commands)',
|
READONLY: 'Enable read-only mode (blocks all outgoing EMS Tx Write commands)',
|
||||||
UNDERCLOCK_CPU: 'Underclock CPU speed',
|
UNDERCLOCK_CPU: 'Underclock CPU speed',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote on missing room temperature',
|
||||||
HEATINGOFF: 'Start boiler with forced heating off',
|
HEATINGOFF: 'Start boiler with forced heating off',
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Enable Shower Timer',
|
ENABLE_SHOWER_TIMER: 'Enable Shower Timer',
|
||||||
@@ -344,6 +344,7 @@ const en: Translation = {
|
|||||||
DASHBOARD: 'Dashboard',
|
DASHBOARD: 'Dashboard',
|
||||||
NO_DATA: 'No data available',
|
NO_DATA: 'No data available',
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.',
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.',
|
||||||
|
DEVELOPER_MODE: 'Developer Mode'
|
||||||
};
|
};
|
||||||
|
|
||||||
export default en;
|
export default en;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ const fr: Translation = {
|
|||||||
UNDERCLOCK_CPU: 'Underclock du CPU',
|
UNDERCLOCK_CPU: 'Underclock du CPU',
|
||||||
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote on missing room temperature', // TODO translate
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Activer la minuterie de la douche',
|
ENABLE_SHOWER_TIMER: 'Activer la minuterie de la douche',
|
||||||
ENABLE_SHOWER_ALERT: 'Activer les alertes de durée de douche',
|
ENABLE_SHOWER_ALERT: 'Activer les alertes de durée de douche',
|
||||||
@@ -343,7 +343,8 @@ const fr: Translation = {
|
|||||||
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
||||||
DASHBOARD: 'Dashboard', // TODO translate
|
DASHBOARD: 'Dashboard', // TODO translate
|
||||||
NO_DATA: 'No data available', // TODO translate
|
NO_DATA: 'No data available', // TODO translate
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.' // TODO translate
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.', // TODO translate
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default fr;
|
export default fr;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const it: Translation = {
|
|||||||
READONLY: 'Abilita modalità sola-lettura (blocca tutti i comandi di scrittura EMS Tx in uscita)',
|
READONLY: 'Abilita modalità sola-lettura (blocca tutti i comandi di scrittura EMS Tx in uscita)',
|
||||||
UNDERCLOCK_CPU: 'Abbassa velocità della CPU',
|
UNDERCLOCK_CPU: 'Abbassa velocità della CPU',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote on missing room temperature', // TODO translate
|
||||||
HEATINGOFF: 'Avviamento caldaia con riscaldamento forzato spento',
|
HEATINGOFF: 'Avviamento caldaia con riscaldamento forzato spento',
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Abilita timer doccia',
|
ENABLE_SHOWER_TIMER: 'Abilita timer doccia',
|
||||||
@@ -343,7 +343,8 @@ const it: Translation = {
|
|||||||
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
||||||
DASHBOARD: 'Dashboard', // TODO translate
|
DASHBOARD: 'Dashboard', // TODO translate
|
||||||
NO_DATA: 'No data available', // TODO translate
|
NO_DATA: 'No data available', // TODO translate
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.' // TODO translate
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.', // TODO translate
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default it;
|
export default it;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const nl: Translation = {
|
|||||||
READONLY: 'Activeer read-only modus (blokkeert alle outgaande EMS Tx schrijf commandos)',
|
READONLY: 'Activeer read-only modus (blokkeert alle outgaande EMS Tx schrijf commandos)',
|
||||||
UNDERCLOCK_CPU: 'Underclock CPU snelheid',
|
UNDERCLOCK_CPU: 'Underclock CPU snelheid',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote on missing room temperature', // TODO translate
|
||||||
HEATINGOFF: 'Start ketel met geforceerde verwarming uit',
|
HEATINGOFF: 'Start ketel met geforceerde verwarming uit',
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Activeer Douche Timer (tijdmeting)',
|
ENABLE_SHOWER_TIMER: 'Activeer Douche Timer (tijdmeting)',
|
||||||
@@ -343,7 +343,8 @@ const nl: Translation = {
|
|||||||
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
||||||
DASHBOARD: 'Dashboard', // TODO translate
|
DASHBOARD: 'Dashboard', // TODO translate
|
||||||
NO_DATA: 'No data available', // TODO translate
|
NO_DATA: 'No data available', // TODO translate
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.' // TODO translate
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.', // TODO translate
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default nl;
|
export default nl;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const no: Translation = {
|
|||||||
READONLY: 'Aktiver read-only modus (blokker all EMS Tx Skriving)',
|
READONLY: 'Aktiver read-only modus (blokker all EMS Tx Skriving)',
|
||||||
UNDERCLOCK_CPU: 'Underklokking av prosessorhastighet',
|
UNDERCLOCK_CPU: 'Underklokking av prosessorhastighet',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote control on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote control on missing room temperature', // TODO translate
|
||||||
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Aktiver Dusjtimer',
|
ENABLE_SHOWER_TIMER: 'Aktiver Dusjtimer',
|
||||||
@@ -343,7 +343,8 @@ const no: Translation = {
|
|||||||
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
||||||
DASHBOARD: 'Dashboard', // TODO translate
|
DASHBOARD: 'Dashboard', // TODO translate
|
||||||
NO_DATA: 'No data available', // TODO translate
|
NO_DATA: 'No data available', // TODO translate
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.' // TODO translate
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.', // TODO translate
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default no;
|
export default no;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const pl: BaseTranslation = {
|
|||||||
READONLY: 'Tryb pracy "tylko do odczytu" (blokuje wszystkie komendy zapisu na magistralę EMS)',
|
READONLY: 'Tryb pracy "tylko do odczytu" (blokuje wszystkie komendy zapisu na magistralę EMS)',
|
||||||
UNDERCLOCK_CPU: 'Obniż taktowanie CPU',
|
UNDERCLOCK_CPU: 'Obniż taktowanie CPU',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote control on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote control on missing room temperature', // TODO translate
|
||||||
HEATINGOFF: 'Uruchom kocioł z wymuszonym wyłączonym grzaniem',
|
HEATINGOFF: 'Uruchom kocioł z wymuszonym wyłączonym grzaniem',
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Aktywuj minutnik prysznica',
|
ENABLE_SHOWER_TIMER: 'Aktywuj minutnik prysznica',
|
||||||
@@ -343,7 +343,8 @@ const pl: BaseTranslation = {
|
|||||||
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
||||||
DASHBOARD: 'Dashboard', // TODO translate
|
DASHBOARD: 'Dashboard', // TODO translate
|
||||||
NO_DATA: 'No data available', // TODO translate
|
NO_DATA: 'No data available', // TODO translate
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.' // TODO translate
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.', // TODO translate
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default pl;
|
export default pl;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const sk: Translation = {
|
|||||||
READONLY: 'Povoliť režim len na čítanie (blokuje všetky odchádzajúce príkazy EMS Tx Write)',
|
READONLY: 'Povoliť režim len na čítanie (blokuje všetky odchádzajúce príkazy EMS Tx Write)',
|
||||||
UNDERCLOCK_CPU: 'Podtaktovanie rýchlosti procesora',
|
UNDERCLOCK_CPU: 'Podtaktovanie rýchlosti procesora',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote on missing room temperature', // TODO translate
|
||||||
HEATINGOFF: 'Spustiť kotol s vynúteným vykurovaním',
|
HEATINGOFF: 'Spustiť kotol s vynúteným vykurovaním',
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Povoliť časovač sprchovania',
|
ENABLE_SHOWER_TIMER: 'Povoliť časovač sprchovania',
|
||||||
@@ -343,7 +343,8 @@ const sk: Translation = {
|
|||||||
AUTO_SCROLL: 'Automatické rolovanie',
|
AUTO_SCROLL: 'Automatické rolovanie',
|
||||||
DASHBOARD: 'Panel',
|
DASHBOARD: 'Panel',
|
||||||
NO_DATA: 'Nie sú k dispozícii žiadne údaje',
|
NO_DATA: 'Nie sú k dispozícii žiadne údaje',
|
||||||
DASHBOARD_1: 'Prispôsobte si svoj informačný panel tak, že označíte entity EMS ako Obľúbené pomocou modulu Prispôsobenia.'
|
DASHBOARD_1: 'Prispôsobte si svoj informačný panel tak, že označíte entity EMS ako Obľúbené pomocou modulu Prispôsobenia.',
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sk;
|
export default sk;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const sv: Translation = {
|
|||||||
READONLY: 'Aktivera read-only (blockerar alla utgående skrivkommandon mot EMS-bussen)',
|
READONLY: 'Aktivera read-only (blockerar alla utgående skrivkommandon mot EMS-bussen)',
|
||||||
UNDERCLOCK_CPU: 'Nedklocka Processorhastighet',
|
UNDERCLOCK_CPU: 'Nedklocka Processorhastighet',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote on missing room temperature', // TODO translate
|
||||||
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Aktivera Dusch-timer',
|
ENABLE_SHOWER_TIMER: 'Aktivera Dusch-timer',
|
||||||
@@ -343,7 +343,8 @@ const sv: Translation = {
|
|||||||
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
||||||
DASHBOARD: 'Dashboard', // TODO translate
|
DASHBOARD: 'Dashboard', // TODO translate
|
||||||
NO_DATA: 'No data available', // TODO translate
|
NO_DATA: 'No data available', // TODO translate
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.' // TODO translate
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.', // TODO translate
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sv;
|
export default sv;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ const tr: Translation = {
|
|||||||
READONLY: 'Salt okunur modu devreye al (bütün giden EMS Tx Yazma komutlarını engeller)',
|
READONLY: 'Salt okunur modu devreye al (bütün giden EMS Tx Yazma komutlarını engeller)',
|
||||||
UNDERCLOCK_CPU: 'İşlemci hızını düşür',
|
UNDERCLOCK_CPU: 'İşlemci hızını düşür',
|
||||||
REMOTE_TIMEOUT: 'Remote timeout',
|
REMOTE_TIMEOUT: 'Remote timeout',
|
||||||
REMOTE_TIMEOUT_EN: 'Disable remote on missing roomtemperature',
|
REMOTE_TIMEOUT_EN: 'Disable remote on missing room temperature', // TODO translate
|
||||||
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
HEATINGOFF: 'Start boiler with forced heating off', // TODO translate
|
||||||
MIN_DURATION: 'Wait time',
|
MIN_DURATION: 'Wait time',
|
||||||
ENABLE_SHOWER_TIMER: 'Duş Sayacını Devreye Al',
|
ENABLE_SHOWER_TIMER: 'Duş Sayacını Devreye Al',
|
||||||
@@ -343,7 +343,8 @@ const tr: Translation = {
|
|||||||
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
AUTO_SCROLL: 'Auto Scroll', // TODO translate
|
||||||
DASHBOARD: 'Dashboard', // TODO translate
|
DASHBOARD: 'Dashboard', // TODO translate
|
||||||
NO_DATA: 'No data available', // TODO translate
|
NO_DATA: 'No data available', // TODO translate
|
||||||
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.' // TODO translate
|
DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module.', // TODO translate
|
||||||
|
DEVELOPER_MODE: 'Developer Mode' // TODO translate
|
||||||
};
|
};
|
||||||
|
|
||||||
export default tr;
|
export default tr;
|
||||||
|
|||||||
@@ -207,13 +207,66 @@ function check_upgrade(version: string) {
|
|||||||
|
|
||||||
// START DATA
|
// START DATA
|
||||||
|
|
||||||
|
// EMS-ESP Application Settings
|
||||||
|
let settings = {
|
||||||
|
locale: 'en',
|
||||||
|
tx_mode: 1,
|
||||||
|
ems_bus_id: 11,
|
||||||
|
syslog_enabled: false,
|
||||||
|
syslog_level: 3,
|
||||||
|
trace_raw: false,
|
||||||
|
syslog_mark_interval: 0,
|
||||||
|
syslog_host: '192.168.1.8',
|
||||||
|
syslog_port: 514,
|
||||||
|
boiler_heatingoff: false,
|
||||||
|
remote_timeout: 24,
|
||||||
|
remote_timeout_en: false,
|
||||||
|
shower_timer: true,
|
||||||
|
shower_alert: false,
|
||||||
|
shower_alert_coldshot: 10,
|
||||||
|
shower_alert_trigger: 7,
|
||||||
|
shower_min_duration: 180,
|
||||||
|
rx_gpio: 4,
|
||||||
|
tx_gpio: 5,
|
||||||
|
dallas_gpio: 14,
|
||||||
|
dallas_parasite: false,
|
||||||
|
led_gpio: 2,
|
||||||
|
hide_led: true,
|
||||||
|
low_clock: false,
|
||||||
|
telnet_enabled: true,
|
||||||
|
notoken_api: false,
|
||||||
|
readonly_mode: false,
|
||||||
|
analog_enabled: true,
|
||||||
|
pbutton_gpio: 34,
|
||||||
|
solar_maxflow: 30,
|
||||||
|
board_profile: 'E32V2',
|
||||||
|
fahrenheit: false,
|
||||||
|
bool_format: 1,
|
||||||
|
bool_dashboard: 1,
|
||||||
|
enum_format: 1,
|
||||||
|
weblog_level: 6,
|
||||||
|
weblog_buffer: 50,
|
||||||
|
weblog_compact: true,
|
||||||
|
phy_type: 1,
|
||||||
|
eth_power: 15,
|
||||||
|
eth_phy_addr: 0,
|
||||||
|
eth_clock_mode: 1,
|
||||||
|
platform: 'ESP32',
|
||||||
|
modbus_enabled: false,
|
||||||
|
modbus_port: 502,
|
||||||
|
modbus_max_clients: 10,
|
||||||
|
modbus_timeout: 10000,
|
||||||
|
developer_mode: true
|
||||||
|
};
|
||||||
|
|
||||||
// LOG
|
// LOG
|
||||||
const LOG_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'logSettings';
|
const LOG_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'logSettings';
|
||||||
let log_settings = {
|
let log_settings = {
|
||||||
level: 6,
|
level: 6,
|
||||||
max_messages: 50,
|
max_messages: 50,
|
||||||
compact: true,
|
compact: true,
|
||||||
psram: true
|
psram: true,
|
||||||
|
developer_mode: settings.developer_mode
|
||||||
};
|
};
|
||||||
|
|
||||||
// NTP
|
// NTP
|
||||||
@@ -478,9 +531,6 @@ const signin = admin_signin;
|
|||||||
|
|
||||||
const generate_token = { token: '1234' };
|
const generate_token = { token: '1234' };
|
||||||
|
|
||||||
//
|
|
||||||
// EMS-ESP Project specific
|
|
||||||
//
|
|
||||||
const EMSESP_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'settings';
|
const EMSESP_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'settings';
|
||||||
const EMSESP_CORE_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'coreData';
|
const EMSESP_CORE_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'coreData';
|
||||||
const EMSESP_SENSOR_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'sensorData';
|
const EMSESP_SENSOR_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'sensorData';
|
||||||
@@ -493,6 +543,7 @@ const EMSESP_DEVICEENTITIES_ENDPOINT2 = REST_ENDPOINT_ROOT + 'deviceEntities/:id
|
|||||||
const EMSESP_DASHBOARD_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'dashboardData';
|
const EMSESP_DASHBOARD_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'dashboardData';
|
||||||
|
|
||||||
const EMSESP_BOARDPROFILE_ENDPOINT = REST_ENDPOINT_ROOT + 'boardProfile';
|
const EMSESP_BOARDPROFILE_ENDPOINT = REST_ENDPOINT_ROOT + 'boardProfile';
|
||||||
|
|
||||||
const EMSESP_WRITE_DEVICEVALUE_ENDPOINT = REST_ENDPOINT_ROOT + 'writeDeviceValue';
|
const EMSESP_WRITE_DEVICEVALUE_ENDPOINT = REST_ENDPOINT_ROOT + 'writeDeviceValue';
|
||||||
const EMSESP_WRITE_DEVICENAME_ENDPOINT = REST_ENDPOINT_ROOT + 'writeDeviceName';
|
const EMSESP_WRITE_DEVICENAME_ENDPOINT = REST_ENDPOINT_ROOT + 'writeDeviceName';
|
||||||
const EMSESP_WRITE_TEMPSENSOR_ENDPOINT =
|
const EMSESP_WRITE_TEMPSENSOR_ENDPOINT =
|
||||||
@@ -502,10 +553,10 @@ const EMSESP_CUSTOMIZATION_ENTITIES_ENDPOINT =
|
|||||||
REST_ENDPOINT_ROOT + 'customizationEntities';
|
REST_ENDPOINT_ROOT + 'customizationEntities';
|
||||||
const EMSESP_RESET_CUSTOMIZATIONS_ENDPOINT =
|
const EMSESP_RESET_CUSTOMIZATIONS_ENDPOINT =
|
||||||
REST_ENDPOINT_ROOT + 'resetCustomizations';
|
REST_ENDPOINT_ROOT + 'resetCustomizations';
|
||||||
|
|
||||||
const EMSESP_SCHEDULE_ENDPOINT = REST_ENDPOINT_ROOT + 'schedule';
|
const EMSESP_SCHEDULE_ENDPOINT = REST_ENDPOINT_ROOT + 'schedule';
|
||||||
const EMSESP_CUSTOMENTITIES_ENDPOINT = REST_ENDPOINT_ROOT + 'customEntities';
|
const EMSESP_CUSTOMENTITIES_ENDPOINT = REST_ENDPOINT_ROOT + 'customEntities';
|
||||||
const EMSESP_MODULES_ENDPOINT = REST_ENDPOINT_ROOT + 'modules';
|
const EMSESP_MODULES_ENDPOINT = REST_ENDPOINT_ROOT + 'modules';
|
||||||
|
|
||||||
const EMSESP_ACTION_ENDPOINT = REST_ENDPOINT_ROOT + 'action';
|
const EMSESP_ACTION_ENDPOINT = REST_ENDPOINT_ROOT + 'action';
|
||||||
|
|
||||||
// these are used in the API calls only
|
// these are used in the API calls only
|
||||||
@@ -663,56 +714,6 @@ const emsesp_allvalues = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let settings = {
|
|
||||||
locale: 'en',
|
|
||||||
tx_mode: 1,
|
|
||||||
ems_bus_id: 11,
|
|
||||||
syslog_enabled: false,
|
|
||||||
syslog_level: 3,
|
|
||||||
trace_raw: false,
|
|
||||||
syslog_mark_interval: 0,
|
|
||||||
syslog_host: '192.168.1.8',
|
|
||||||
syslog_port: 514,
|
|
||||||
boiler_heatingoff: false,
|
|
||||||
remote_timeout: 24,
|
|
||||||
remote_timeout_en: false,
|
|
||||||
shower_timer: true,
|
|
||||||
shower_alert: false,
|
|
||||||
shower_alert_coldshot: 10,
|
|
||||||
shower_alert_trigger: 7,
|
|
||||||
shower_min_duration: 180,
|
|
||||||
rx_gpio: 4,
|
|
||||||
tx_gpio: 5,
|
|
||||||
dallas_gpio: 14,
|
|
||||||
dallas_parasite: false,
|
|
||||||
led_gpio: 2,
|
|
||||||
hide_led: true,
|
|
||||||
low_clock: false,
|
|
||||||
telnet_enabled: true,
|
|
||||||
notoken_api: false,
|
|
||||||
readonly_mode: false,
|
|
||||||
analog_enabled: true,
|
|
||||||
pbutton_gpio: 34,
|
|
||||||
solar_maxflow: 30,
|
|
||||||
board_profile: 'E32V2',
|
|
||||||
fahrenheit: false,
|
|
||||||
bool_format: 1,
|
|
||||||
bool_dashboard: 1,
|
|
||||||
enum_format: 1,
|
|
||||||
weblog_level: 6,
|
|
||||||
weblog_buffer: 50,
|
|
||||||
weblog_compact: true,
|
|
||||||
phy_type: 1,
|
|
||||||
eth_power: 15,
|
|
||||||
eth_phy_addr: 0,
|
|
||||||
eth_clock_mode: 1,
|
|
||||||
platform: 'ESP32',
|
|
||||||
modbus_enabled: false,
|
|
||||||
modbus_port: 502,
|
|
||||||
modbus_max_clients: 10,
|
|
||||||
modbus_timeout: 10000
|
|
||||||
};
|
|
||||||
|
|
||||||
const emsesp_coredata = {
|
const emsesp_coredata = {
|
||||||
connected: true,
|
connected: true,
|
||||||
// connected: false,
|
// connected: false,
|
||||||
@@ -4848,16 +4849,17 @@ router
|
|||||||
if (data.device === 'system') {
|
if (data.device === 'system') {
|
||||||
if (cmd === 'info') {
|
if (cmd === 'info') {
|
||||||
return emsesp_info;
|
return emsesp_info;
|
||||||
}
|
} else if (cmd === 'format') {
|
||||||
if (cmd === 'format') {
|
|
||||||
console.log('formatting...');
|
console.log('formatting...');
|
||||||
return status(200);
|
return status(200);
|
||||||
}
|
} else if (cmd === 'restart') {
|
||||||
if (cmd === 'restart') {
|
|
||||||
console.log('restarting...');
|
console.log('restarting...');
|
||||||
system_status.status = 'restarting';
|
system_status.status = 'restarting';
|
||||||
countHardwarePoll = 0;
|
countHardwarePoll = 0;
|
||||||
return status(200);
|
return status(200);
|
||||||
|
} else if (cmd === 'read') {
|
||||||
|
console.log('send read command:', data.data);
|
||||||
|
return status(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return status(404); // not found
|
return status(404); // not found
|
||||||
|
|||||||
@@ -379,30 +379,25 @@ static void setup_commands(std::shared_ptr<Commands> const & commands) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// read <deviceID> <type ID> [offset] [length]
|
||||||
commands->add_command(ShellContext::MAIN,
|
commands->add_command(ShellContext::MAIN,
|
||||||
CommandFlags::USER,
|
CommandFlags::USER,
|
||||||
{F_(read)},
|
{F_(read)},
|
||||||
string_vector{F_(deviceid_mandatory), F_(typeid_mandatory), F_(offset_optional), F_(length_optional)},
|
string_vector{F_(deviceid_mandatory), F_(typeid_mandatory), F_(offset_optional), F_(length_optional)},
|
||||||
[=](Shell & shell, const std::vector<std::string> & arguments) {
|
[=](Shell & shell, const std::vector<std::string> & arguments) {
|
||||||
uint8_t device_id = Helpers::hextoint(arguments.front().c_str());
|
// loop through arguments and add to data as text, separated by a space
|
||||||
|
std::string data;
|
||||||
|
for (const auto & arg : arguments) {
|
||||||
|
if (!data.empty()) {
|
||||||
|
data += " ";
|
||||||
|
}
|
||||||
|
data += arg;
|
||||||
|
}
|
||||||
|
|
||||||
if (!EMSESP::valid_device(device_id)) {
|
if (!System::readCommand(data.c_str())) {
|
||||||
shell.printfln("Invalid deviceID");
|
shell.printfln("Invalid deviceID");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t type_id = Helpers::hextoint(arguments[1].c_str());
|
|
||||||
if (arguments.size() == 4) {
|
|
||||||
uint16_t offset = Helpers::hextoint(arguments[2].c_str());
|
|
||||||
uint8_t length = Helpers::hextoint(arguments.back().c_str());
|
|
||||||
EMSESP::send_read_request(type_id, device_id, offset, length, true);
|
|
||||||
} else if (arguments.size() == 3) {
|
|
||||||
uint16_t offset = Helpers::hextoint(arguments.back().c_str());
|
|
||||||
EMSESP::send_read_request(type_id, device_id, offset, 0, true);
|
|
||||||
} else {
|
|
||||||
EMSESP::send_read_request(type_id, device_id, 0, 0, true);
|
|
||||||
}
|
|
||||||
EMSESP::set_read_id(type_id);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
commands->add_command(ShellContext::MAIN,
|
commands->add_command(ShellContext::MAIN,
|
||||||
|
|||||||
@@ -834,4 +834,14 @@ float Helpers::numericoperator2scalefactor(int8_t numeric_operator) {
|
|||||||
return -numeric_operator;
|
return -numeric_operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// convert the data into a vector of strings
|
||||||
|
void Helpers::splitArguments(const char * data, std::vector<std::string> & arguments) {
|
||||||
|
std::stringstream ss(data);
|
||||||
|
std::string item;
|
||||||
|
|
||||||
|
while (std::getline(ss, item, ' ')) {
|
||||||
|
arguments.push_back(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
@@ -19,8 +19,9 @@
|
|||||||
#ifndef EMSESP_HELPERS_H
|
#ifndef EMSESP_HELPERS_H
|
||||||
#define EMSESP_HELPERS_H
|
#define EMSESP_HELPERS_H
|
||||||
|
|
||||||
#include "telegram.h" // for EMS_VALUE_* settings
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "telegram.h" // for EMS_VALUE_* settings
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
namespace emsesp {
|
namespace emsesp {
|
||||||
@@ -82,6 +83,8 @@ class Helpers {
|
|||||||
|
|
||||||
static const char * translated_word(const char * const * strings, const bool force_en = false);
|
static const char * translated_word(const char * const * strings, const bool force_en = false);
|
||||||
|
|
||||||
|
static void splitArguments(const char * data, std::vector<std::string> & arguments);
|
||||||
|
|
||||||
#ifdef EMSESP_STANDALONE
|
#ifdef EMSESP_STANDALONE
|
||||||
static char * ultostr(char * ptr, uint32_t value, const uint8_t base);
|
static char * ultostr(char * ptr, uint32_t value, const uint8_t base);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ MAKE_WORD_TRANSLATION(info_cmd, "list all values (verbose)", "Liste aller Werte"
|
|||||||
MAKE_WORD_TRANSLATION(commands_cmd, "list all commands", "Liste aller Kommandos", "lijst van alle commando's", "", "wyświetl wszystkie komendy", "Viser alle kommandoer", "", "Tüm komutları listele", "elencaa tutti i comandi", "zobraziť všetky príkazy") // TODO translate
|
MAKE_WORD_TRANSLATION(commands_cmd, "list all commands", "Liste aller Kommandos", "lijst van alle commando's", "", "wyświetl wszystkie komendy", "Viser alle kommandoer", "", "Tüm komutları listele", "elencaa tutti i comandi", "zobraziť všetky príkazy") // TODO translate
|
||||||
MAKE_WORD_TRANSLATION(entities_cmd, "list all entities", "Liste aller Entitäten", "lijst van alle entiteiten", "", "wyświetl wszsytkie encje", "Viser alle enheter", "", "Tüm varlıkları listele", "elenca tutte le entità", "zobraziť všetky entity") // TODO translate
|
MAKE_WORD_TRANSLATION(entities_cmd, "list all entities", "Liste aller Entitäten", "lijst van alle entiteiten", "", "wyświetl wszsytkie encje", "Viser alle enheter", "", "Tüm varlıkları listele", "elenca tutte le entità", "zobraziť všetky entity") // TODO translate
|
||||||
MAKE_WORD_TRANSLATION(send_cmd, "send a telegram", "Sende EMS-Telegramm", "stuur een telegram", "", "wyślij telegram", "send et telegram", "", "Bir telegram gönder", "invia un telegramma", "poslať telegram") // TODO translate
|
MAKE_WORD_TRANSLATION(send_cmd, "send a telegram", "Sende EMS-Telegramm", "stuur een telegram", "", "wyślij telegram", "send et telegram", "", "Bir telegram gönder", "invia un telegramma", "poslať telegram") // TODO translate
|
||||||
|
MAKE_WORD_TRANSLATION(read_cmd, "send read request", "", "", "", "", "", "", "", "", "") // TODO translate
|
||||||
MAKE_WORD_TRANSLATION(setiovalue_cmd, "set I/O value", "Setze Werte E/A", "instellen standaardwaarde", "", "ustaw wartość", "sett en io verdi", "", "Giriş/Çıkış değerlerini ayarla", "imposta valore io", "nastaviť hodnotu io") // TODO translate
|
MAKE_WORD_TRANSLATION(setiovalue_cmd, "set I/O value", "Setze Werte E/A", "instellen standaardwaarde", "", "ustaw wartość", "sett en io verdi", "", "Giriş/Çıkış değerlerini ayarla", "imposta valore io", "nastaviť hodnotu io") // TODO translate
|
||||||
MAKE_WORD_TRANSLATION(changeloglevel_cmd, "change log level", "Ändere Protokollebene", "aanpassen log niveau", "", "zmień poziom log-u", "endre loggnivå", "", "Kayıt seviyesini değiştir", "cambia livello registrazione", "zmeniť úroveň protokolu") // TODO translate
|
MAKE_WORD_TRANSLATION(changeloglevel_cmd, "change log level", "Ändere Protokollebene", "aanpassen log niveau", "", "zmień poziom log-u", "endre loggnivå", "", "Kayıt seviyesini değiştir", "cambia livello registrazione", "zmeniť úroveň protokolu") // TODO translate
|
||||||
MAKE_WORD_TRANSLATION(fetch_cmd, "refresh all EMS values", "Aktualisiere alle EMS-Werte", "Verversen alle EMS waardes", "", "odśwież wszystkie wartości EMS", "oppfrisk alle EMS verdier", "", "Bütün EMS değerlerini yenile", "aggiornare tutti i valori EMS", "obnoviť všetky hodnoty EMS") // TODO translate
|
MAKE_WORD_TRANSLATION(fetch_cmd, "refresh all EMS values", "Aktualisiere alle EMS-Werte", "Verversen alle EMS waardes", "", "odśwież wszystkie wartości EMS", "oppfrisk alle EMS verdier", "", "Bütün EMS değerlerini yenile", "aggiornare tutti i valori EMS", "obnoviť všetky hodnoty EMS") // TODO translate
|
||||||
|
|||||||
@@ -409,7 +409,8 @@ void System::reload_settings() {
|
|||||||
eth_phy_addr_ = settings.eth_phy_addr;
|
eth_phy_addr_ = settings.eth_phy_addr;
|
||||||
eth_clock_mode_ = settings.eth_clock_mode;
|
eth_clock_mode_ = settings.eth_clock_mode;
|
||||||
|
|
||||||
locale_ = settings.locale;
|
locale_ = settings.locale;
|
||||||
|
developer_mode_ = settings.developer_mode;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -851,6 +852,7 @@ void System::system_check() {
|
|||||||
// commands - takes static function pointers
|
// commands - takes static function pointers
|
||||||
// can be called via Console using 'call system <cmd>'
|
// can be called via Console using 'call system <cmd>'
|
||||||
void System::commands_init() {
|
void System::commands_init() {
|
||||||
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(read), System::command_read, FL_(read_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, FL_(send_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(send), System::command_send, FL_(send_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, FL_(fetch_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(fetch), System::command_fetch, FL_(fetch_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, FL_(restart_cmd), CommandFlag::ADMIN_ONLY);
|
Command::add(EMSdevice::DeviceType::SYSTEM, F_(restart), System::command_restart, FL_(restart_cmd), CommandFlag::ADMIN_ONLY);
|
||||||
@@ -1689,6 +1691,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
|
|||||||
#endif
|
#endif
|
||||||
node["modbusEnabled"] = settings.modbus_enabled;
|
node["modbusEnabled"] = settings.modbus_enabled;
|
||||||
node["forceHeatingOff"] = settings.boiler_heatingoff;
|
node["forceHeatingOff"] = settings.boiler_heatingoff;
|
||||||
|
node["developerMode"] = settings.developer_mode;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Devices - show EMS devices if we have any
|
// Devices - show EMS devices if we have any
|
||||||
@@ -2012,4 +2015,45 @@ bool System::uploadFirmwareURL(const char * url) {
|
|||||||
return true; // OK
|
return true; // OK
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read command, e.g. read <deviceID> <type ID> [offset] [length] from console
|
||||||
|
// or a call system read <deviceID> <type ID> [offset] [length] from the API
|
||||||
|
bool System::readCommand(const char * data) {
|
||||||
|
// convert the data into a vector of strings
|
||||||
|
std::vector<std::string> arguments = {};
|
||||||
|
Helpers::splitArguments(data, arguments);
|
||||||
|
|
||||||
|
auto num_args = arguments.size();
|
||||||
|
|
||||||
|
if (num_args > 4 || num_args == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t device_id = Helpers::hextoint(arguments[0].c_str());
|
||||||
|
if (!EMSESP::valid_device(device_id)) {
|
||||||
|
LOG_ERROR("Invalid device ID for read command");
|
||||||
|
return false; // invalid device
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t type_id = Helpers::hextoint(arguments[1].c_str());
|
||||||
|
uint8_t length = 0;
|
||||||
|
uint16_t offset = 0;
|
||||||
|
|
||||||
|
if (num_args == 4) {
|
||||||
|
offset = Helpers::hextoint(arguments[2].c_str());
|
||||||
|
length = Helpers::hextoint(arguments[3].c_str());
|
||||||
|
} else if (num_args == 3) {
|
||||||
|
offset = Helpers::hextoint(arguments.back().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
EMSESP::send_read_request(type_id, device_id, offset, length, true);
|
||||||
|
EMSESP::set_read_id(type_id);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// system read command
|
||||||
|
bool System::command_read(const char * value, const int8_t id) {
|
||||||
|
return readCommand(value);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace emsesp
|
} // namespace emsesp
|
||||||
|
|||||||
12
src/system.h
12
src/system.h
@@ -63,6 +63,7 @@ class System {
|
|||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
|
static bool command_read(const char * value, const int8_t id);
|
||||||
static bool command_send(const char * value, const int8_t id);
|
static bool command_send(const char * value, const int8_t id);
|
||||||
static bool command_publish(const char * value, const int8_t id);
|
static bool command_publish(const char * value, const int8_t id);
|
||||||
static bool command_fetch(const char * value, const int8_t id);
|
static bool command_fetch(const char * value, const int8_t id);
|
||||||
@@ -124,6 +125,8 @@ class System {
|
|||||||
static bool is_valid_gpio(uint8_t pin, bool has_psram = false);
|
static bool is_valid_gpio(uint8_t pin, bool has_psram = false);
|
||||||
static bool load_board_profile(std::vector<int8_t> & data, const std::string & board_profile);
|
static bool load_board_profile(std::vector<int8_t> & data, const std::string & board_profile);
|
||||||
|
|
||||||
|
static bool readCommand(const char * data);
|
||||||
|
|
||||||
static void restart_requested(bool restart_requested) {
|
static void restart_requested(bool restart_requested) {
|
||||||
restart_requested_ = restart_requested;
|
restart_requested_ = restart_requested;
|
||||||
}
|
}
|
||||||
@@ -170,6 +173,14 @@ class System {
|
|||||||
readonly_mode_ = readonly_mode;
|
readonly_mode_ = readonly_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool developer_mode() {
|
||||||
|
return developer_mode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void developer_mode(bool developer_mode) {
|
||||||
|
developer_mode_ = developer_mode;
|
||||||
|
}
|
||||||
|
|
||||||
// Boolean Format API/MQTT
|
// Boolean Format API/MQTT
|
||||||
uint8_t bool_format() {
|
uint8_t bool_format() {
|
||||||
return bool_format_;
|
return bool_format_;
|
||||||
@@ -398,6 +409,7 @@ class System {
|
|||||||
uint16_t modbus_port_;
|
uint16_t modbus_port_;
|
||||||
uint8_t modbus_max_clients_;
|
uint8_t modbus_max_clients_;
|
||||||
uint32_t modbus_timeout_;
|
uint32_t modbus_timeout_;
|
||||||
|
bool developer_mode_;
|
||||||
|
|
||||||
// ethernet
|
// ethernet
|
||||||
uint8_t phy_type_;
|
uint8_t phy_type_;
|
||||||
|
|||||||
@@ -973,16 +973,16 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
|||||||
if (single) {
|
if (single) {
|
||||||
// run dedicated tests only
|
// run dedicated tests only
|
||||||
|
|
||||||
EMSESP::webCustomEntityService.test(); // custom entities
|
// EMSESP::webCustomEntityService.test(); // custom entities
|
||||||
EMSESP::webCustomizationService.test(); // set customizations - this will overwrite any settings in the FS
|
// EMSESP::webCustomizationService.test(); // set customizations - this will overwrite any settings in the FS
|
||||||
EMSESP::temperaturesensor_.test(); // add temperature sensors
|
// EMSESP::temperaturesensor_.test(); // add temperature sensors
|
||||||
EMSESP::webSchedulerService.test(); // run scheduler tests, and conditions
|
// EMSESP::webSchedulerService.test(); // run scheduler tests, and conditions
|
||||||
|
|
||||||
// request.url("/rest/deviceEntities");
|
// request.url("/rest/deviceEntities");
|
||||||
// EMSESP::webCustomizationService.device_entities(&request);
|
// EMSESP::webCustomizationService.device_entities(&request);
|
||||||
|
|
||||||
request.url("/rest/dashboardData");
|
// request.url("/rest/dashboardData");
|
||||||
EMSESP::webDataService.dashboard_data(&request);
|
// EMSESP::webDataService.dashboard_data(&request);
|
||||||
|
|
||||||
// COMMANDS
|
// COMMANDS
|
||||||
// shell.invoke_command("call system fetch");
|
// shell.invoke_command("call system fetch");
|
||||||
@@ -999,7 +999,7 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
|||||||
// EMSESP::webAPIService.webAPIService(&request);
|
// EMSESP::webAPIService.webAPIService(&request);
|
||||||
|
|
||||||
// POST COMMANDS
|
// POST COMMANDS
|
||||||
// request.method(HTTP_POST);
|
request.method(HTTP_POST);
|
||||||
|
|
||||||
// char data1[] = "{\"device\":\"system\", \"cmd\":\"restart\",\"id\":-1}";
|
// char data1[] = "{\"device\":\"system\", \"cmd\":\"restart\",\"id\":-1}";
|
||||||
// deserializeJson(doc, data1);
|
// deserializeJson(doc, data1);
|
||||||
@@ -1021,6 +1021,14 @@ void Test::run_test(uuid::console::Shell & shell, const std::string & cmd, const
|
|||||||
// request.url("/rest/action");
|
// request.url("/rest/action");
|
||||||
// EMSESP::webStatusService.action(&request, doc.as<JsonVariant>());
|
// EMSESP::webStatusService.action(&request, doc.as<JsonVariant>());
|
||||||
|
|
||||||
|
char data6[] = "{\"device\":\"system\", \"cmd\":\"read\",\"value\":\"8 2 27 1\"}";
|
||||||
|
deserializeJson(doc, data6);
|
||||||
|
json = doc.as<JsonVariant>();
|
||||||
|
request.url("/api");
|
||||||
|
EMSESP::webAPIService.webAPIService(&request, json);
|
||||||
|
|
||||||
|
shell.invoke_command("call system read \"8 2 27 1\"");
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
EMSESP::webCustomEntityService.test(); // custom entities
|
EMSESP::webCustomEntityService.test(); // custom entities
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define EMSESP_APP_VERSION "3.7.0-dev.46"
|
#define EMSESP_APP_VERSION "3.7.0-dev.47"
|
||||||
@@ -28,8 +28,9 @@ WebAPIService::WebAPIService(AsyncWebServer * server, SecurityManager * security
|
|||||||
server->on(EMSESP_API_SERVICE_PATH, [this](AsyncWebServerRequest * request, JsonVariant json) { webAPIService(request, json); });
|
server->on(EMSESP_API_SERVICE_PATH, [this](AsyncWebServerRequest * request, JsonVariant json) { webAPIService(request, json); });
|
||||||
}
|
}
|
||||||
|
|
||||||
// POST|GET /{device}
|
// POST|GET api/
|
||||||
// POST|GET /{device}/{entity}
|
// POST|GET api/{device}
|
||||||
|
// POST|GET api/{device}/{entity}
|
||||||
void WebAPIService::webAPIService(AsyncWebServerRequest * request, JsonVariant json) {
|
void WebAPIService::webAPIService(AsyncWebServerRequest * request, JsonVariant json) {
|
||||||
JsonObject input;
|
JsonObject input;
|
||||||
// if no body then treat it as a secure GET
|
// if no body then treat it as a secure GET
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ void WebSettings::read(WebSettings & settings, JsonObject root) {
|
|||||||
root["modbus_port"] = settings.modbus_port;
|
root["modbus_port"] = settings.modbus_port;
|
||||||
root["modbus_max_clients"] = settings.modbus_max_clients;
|
root["modbus_max_clients"] = settings.modbus_max_clients;
|
||||||
root["modbus_timeout"] = settings.modbus_timeout;
|
root["modbus_timeout"] = settings.modbus_timeout;
|
||||||
|
root["developer_mode"] = settings.developer_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// call on initialization and also when settings are updated via web or console
|
// call on initialization and also when settings are updated via web or console
|
||||||
@@ -358,9 +359,12 @@ StateUpdateResult WebSettings::update(JsonObject root, WebSettings & settings) {
|
|||||||
settings.fahrenheit = root["fahrenheit"];
|
settings.fahrenheit = root["fahrenheit"];
|
||||||
EMSESP::system_.fahrenheit(settings.fahrenheit);
|
EMSESP::system_.fahrenheit(settings.fahrenheit);
|
||||||
|
|
||||||
settings.readonly_mode = root["readonly_mode"];
|
settings.readonly_mode = root["readonly_mode"] | false;
|
||||||
EMSESP::system_.readonly_mode(settings.readonly_mode);
|
EMSESP::system_.readonly_mode(settings.readonly_mode);
|
||||||
|
|
||||||
|
settings.developer_mode = root["developer_mode"] | false;
|
||||||
|
EMSESP::system_.developer_mode(settings.developer_mode);
|
||||||
|
|
||||||
settings.bool_dashboard = root["bool_dashboard"] | EMSESP_DEFAULT_BOOL_FORMAT;
|
settings.bool_dashboard = root["bool_dashboard"] | EMSESP_DEFAULT_BOOL_FORMAT;
|
||||||
EMSESP::system_.bool_dashboard(settings.bool_dashboard);
|
EMSESP::system_.bool_dashboard(settings.bool_dashboard);
|
||||||
|
|
||||||
|
|||||||
@@ -65,10 +65,13 @@ class WebSettings {
|
|||||||
uint8_t bool_format;
|
uint8_t bool_format;
|
||||||
uint8_t bool_dashboard;
|
uint8_t bool_dashboard;
|
||||||
uint8_t enum_format;
|
uint8_t enum_format;
|
||||||
int8_t weblog_level;
|
|
||||||
uint8_t weblog_buffer;
|
int8_t weblog_level;
|
||||||
bool weblog_compact;
|
uint8_t weblog_buffer;
|
||||||
bool fahrenheit;
|
bool weblog_compact;
|
||||||
|
|
||||||
|
bool fahrenheit;
|
||||||
|
|
||||||
bool modbus_enabled;
|
bool modbus_enabled;
|
||||||
uint16_t modbus_port;
|
uint16_t modbus_port;
|
||||||
uint8_t modbus_max_clients;
|
uint8_t modbus_max_clients;
|
||||||
@@ -79,6 +82,8 @@ class WebSettings {
|
|||||||
uint8_t eth_phy_addr;
|
uint8_t eth_phy_addr;
|
||||||
uint8_t eth_clock_mode;
|
uint8_t eth_clock_mode;
|
||||||
|
|
||||||
|
bool developer_mode; // developer mode
|
||||||
|
|
||||||
static void read(WebSettings & settings, JsonObject root);
|
static void read(WebSettings & settings, JsonObject root);
|
||||||
static StateUpdateResult update(JsonObject root, WebSettings & settings);
|
static StateUpdateResult update(JsonObject root, WebSettings & settings);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user