mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-14 03:46:49 +03:00
first try
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { memo, useContext } from 'react';
|
||||
import { Navigate, Route, Routes } from 'react-router';
|
||||
|
||||
import Commands from 'app/main/Commands';
|
||||
import CustomEntities from 'app/main/CustomEntities';
|
||||
import Customizations from 'app/main/Customizations';
|
||||
import Dashboard from 'app/main/Dashboard';
|
||||
@@ -65,6 +66,7 @@ const AuthenticatedRouting = memo(() => {
|
||||
<Route path="/settings/security/*" element={<Security />} />
|
||||
|
||||
<Route path="/customizations" element={<Customizations />} />
|
||||
<Route path="/commands" element={<Commands />} />
|
||||
<Route path="/scheduler" element={<Scheduler />} />
|
||||
<Route path="/customentities" element={<CustomEntities />} />
|
||||
</>
|
||||
|
||||
@@ -4,6 +4,8 @@ import type {
|
||||
APIcall,
|
||||
Action,
|
||||
Activity,
|
||||
CommandItem,
|
||||
Commands,
|
||||
CoreData,
|
||||
DashboardData,
|
||||
DeviceData,
|
||||
@@ -102,8 +104,7 @@ export const readSchedule = () =>
|
||||
o_deleted: si.deleted,
|
||||
o_flags: si.flags,
|
||||
o_time: si.time,
|
||||
o_cmd: si.cmd,
|
||||
o_value: si.value,
|
||||
o_cmd_name: si.cmd_name,
|
||||
o_name: si.name
|
||||
}));
|
||||
}
|
||||
@@ -111,6 +112,24 @@ export const readSchedule = () =>
|
||||
export const writeSchedule = (data: Schedule) =>
|
||||
alovaInstance.Post('/rest/schedule', data);
|
||||
|
||||
// Commands
|
||||
export const readCommands = () =>
|
||||
alovaInstance.Get<CommandItem[]>('/rest/commands', {
|
||||
// @ts-expect-error - exactOptionalPropertyTypes compatibility issue
|
||||
transform(data) {
|
||||
const commands = (data as Commands).commands;
|
||||
return commands.map((ci) => ({
|
||||
...ci,
|
||||
o_id: ci.id,
|
||||
o_cmd: ci.cmd,
|
||||
o_value: ci.value,
|
||||
o_name: ci.name
|
||||
}));
|
||||
}
|
||||
});
|
||||
export const writeCommands = (data: Commands) =>
|
||||
alovaInstance.Post('/rest/commands', data);
|
||||
|
||||
// Modules
|
||||
export const readModules = () =>
|
||||
alovaInstance.Get<ModuleItem[]>('/rest/modules', {
|
||||
|
||||
284
interface/src/app/main/Commands.tsx
Normal file
284
interface/src/app/main/Commands.tsx
Normal file
@@ -0,0 +1,284 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useBlocker } from 'react-router';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import WarningIcon from '@mui/icons-material/Warning';
|
||||
import { Box, Button, Typography } from '@mui/material';
|
||||
|
||||
import {
|
||||
Body,
|
||||
Cell,
|
||||
Header,
|
||||
HeaderCell,
|
||||
HeaderRow,
|
||||
Row,
|
||||
Table
|
||||
} from '@table-library/react-table-library/table';
|
||||
import { useTheme } from '@table-library/react-table-library/theme';
|
||||
import { updateState, useRequest } from 'alova/client';
|
||||
import {
|
||||
BlockNavigation,
|
||||
ButtonRow,
|
||||
FormLoader,
|
||||
SectionContent,
|
||||
useLayoutTitle
|
||||
} from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
import { useInterval } from 'utils';
|
||||
|
||||
import { readCommands, writeCommands } from '../../api/app';
|
||||
import CommandsDialog from './CommandsDialog';
|
||||
import type { CommandItem, Commands as CommandsType } from './types';
|
||||
import { commandItemValidation } from './validators';
|
||||
|
||||
const INTERVAL_DELAY = 30000;
|
||||
const MIN_ID = -100;
|
||||
const MAX_ID = 100;
|
||||
|
||||
const DEFAULT_COMMAND_ITEM: Omit<CommandItem, 'id'> = {
|
||||
cmd: '',
|
||||
value: '',
|
||||
name: '',
|
||||
deleted: false
|
||||
};
|
||||
|
||||
const commandsTheme = {
|
||||
Table: `
|
||||
--data-table-library_grid-template-columns: repeat(1, minmax(100px, 1fr)) repeat(1, minmax(100px, 1fr)) 160px;
|
||||
`,
|
||||
BaseRow: `
|
||||
font-size: 14px;
|
||||
.td {
|
||||
height: 32px;
|
||||
}
|
||||
`,
|
||||
BaseCell: `
|
||||
&:nth-of-type(1) {
|
||||
padding: 8px;
|
||||
}
|
||||
`,
|
||||
HeaderRow: `
|
||||
text-transform: uppercase;
|
||||
background-color: black;
|
||||
color: #90CAF9;
|
||||
.th {
|
||||
border-bottom: 1px solid #565656;
|
||||
height: 36px;
|
||||
}
|
||||
`,
|
||||
Row: `
|
||||
background-color: #1e1e1e;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
.td {
|
||||
border-bottom: 1px solid #565656;
|
||||
}
|
||||
&:hover .td {
|
||||
background-color: #177ac9;
|
||||
}
|
||||
`
|
||||
};
|
||||
|
||||
const CommandsPage = () => {
|
||||
const { LL } = useI18nContext();
|
||||
const [numChanges, setNumChanges] = useState<number>(0);
|
||||
const blocker = useBlocker(numChanges !== 0);
|
||||
const [selectedItem, setSelectedItem] = useState<CommandItem>();
|
||||
const [creating, setCreating] = useState<boolean>(false);
|
||||
const [dialogOpen, setDialogOpen] = useState<boolean>(false);
|
||||
|
||||
useLayoutTitle(LL.COMMANDS());
|
||||
|
||||
const {
|
||||
data: commands,
|
||||
send: fetchCommands,
|
||||
error
|
||||
} = useRequest(readCommands, {
|
||||
initialData: []
|
||||
});
|
||||
|
||||
const { send: updateCommands } = useRequest(
|
||||
(data: CommandsType) => writeCommands(data),
|
||||
{ immediate: false }
|
||||
);
|
||||
|
||||
const hasChanged = (ci: CommandItem) =>
|
||||
ci.id !== ci.o_id ||
|
||||
(ci.name || '') !== (ci.o_name || '') ||
|
||||
ci.cmd !== ci.o_cmd ||
|
||||
ci.value !== ci.o_value ||
|
||||
ci.deleted !== ci.o_deleted;
|
||||
|
||||
useInterval(() => {
|
||||
if (numChanges === 0) {
|
||||
void fetchCommands();
|
||||
}
|
||||
}, INTERVAL_DELAY);
|
||||
|
||||
const theme = useTheme(commandsTheme);
|
||||
|
||||
const saveCommands = async () => {
|
||||
try {
|
||||
await updateCommands({
|
||||
commands: commands
|
||||
.filter((ci: CommandItem) => !ci.deleted)
|
||||
.map((ci: CommandItem) => ({
|
||||
id: ci.id,
|
||||
cmd: ci.cmd,
|
||||
value: ci.value,
|
||||
name: ci.name
|
||||
}))
|
||||
});
|
||||
toast.success(LL.UPDATED_OF(LL.COMMANDS(1)));
|
||||
} catch (error: unknown) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
toast.error(message);
|
||||
} finally {
|
||||
await fetchCommands();
|
||||
setNumChanges(0);
|
||||
}
|
||||
};
|
||||
|
||||
const editItem = (ci: CommandItem) => {
|
||||
setCreating(false);
|
||||
setSelectedItem(ci);
|
||||
setDialogOpen(true);
|
||||
if (ci.o_name === undefined) {
|
||||
ci.o_name = ci.name;
|
||||
}
|
||||
};
|
||||
|
||||
const onDialogClose = () => {
|
||||
setDialogOpen(false);
|
||||
};
|
||||
|
||||
const onDialogCancel = async () => {
|
||||
await fetchCommands().then(() => {
|
||||
setNumChanges(0);
|
||||
});
|
||||
};
|
||||
|
||||
const onDialogSave = (updatedItem: CommandItem) => {
|
||||
setDialogOpen(false);
|
||||
void updateState(readCommands(), (data: CommandItem[]) => {
|
||||
const new_data = creating
|
||||
? [...data, updatedItem]
|
||||
: data.map((ci) =>
|
||||
ci.id === updatedItem.id ? { ...ci, ...updatedItem } : ci
|
||||
);
|
||||
setNumChanges(new_data.filter((ci) => hasChanged(ci)).length);
|
||||
return new_data;
|
||||
});
|
||||
};
|
||||
|
||||
const addItem = () => {
|
||||
setCreating(true);
|
||||
const newItem: CommandItem = {
|
||||
id: Math.floor(Math.random() * (MAX_ID - MIN_ID) + MIN_ID),
|
||||
...DEFAULT_COMMAND_ITEM
|
||||
};
|
||||
setSelectedItem(newItem);
|
||||
setDialogOpen(true);
|
||||
};
|
||||
|
||||
const filteredCommands = commands.filter((ci: CommandItem) => !ci.deleted);
|
||||
|
||||
const renderCommands = () => {
|
||||
if (!commands) {
|
||||
return (
|
||||
<FormLoader onRetry={fetchCommands} errorMessage={error?.message || ''} />
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Table
|
||||
data={{ nodes: filteredCommands }}
|
||||
theme={theme}
|
||||
layout={{ custom: true }}
|
||||
>
|
||||
{(tableList: CommandItem[]) => (
|
||||
<>
|
||||
<Header>
|
||||
<HeaderRow>
|
||||
<HeaderCell stiff>{LL.COMMAND(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.NAME(0)}</HeaderCell>
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
<Body>
|
||||
{tableList.map((ci: CommandItem) => (
|
||||
<Row key={ci.id} item={ci} onClick={() => editItem(ci)}>
|
||||
<Cell>{ci.cmd}</Cell>
|
||||
<Cell>{ci.value}</Cell>
|
||||
<Cell>{ci.name}</Cell>
|
||||
</Row>
|
||||
))}
|
||||
</Body>
|
||||
</>
|
||||
)}
|
||||
</Table>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<SectionContent>
|
||||
{blocker ? <BlockNavigation blocker={blocker} /> : null}
|
||||
<Typography sx={{ mb: 2 }} color="warning" variant="body1">
|
||||
{LL.COMMANDS_HELP_1()}.
|
||||
</Typography>
|
||||
{renderCommands()}
|
||||
|
||||
{selectedItem && (
|
||||
<CommandsDialog
|
||||
open={dialogOpen}
|
||||
creating={creating}
|
||||
onClose={onDialogClose}
|
||||
onSave={onDialogSave}
|
||||
selectedItem={selectedItem}
|
||||
validator={commandItemValidation(commands, selectedItem)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Box sx={{ display: 'flex', flexWrap: 'wrap' }}>
|
||||
<Box sx={{ flexGrow: 1 }}>
|
||||
{numChanges !== 0 && (
|
||||
<ButtonRow>
|
||||
<Button
|
||||
startIcon={<CancelIcon />}
|
||||
variant="outlined"
|
||||
onClick={onDialogCancel}
|
||||
color="secondary"
|
||||
>
|
||||
{LL.CANCEL()}
|
||||
</Button>
|
||||
<Button
|
||||
startIcon={<WarningIcon color="warning" />}
|
||||
variant="contained"
|
||||
color="info"
|
||||
onClick={saveCommands}
|
||||
>
|
||||
{LL.APPLY_CHANGES(numChanges)}
|
||||
</Button>
|
||||
</ButtonRow>
|
||||
)}
|
||||
</Box>
|
||||
<Box sx={{ flexWrap: 'nowrap', whiteSpace: 'nowrap' }}>
|
||||
<ButtonRow>
|
||||
<Button
|
||||
startIcon={<AddIcon />}
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
onClick={addItem}
|
||||
>
|
||||
{LL.ADD(0)}
|
||||
</Button>
|
||||
</ButtonRow>
|
||||
</Box>
|
||||
</Box>
|
||||
</SectionContent>
|
||||
);
|
||||
};
|
||||
|
||||
export default CommandsPage;
|
||||
188
interface/src/app/main/CommandsDialog.tsx
Normal file
188
interface/src/app/main/CommandsDialog.tsx
Normal file
@@ -0,0 +1,188 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import DoneIcon from '@mui/icons-material/Done';
|
||||
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
||||
import RemoveIcon from '@mui/icons-material/RemoveCircleOutlined';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
TextField
|
||||
} from '@mui/material';
|
||||
|
||||
import { callAction } from '@/api/app';
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { useRequest } from 'alova/client';
|
||||
import type Schema from 'async-validator';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
import { ValidatedTextField } from 'components';
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
import { updateValue } from 'utils';
|
||||
import { ValidationError, validate } from 'validators';
|
||||
|
||||
import type { CommandItem } from './types';
|
||||
|
||||
interface CommandsDialogProps {
|
||||
open: boolean;
|
||||
creating: boolean;
|
||||
onClose: () => void;
|
||||
onSave: (ci: CommandItem) => void;
|
||||
selectedItem: CommandItem;
|
||||
validator: Schema;
|
||||
}
|
||||
|
||||
const CommandsDialog = ({
|
||||
open,
|
||||
creating,
|
||||
onClose,
|
||||
onSave,
|
||||
selectedItem,
|
||||
validator
|
||||
}: CommandsDialogProps) => {
|
||||
const { LL } = useI18nContext();
|
||||
const [editItem, setEditItem] = useState<CommandItem>(selectedItem);
|
||||
const [fieldErrors, setFieldErrors] = useState<ValidateFieldsError>();
|
||||
|
||||
const updateFormValue = updateValue(
|
||||
setEditItem as unknown as React.Dispatch<
|
||||
React.SetStateAction<Record<string, unknown>>
|
||||
>
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (open) {
|
||||
setFieldErrors(undefined);
|
||||
setEditItem(selectedItem);
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const handleSave = async (itemToSave: CommandItem) => {
|
||||
try {
|
||||
setFieldErrors(undefined);
|
||||
await validate(validator, itemToSave);
|
||||
onSave(itemToSave);
|
||||
} catch (error) {
|
||||
setFieldErrors((error as ValidationError).fieldErrors);
|
||||
}
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
await handleSave(editItem);
|
||||
};
|
||||
|
||||
const { send: executeCommand } = useRequest(
|
||||
(id: string) => callAction({ action: 'executeCommand', param: id }),
|
||||
{ immediate: false }
|
||||
)
|
||||
.onSuccess(() => {
|
||||
toast.success(LL.EXECUTE_COMMAND_SENT());
|
||||
})
|
||||
.onError((error) => {
|
||||
toast.error(String(error.error?.message || 'An error occurred'));
|
||||
});
|
||||
|
||||
const execute = async () => {
|
||||
await executeCommand(editItem.name);
|
||||
};
|
||||
|
||||
const remove = () => {
|
||||
onSave({ ...editItem, deleted: true });
|
||||
};
|
||||
|
||||
const handleClose = (
|
||||
_event: React.SyntheticEvent,
|
||||
reason: 'backdropClick' | 'escapeKeyDown'
|
||||
) => {
|
||||
if (reason !== 'backdropClick') {
|
||||
onClose();
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog sx={dialogStyle} open={open} onClose={handleClose}>
|
||||
<DialogTitle>
|
||||
{creating ? `${LL.ADD(1)} ${LL.NEW(0)}` : LL.EDIT()}
|
||||
{LL.COMMAND(1)}
|
||||
</DialogTitle>
|
||||
<DialogContent dividers>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors || {}}
|
||||
name="cmd"
|
||||
label={LL.COMMAND(0)}
|
||||
multiline
|
||||
fullWidth
|
||||
value={editItem.cmd}
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
<TextField
|
||||
name="value"
|
||||
label={LL.VALUE(0)}
|
||||
multiline
|
||||
margin="normal"
|
||||
fullWidth
|
||||
value={editItem.value}
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors || {}}
|
||||
name="name"
|
||||
label={LL.NAME(0)}
|
||||
value={editItem.name}
|
||||
fullWidth
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
</DialogContent>
|
||||
|
||||
<DialogActions>
|
||||
{!creating && (
|
||||
<Box sx={{ flexGrow: 1 }}>
|
||||
<Button
|
||||
startIcon={<RemoveIcon />}
|
||||
variant="outlined"
|
||||
color="warning"
|
||||
onClick={remove}
|
||||
>
|
||||
{LL.REMOVE()}
|
||||
</Button>
|
||||
</Box>
|
||||
)}
|
||||
<Button
|
||||
startIcon={<CancelIcon />}
|
||||
variant="outlined"
|
||||
onClick={onClose}
|
||||
color="secondary"
|
||||
>
|
||||
{LL.CANCEL()}
|
||||
</Button>
|
||||
<Button
|
||||
startIcon={creating ? <AddIcon /> : <DoneIcon />}
|
||||
variant="outlined"
|
||||
onClick={save}
|
||||
color="primary"
|
||||
>
|
||||
{creating ? LL.ADD(0) : LL.UPDATE()}
|
||||
</Button>
|
||||
{!creating && editItem.cmd !== '' && (
|
||||
<Button
|
||||
startIcon={<PlayArrowIcon />}
|
||||
variant="outlined"
|
||||
onClick={execute}
|
||||
color="success"
|
||||
>
|
||||
{LL.EXECUTE()}
|
||||
</Button>
|
||||
)}
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default CommandsDialog;
|
||||
@@ -180,6 +180,8 @@ const Dashboard = memo(() => {
|
||||
return LL.ANALOG_SENSORS();
|
||||
case DeviceType.TEMPERATURESENSOR:
|
||||
return LL.TEMP_SENSORS();
|
||||
case DeviceType.COMMAND:
|
||||
return LL.COMMANDS();
|
||||
case DeviceType.SCHEDULER:
|
||||
return LL.SCHEDULER();
|
||||
default:
|
||||
|
||||
@@ -38,6 +38,7 @@ const deviceIconLookup: Record<DeviceType, IconType | null> = {
|
||||
[DeviceType.CUSTOM]: MdPlaylistAdd,
|
||||
[DeviceType.UNKNOWN]: MdOutlineSensors,
|
||||
[DeviceType.SYSTEM]: null,
|
||||
[DeviceType.COMMAND]: MdPlaylistAdd,
|
||||
[DeviceType.SCHEDULER]: MdMoreTime,
|
||||
[DeviceType.GENERIC]: MdOutlineSensors,
|
||||
[DeviceType.VENTILATION]: PiFan
|
||||
|
||||
@@ -64,12 +64,12 @@ const DevicesDialog = ({
|
||||
}
|
||||
}, [open, selectedItem]);
|
||||
|
||||
const { send: executeSchedule } = useRequest(
|
||||
(id: string) => callAction({ action: 'executeSchedule', param: id }),
|
||||
const { send: executeCommand } = useRequest(
|
||||
(id: string) => callAction({ action: 'executeCommand', param: id }),
|
||||
{ immediate: false }
|
||||
)
|
||||
.onSuccess(() => {
|
||||
toast.success(LL.EXECUTE_SCHEDULE_SENT());
|
||||
toast.success(LL.EXECUTE_COMMAND_SENT());
|
||||
})
|
||||
.onError((error) => {
|
||||
toast.error(String(error.error?.message || 'An error occurred'));
|
||||
@@ -79,7 +79,7 @@ const DevicesDialog = ({
|
||||
try {
|
||||
setFieldErrors(undefined);
|
||||
if (editItem.v === undefined && editItem.c !== undefined) {
|
||||
await executeSchedule(editItem.c);
|
||||
await executeCommand(editItem.c);
|
||||
} else {
|
||||
await validate(validator, editItem);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
import { useI18nContext } from 'i18n/i18n-react';
|
||||
import { useInterval } from 'utils';
|
||||
|
||||
import { readSchedule, writeSchedule } from '../../api/app';
|
||||
import { readCommands, readSchedule, writeSchedule } from '../../api/app';
|
||||
import SettingsSchedulerDialog from './SchedulerDialog';
|
||||
import { ScheduleFlag } from './types';
|
||||
import type { Schedule, ScheduleItem } from './types';
|
||||
@@ -54,14 +54,13 @@ const DEFAULT_SCHEDULE_ITEM: Omit<ScheduleItem, 'id' | 'o_id'> = {
|
||||
deleted: false,
|
||||
flags: FLAG_ALL_DAYS,
|
||||
time: '',
|
||||
cmd: '',
|
||||
value: '',
|
||||
cmd_name: '',
|
||||
name: ''
|
||||
};
|
||||
|
||||
const scheduleTheme = {
|
||||
Table: `
|
||||
--data-table-library_grid-template-columns: 36px 210px 100px 192px repeat(1, minmax(100px, 1fr)) 160px;
|
||||
--data-table-library_grid-template-columns: 36px 220px repeat(1, minmax(20px, 1fr)) 192px 160px;
|
||||
`,
|
||||
BaseRow: `
|
||||
font-size: 14px;
|
||||
@@ -70,11 +69,8 @@ const scheduleTheme = {
|
||||
}
|
||||
`,
|
||||
BaseCell: `
|
||||
&:nth-of-type(2) {
|
||||
text-align: center;
|
||||
}
|
||||
&:nth-of-type(1) {
|
||||
text-align: center;
|
||||
text-align: 8px;
|
||||
}
|
||||
`,
|
||||
HeaderRow: `
|
||||
@@ -100,7 +96,6 @@ const scheduleTheme = {
|
||||
};
|
||||
|
||||
const scheduleTypeLabels: Record<number, string> = {
|
||||
[ScheduleFlag.SCHEDULE_IMMEDIATE]: 'Immediate',
|
||||
[ScheduleFlag.SCHEDULE_TIMER]: 'Timer',
|
||||
[ScheduleFlag.SCHEDULE_CONDITION]: 'Condition',
|
||||
[ScheduleFlag.SCHEDULE_ONCHANGE]: 'On Change'
|
||||
@@ -125,6 +120,11 @@ const Scheduler = () => {
|
||||
initialData: []
|
||||
});
|
||||
|
||||
const { data: commandNames } = useRequest(readCommands, {
|
||||
initialData: [],
|
||||
initializing: true
|
||||
});
|
||||
|
||||
const { send: updateSchedule } = useRequest(
|
||||
(data: Schedule) => writeSchedule(data),
|
||||
{
|
||||
@@ -140,8 +140,7 @@ const Scheduler = () => {
|
||||
si.deleted !== si.o_deleted ||
|
||||
si.flags !== si.o_flags ||
|
||||
si.time !== si.o_time ||
|
||||
si.cmd !== si.o_cmd ||
|
||||
si.value !== si.o_value
|
||||
si.cmd_name !== si.o_cmd_name
|
||||
);
|
||||
};
|
||||
|
||||
@@ -177,8 +176,7 @@ const Scheduler = () => {
|
||||
active: condensed_si.active,
|
||||
flags: condensed_si.flags,
|
||||
time: condensed_si.time,
|
||||
cmd: condensed_si.cmd,
|
||||
value: condensed_si.value,
|
||||
cmd_name: condensed_si.cmd_name,
|
||||
name: condensed_si.name
|
||||
}))
|
||||
});
|
||||
@@ -289,7 +287,6 @@ const Scheduler = () => {
|
||||
<HeaderCell stiff>{LL.SCHEDULE(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.TIME(0)}/Cond.</HeaderCell>
|
||||
<HeaderCell stiff>{LL.COMMAND(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.NAME(0)}</HeaderCell>
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
@@ -297,12 +294,10 @@ const Scheduler = () => {
|
||||
{tableList.map((si: ScheduleItem) => (
|
||||
<Row key={si.id} item={si} onClick={() => editScheduleItem(si)}>
|
||||
<Cell stiff>
|
||||
{si.flags !== ScheduleFlag.SCHEDULE_IMMEDIATE && (
|
||||
<CircleIcon
|
||||
color={si.active ? 'success' : 'error'}
|
||||
sx={{ fontSize: ICON_SIZE, verticalAlign: 'middle' }}
|
||||
/>
|
||||
)}
|
||||
<CircleIcon
|
||||
color={si.active ? 'success' : 'error'}
|
||||
sx={{ fontSize: ICON_SIZE, verticalAlign: 'middle' }}
|
||||
/>
|
||||
</Cell>
|
||||
<Cell stiff>
|
||||
<Stack spacing={0.5} direction="row">
|
||||
@@ -322,8 +317,7 @@ const Scheduler = () => {
|
||||
</Stack>
|
||||
</Cell>
|
||||
<Cell>{si.time}</Cell>
|
||||
<Cell>{si.cmd}</Cell>
|
||||
<Cell>{si.value}</Cell>
|
||||
<Cell>{si.cmd_name}</Cell>
|
||||
<Cell>{si.name}</Cell>
|
||||
</Row>
|
||||
))}
|
||||
@@ -351,6 +345,7 @@ const Scheduler = () => {
|
||||
selectedItem={selectedScheduleItem}
|
||||
validator={schedulerItemValidation(schedule, selectedScheduleItem)}
|
||||
dow={dow}
|
||||
commandNames={commandNames.map((ci) => ci.name)}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
import AddIcon from '@mui/icons-material/Add';
|
||||
import CancelIcon from '@mui/icons-material/Cancel';
|
||||
import DoneIcon from '@mui/icons-material/Done';
|
||||
import PlayArrowIcon from '@mui/icons-material/PlayArrow';
|
||||
import RemoveIcon from '@mui/icons-material/RemoveCircleOutlined';
|
||||
import {
|
||||
Box,
|
||||
@@ -15,15 +13,14 @@ import {
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Grid,
|
||||
MenuItem,
|
||||
TextField,
|
||||
ToggleButton,
|
||||
ToggleButtonGroup,
|
||||
Typography
|
||||
} from '@mui/material';
|
||||
|
||||
import { callAction } from '@/api/app';
|
||||
import { dialogStyle } from 'CustomTheme';
|
||||
import { useRequest } from 'alova/client';
|
||||
import type Schema from 'async-validator';
|
||||
import type { ValidateFieldsError } from 'async-validator';
|
||||
import { BlockFormControlLabel, ValidatedTextField } from 'components';
|
||||
@@ -77,6 +74,7 @@ interface SchedulerDialogProps {
|
||||
selectedItem: ScheduleItem;
|
||||
validator: Schema;
|
||||
dow: string[];
|
||||
commandNames: string[];
|
||||
}
|
||||
|
||||
const SchedulerDialog = ({
|
||||
@@ -86,7 +84,8 @@ const SchedulerDialog = ({
|
||||
onSave,
|
||||
selectedItem,
|
||||
validator,
|
||||
dow
|
||||
dow,
|
||||
commandNames
|
||||
}: SchedulerDialogProps) => {
|
||||
const { LL } = useI18nContext();
|
||||
const [editItem, setEditItem] = useState<ScheduleItem>(selectedItem);
|
||||
@@ -103,12 +102,6 @@ const SchedulerDialog = ({
|
||||
if (open) {
|
||||
setFieldErrors(undefined);
|
||||
setEditItem(selectedItem);
|
||||
// Set the flags based on type when page is loaded:
|
||||
// 0-127 is day schedule
|
||||
// 128 is timer
|
||||
// 129 is on change
|
||||
// 130 is on condition
|
||||
// 132 is immediate
|
||||
setScheduleType(
|
||||
selectedItem.flags <= SCHEDULE_TYPE_THRESHOLD
|
||||
? ScheduleFlag.SCHEDULE_DAY
|
||||
@@ -131,21 +124,6 @@ const SchedulerDialog = ({
|
||||
await handleSave(editItem);
|
||||
};
|
||||
|
||||
const { send: executeSchedule } = useRequest(
|
||||
(id: string) => callAction({ action: 'executeSchedule', param: id }),
|
||||
{ immediate: false }
|
||||
)
|
||||
.onSuccess(() => {
|
||||
toast.success(LL.EXECUTE_SCHEDULE_SENT());
|
||||
})
|
||||
.onError((error) => {
|
||||
toast.error(String(error.error?.message || 'An error occurred'));
|
||||
});
|
||||
|
||||
const execute = async () => {
|
||||
await executeSchedule(editItem.name);
|
||||
};
|
||||
|
||||
const remove = () => {
|
||||
onSave({ ...editItem, deleted: true });
|
||||
};
|
||||
@@ -197,7 +175,6 @@ const SchedulerDialog = ({
|
||||
|
||||
const isDaySchedule = scheduleType === ScheduleFlag.SCHEDULE_DAY;
|
||||
const isTimerSchedule = scheduleType === ScheduleFlag.SCHEDULE_TIMER;
|
||||
const isImmediateSchedule = scheduleType === ScheduleFlag.SCHEDULE_IMMEDIATE;
|
||||
const needsTimeField = isDaySchedule || isTimerSchedule;
|
||||
|
||||
const dowFlags = getFlagDOWstring(editItem.flags);
|
||||
@@ -214,7 +191,6 @@ const SchedulerDialog = ({
|
||||
if (scheduleType === ScheduleFlag.SCHEDULE_TIMER) return LL.TIMER(1);
|
||||
if (scheduleType === ScheduleFlag.SCHEDULE_CONDITION) return LL.CONDITION();
|
||||
if (scheduleType === ScheduleFlag.SCHEDULE_ONCHANGE) return LL.ONCHANGE();
|
||||
if (scheduleType === ScheduleFlag.SCHEDULE_IMMEDIATE) return LL.IMMEDIATE();
|
||||
return LL.TIME(1);
|
||||
})();
|
||||
|
||||
@@ -269,14 +245,6 @@ const SchedulerDialog = ({
|
||||
{LL.CONDITION()}
|
||||
</Typography>
|
||||
</ToggleButton>
|
||||
<ToggleButton value={ScheduleFlag.SCHEDULE_IMMEDIATE}>
|
||||
<Typography
|
||||
sx={{ fontSize: TYPOGRAPHY_FONT_SIZE }}
|
||||
color={isImmediateSchedule ? 'primary' : 'grey'}
|
||||
>
|
||||
{LL.IMMEDIATE()}
|
||||
</Typography>
|
||||
</ToggleButton>
|
||||
</ToggleButtonGroup>
|
||||
|
||||
{isDaySchedule && (
|
||||
@@ -294,74 +262,66 @@ const SchedulerDialog = ({
|
||||
</ToggleButtonGroup>
|
||||
)}
|
||||
|
||||
{!isImmediateSchedule && (
|
||||
<>
|
||||
<Grid container>
|
||||
<BlockFormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={editItem.active}
|
||||
onChange={updateFormValue}
|
||||
name="active"
|
||||
/>
|
||||
}
|
||||
label={LL.ACTIVE()}
|
||||
<Grid container>
|
||||
<BlockFormControlLabel
|
||||
control={
|
||||
<Checkbox
|
||||
checked={editItem.active}
|
||||
onChange={updateFormValue}
|
||||
name="active"
|
||||
/>
|
||||
</Grid>
|
||||
<Grid container>
|
||||
{needsTimeField ? (
|
||||
<>
|
||||
<TextField
|
||||
name="time"
|
||||
type="time"
|
||||
label={timeFieldLabel}
|
||||
value={timeFieldValue}
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
{isTimerSchedule && (
|
||||
<Typography
|
||||
sx={{ ml: 2, mt: 4 }}
|
||||
color="warning"
|
||||
variant="body2"
|
||||
>
|
||||
{LL.SCHEDULER_HELP_2()}
|
||||
</Typography>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<TextField
|
||||
name="time"
|
||||
label={timeFieldLabel}
|
||||
multiline
|
||||
fullWidth
|
||||
value={timeFieldValue}
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
}
|
||||
label={LL.ACTIVE()}
|
||||
/>
|
||||
</Grid>
|
||||
<Grid container>
|
||||
{needsTimeField ? (
|
||||
<>
|
||||
<TextField
|
||||
name="time"
|
||||
type="time"
|
||||
label={timeFieldLabel}
|
||||
value={timeFieldValue}
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
{isTimerSchedule && (
|
||||
<Typography
|
||||
sx={{ ml: 2, mt: 4 }}
|
||||
color="warning"
|
||||
variant="body2"
|
||||
>
|
||||
{LL.SCHEDULER_HELP_2()}
|
||||
</Typography>
|
||||
)}
|
||||
</Grid>
|
||||
</>
|
||||
)}
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors || {}}
|
||||
name="cmd"
|
||||
label={LL.COMMAND(0)}
|
||||
multiline
|
||||
fullWidth
|
||||
value={editItem.cmd}
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<TextField
|
||||
name="time"
|
||||
label={timeFieldLabel}
|
||||
multiline
|
||||
fullWidth
|
||||
value={timeFieldValue}
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
)}
|
||||
</Grid>
|
||||
<TextField
|
||||
name="value"
|
||||
label={LL.VALUE(0)}
|
||||
multiline
|
||||
margin="normal"
|
||||
name="cmd_name"
|
||||
label={LL.COMMAND(0)}
|
||||
value={editItem.cmd_name}
|
||||
fullWidth
|
||||
value={editItem.value}
|
||||
select
|
||||
margin="normal"
|
||||
onChange={updateFormValue}
|
||||
/>
|
||||
>
|
||||
{commandNames.map((name) => (
|
||||
<MenuItem key={name} value={name}>
|
||||
{name}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors || {}}
|
||||
name="name"
|
||||
@@ -402,16 +362,6 @@ const SchedulerDialog = ({
|
||||
>
|
||||
{creating ? LL.ADD(0) : LL.UPDATE()}
|
||||
</Button>
|
||||
{isImmediateSchedule && !creating && editItem.cmd !== '' && (
|
||||
<Button
|
||||
startIcon={<PlayArrowIcon />}
|
||||
variant="outlined"
|
||||
onClick={execute}
|
||||
color="success"
|
||||
>
|
||||
{LL.EXECUTE()}
|
||||
</Button>
|
||||
)}
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
);
|
||||
|
||||
@@ -354,16 +354,14 @@ export interface ScheduleItem {
|
||||
deleted?: boolean;
|
||||
flags: number;
|
||||
time: string; // also used for Condition and On Change
|
||||
cmd: string;
|
||||
value: string;
|
||||
cmd_name: string; // references a named Command
|
||||
name: string;
|
||||
o_id?: number;
|
||||
o_active?: boolean;
|
||||
o_deleted?: boolean;
|
||||
o_flags?: number;
|
||||
o_time?: string;
|
||||
o_cmd?: string;
|
||||
o_value?: string;
|
||||
o_cmd_name?: string;
|
||||
o_name?: string;
|
||||
}
|
||||
|
||||
@@ -371,6 +369,23 @@ export interface Schedule {
|
||||
readonly schedule: readonly ScheduleItem[];
|
||||
}
|
||||
|
||||
export interface CommandItem {
|
||||
id: number;
|
||||
cmd: string;
|
||||
value: string;
|
||||
name: string;
|
||||
deleted?: boolean;
|
||||
o_id?: number;
|
||||
o_cmd?: string;
|
||||
o_value?: string;
|
||||
o_name?: string;
|
||||
o_deleted?: boolean;
|
||||
}
|
||||
|
||||
export interface Commands {
|
||||
readonly commands: readonly CommandItem[];
|
||||
}
|
||||
|
||||
export interface ModuleItem {
|
||||
id: number; // unique index
|
||||
key: string;
|
||||
@@ -401,8 +416,7 @@ export enum ScheduleFlag {
|
||||
SCHEDULE_DAY = 0, // no bits set
|
||||
SCHEDULE_TIMER = 128, // bit 8
|
||||
SCHEDULE_ONCHANGE = 129, // bit 1
|
||||
SCHEDULE_CONDITION = 130, // bit 2
|
||||
SCHEDULE_IMMEDIATE = 132 // bit 3
|
||||
SCHEDULE_CONDITION = 130 // bit 2
|
||||
}
|
||||
|
||||
export interface EntityItem {
|
||||
@@ -445,6 +459,7 @@ export const enum DeviceType {
|
||||
ANALOGSENSOR = 2,
|
||||
SCHEDULER = 3,
|
||||
CUSTOM = 4,
|
||||
COMMAND = 5,
|
||||
BOILER,
|
||||
THERMOSTAT,
|
||||
MIXER,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { IP_OR_HOSTNAME_VALIDATOR } from 'validators/shared';
|
||||
|
||||
import type {
|
||||
AnalogSensor,
|
||||
CommandItem,
|
||||
DeviceValue,
|
||||
EntityItem,
|
||||
ScheduleItem,
|
||||
@@ -237,6 +238,24 @@ export const schedulerItemValidation = (
|
||||
NAME_PATTERN_REQUIRED,
|
||||
uniqueNameValidator(schedule, scheduleItem.o_name)
|
||||
],
|
||||
cmd_name: [
|
||||
{ required: true, message: 'Command is required' }
|
||||
]
|
||||
});
|
||||
|
||||
export const uniqueCommandNameValidator = (commands: CommandItem[], o_name?: string) =>
|
||||
createUniqueNameValidator(commands, o_name);
|
||||
|
||||
export const commandItemValidation = (
|
||||
commands: CommandItem[],
|
||||
commandItem: CommandItem
|
||||
) =>
|
||||
new Schema({
|
||||
name: [
|
||||
{ required: true, message: 'Name is required' },
|
||||
NAME_PATTERN_REQUIRED,
|
||||
uniqueCommandNameValidator(commands, commandItem.o_name)
|
||||
],
|
||||
cmd: [
|
||||
{ required: true, message: 'Command is required' },
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ import ConstructionIcon from '@mui/icons-material/Construction';
|
||||
import KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';
|
||||
import LiveHelpIcon from '@mui/icons-material/LiveHelp';
|
||||
import MoreTimeIcon from '@mui/icons-material/MoreTime';
|
||||
import PlaylistPlayIcon from '@mui/icons-material/PlaylistPlay';
|
||||
import PlaylistAddIcon from '@mui/icons-material/PlaylistAdd';
|
||||
import SensorsIcon from '@mui/icons-material/Sensors';
|
||||
import SettingsIcon from '@mui/icons-material/Settings';
|
||||
@@ -80,6 +81,12 @@ const LayoutMenuComponent = () => {
|
||||
disabled={!me.admin}
|
||||
to={`/customizations`}
|
||||
/>
|
||||
<LayoutMenuItem
|
||||
icon={PlaylistPlayIcon}
|
||||
label={LL.COMMANDS()}
|
||||
disabled={!me.admin}
|
||||
to={`/commands`}
|
||||
/>
|
||||
<LayoutMenuItem
|
||||
icon={MoreTimeIcon}
|
||||
label={LL.SCHEDULER()}
|
||||
|
||||
@@ -286,14 +286,13 @@ const cz: Translation = {
|
||||
STAY: 'Zůstat',
|
||||
LEAVE: 'Odejít',
|
||||
SCHEDULER: 'Plánovač',
|
||||
SCHEDULER_HELP_1: 'Automatizujte příkazy přidáním naplánovaných událostí níže. Nastavte jedinečný název pro povolení/zakázání aktivace přes API/MQTT',
|
||||
SCHEDULER_HELP_1: 'Automatizujte příkazy přidáním naplánovaných událostí níže',
|
||||
SCHEDULER_HELP_2: 'Použijte 00:00 pro spuštění při startu',
|
||||
SCHEDULE: 'Harmonogram',
|
||||
TIME: 'Čas',
|
||||
TIMER: 'Časovač',
|
||||
ONCHANGE: 'Při změně',
|
||||
CONDITION: 'Podmínka',
|
||||
IMMEDIATE: 'Ihned',
|
||||
SCHEDULE_UPDATED: 'Harmonogram aktualizován',
|
||||
SCHEDULE_TIMER_1: 'při startu',
|
||||
SCHEDULE_TIMER_2: 'každou minutu',
|
||||
@@ -365,7 +364,10 @@ const cz: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Toto vytvoří zálohu vašich celých systémových konfigurací a nastavení. Všechna hesla budou v zálohovém souboru čitelná. Buďte opatrní při sdílení! Opravdu chcete pokračovat?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email byl úspěšně odeslán',
|
||||
SYSTEM_NAME: 'Název systému',
|
||||
EXECUTE_SCHEDULE_SENT: 'Plán byl úspěšně proveden'
|
||||
COMMANDS: 'Příkazy',
|
||||
COMMANDS_UPDATED: 'Příkazy byly aktualizovány',
|
||||
COMMANDS_HELP_1: 'Definujte vlastní příkazy pro magistrali EMS',
|
||||
EXECUTE_COMMAND_SENT: 'Příkaz byl odeslán.',
|
||||
};
|
||||
|
||||
export default cz;
|
||||
|
||||
@@ -286,14 +286,13 @@ const de: Translation = {
|
||||
STAY: 'Bleiben',
|
||||
LEAVE: 'Verlassen',
|
||||
SCHEDULER: 'Planer',
|
||||
SCHEDULER_HELP_1: 'Fügen Sie eigene geplante Befehle zur Automatisierung hinzu. Vergeben Sie einen Entitätsnamen, um die Aktivierung über API/Mqtt zu steuern',
|
||||
SCHEDULER_HELP_1: 'Fügen Sie eigene geplante Befehle zur Automatisierung hinzu',
|
||||
SCHEDULER_HELP_2: '00:00 aktiviert einmalige Ausführung beim Start.',
|
||||
SCHEDULE: 'Zeitplan',
|
||||
TIME: 'Zeit',
|
||||
TIMER: 'Timer',
|
||||
ONCHANGE: 'Bei Änderung',
|
||||
CONDITION: 'Zustand',
|
||||
IMMEDIATE: 'Sofort',
|
||||
SCHEDULE_UPDATED: 'Zeitplan aktualisiert',
|
||||
SCHEDULE_TIMER_1: 'beim Start',
|
||||
SCHEDULE_TIMER_2: 'jede Minute',
|
||||
@@ -365,7 +364,10 @@ const de: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Dies wird eine Sicherung Ihrer vollständigen Systemkonfiguration und Einstellungen erstellen. Alle Passwörter werden in dieser Sicherungsdatei lesbar sein. Seien Sie vorsichtig beim Teilen! Möchten Sie fortfahren?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email erfolgreich gesendet',
|
||||
SYSTEM_NAME: 'Systemname',
|
||||
EXECUTE_SCHEDULE_SENT: 'Zeitplan erfolgreich ausgeführt'
|
||||
COMMANDS: 'Befehle',
|
||||
COMMANDS_UPDATED: 'Befehle wurden aktualisiert',
|
||||
COMMANDS_HELP_1: 'Definieren Sie eigene Befehle für die EMS-Magistral',
|
||||
EXECUTE_COMMAND_SENT: 'Befehl wurde ausgeführt.',
|
||||
};
|
||||
|
||||
export default de;
|
||||
|
||||
@@ -285,22 +285,22 @@ const en: Translation = {
|
||||
BLOCK_NAVIGATE_2: 'If you navigate to a different page, your unsaved changes will be lost. Are you sure you want to leave this page?',
|
||||
STAY: 'Stay',
|
||||
LEAVE: 'Leave',
|
||||
COMMANDS: 'Commands',
|
||||
COMMANDS_HELP_1: 'Define reusable named commands below. These can be executed from the console, API/MQTT, or referenced by the Scheduler',
|
||||
EXECUTE_COMMAND_SENT: 'Command executed successfully',
|
||||
SCHEDULER: 'Scheduler',
|
||||
SCHEDULER_HELP_1: 'Automate commands by adding scheduled events below. Set a unique Name to enable/disable activation via API/MQTT',
|
||||
SCHEDULER_HELP_1: 'Automate commands by adding scheduled events below',
|
||||
SCHEDULER_HELP_2: 'Use 00:00 to trigger once on start-up',
|
||||
SCHEDULE: 'Schedule',
|
||||
TIME: 'Time',
|
||||
TIMER: 'Timer',
|
||||
ONCHANGE: 'On Change',
|
||||
CONDITION: 'Condition',
|
||||
IMMEDIATE: 'Immediate',
|
||||
SCHEDULE_UPDATED: 'Schedule updated',
|
||||
SCHEDULE_TIMER_1: 'on startup',
|
||||
SCHEDULE_TIMER_2: 'every minute',
|
||||
SCHEDULE_TIMER_3: 'every hour',
|
||||
CUSTOM_ENTITIES: 'Custom Entities',
|
||||
ENTITIES_HELP_1: 'Define custom EMS entities or dynamic user variables',
|
||||
ENTITIES_UPDATED: 'Entities Updated',
|
||||
WRITEABLE: 'Writeable',
|
||||
SHOWING: 'Showing',
|
||||
SEARCH: 'Search',
|
||||
@@ -321,7 +321,6 @@ const en: Translation = {
|
||||
DOWNLOAD_UPLOAD_1: 'Download and Upload Settings and Firmware',
|
||||
MODULES: 'Modules',
|
||||
MODULES_1: 'Activate or deactivate external modules',
|
||||
MODULES_UPDATED: 'Modules updated',
|
||||
MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules',
|
||||
MODULES_NONE: 'No external modules detected',
|
||||
RENAME: 'Rename',
|
||||
@@ -364,8 +363,7 @@ const en: Translation = {
|
||||
UPGRADE_IMPORTANT_MESSAGES_2: 'You are upgrading to a new major version. Make sure you have read the ChangeLog for any breaking changes.',
|
||||
WARNING_SYSTEM_BACKUP: 'This will create a backup of your full system configuration and settings. All passwords will be readable in the backup file. Be careful with sharing! Do you want to continue?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email sent successfully',
|
||||
SYSTEM_NAME: 'System Name',
|
||||
EXECUTE_SCHEDULE_SENT: 'Schedule executed successfully'
|
||||
SYSTEM_NAME: 'System Name'
|
||||
};
|
||||
|
||||
export default en;
|
||||
|
||||
@@ -286,14 +286,13 @@ const fr: Translation = {
|
||||
STAY: 'Rester',
|
||||
LEAVE: 'Quitter',
|
||||
SCHEDULER: 'Scheduler',
|
||||
SCHEDULER_HELP_1: 'Automatiser les commandes en ajoutant des événements programmés ci-dessous. Définissez un nom unique pour activer/désactiver l\'activation via API/MQTT',
|
||||
SCHEDULER_HELP_1: 'Automatiser les commandes en ajoutant des événements programmés ci-dessous',
|
||||
SCHEDULER_HELP_2: 'Utiliser 00:00 pour déclencher une fois au démarrage',
|
||||
SCHEDULE: 'Programme',
|
||||
TIME: 'Temps',
|
||||
TIMER: 'Minuteur',
|
||||
ONCHANGE: 'Sur le changement',
|
||||
CONDITION: 'Condition',
|
||||
IMMEDIATE: 'Immédiat',
|
||||
SCHEDULE_UPDATED: 'Programme mis à jour',
|
||||
SCHEDULE_TIMER_1: 'au démarrage',
|
||||
SCHEDULE_TIMER_2: 'toutes les minutes',
|
||||
@@ -365,7 +364,10 @@ const fr: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Cela créera une sauvegarde de votre configuration et paramètres complets. Tous les mots de passe seront lisibles dans le fichier de sauvegarde. Soyez prudent avec le partage ! Voulez-vous continuer ?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email envoyé avec succès',
|
||||
SYSTEM_NAME: 'Nom du système',
|
||||
EXECUTE_SCHEDULE_SENT: 'Planlegger exécuté avec succès'
|
||||
COMMANDS: 'Commandes',
|
||||
COMMANDS_UPDATED: 'Commandes mises à jour',
|
||||
COMMANDS_HELP_1: 'Définir des commandes personnalisées pour la magistral EMS',
|
||||
EXECUTE_COMMAND_SENT: 'Commande exécutée avec succès.',
|
||||
};
|
||||
|
||||
export default fr;
|
||||
|
||||
@@ -286,14 +286,13 @@ const it: Translation = {
|
||||
STAY: 'Stai',
|
||||
LEAVE: 'Esci',
|
||||
SCHEDULER: 'Programma eventi',
|
||||
SCHEDULER_HELP_1: "Automatizza i comandi aggiungendo gli eventi programmati di seguito. Imposta un nome univoco per abilitare/disabilitare l'attivazione tramite API/MQTT",
|
||||
SCHEDULER_HELP_1: "Automatizza i comandi aggiungendo gli eventi programmati di seguito",
|
||||
SCHEDULER_HELP_2: "per attivare una volta all'avvio",
|
||||
SCHEDULE: 'Programma',
|
||||
TIME: 'Ora',
|
||||
TIMER: 'Orologio',
|
||||
ONCHANGE: 'Sul cambiamento',
|
||||
CONDITION: 'Condizione',
|
||||
IMMEDIATE: 'Immediata',
|
||||
SCHEDULE_UPDATED: 'Calendario aggiornato',
|
||||
SCHEDULE_TIMER_1: 'All avvio',
|
||||
SCHEDULE_TIMER_2: 'Ogni minuto',
|
||||
@@ -365,7 +364,10 @@ const it: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Questo creerà un backup delle tue configurazioni e impostazioni complete. Tutte le password saranno leggibili nel file di backup. Sei sicuro di voler continuare?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email inviata con successo',
|
||||
SYSTEM_NAME: 'Nome del sistema',
|
||||
EXECUTE_SCHEDULE_SENT: 'Programma eseguito con successo'
|
||||
COMMANDS: 'Comandi',
|
||||
COMMANDS_UPDATED: 'Comandi aggiornati',
|
||||
COMMANDS_HELP_1: 'Definisci comandi personalizzati per la magistrali EMS',
|
||||
EXECUTE_COMMAND_SENT: 'Comando eseguito con successo.',
|
||||
};
|
||||
|
||||
export default it;
|
||||
|
||||
@@ -286,14 +286,13 @@ const nl: Translation = {
|
||||
STAY: 'Blijven',
|
||||
LEAVE: 'Verlaten',
|
||||
SCHEDULER: 'Scheduler',
|
||||
SCHEDULER_HELP_1: 'Automatiseer opdrachten door hieronder geplande gebeurtenissen toe te voegen. Stel een unieke naam in om activering via API/MQTT in/uit te schakelen',
|
||||
SCHEDULER_HELP_1: 'Automatiseer opdrachten door hieronder geplande gebeurtenissen toe te voegen',
|
||||
SCHEDULER_HELP_2: 'Gebruik 00:00 om eenmaal te activeren bij het opstarten',
|
||||
SCHEDULE: 'Schedule',
|
||||
TIME: 'Tijd',
|
||||
TIMER: 'Timer',
|
||||
ONCHANGE: 'Op verandering',
|
||||
CONDITION: 'Voorwaarde',
|
||||
IMMEDIATE: 'Onmiddellijk',
|
||||
SCHEDULE_UPDATED: 'Schema bijgewerkt',
|
||||
SCHEDULE_TIMER_1: 'bij het opstarten',
|
||||
SCHEDULE_TIMER_2: 'elke minuut',
|
||||
@@ -365,7 +364,10 @@ const nl: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Dit zal een back-up van uw volledige systeemconfiguratie en instellingen maken. Alle wachtwoorden zijn leesbaar in het back-upbestand. Wees voorzichtig bij delen! Wilt u doorgaan?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email verzonden succesvol',
|
||||
SYSTEM_NAME: 'Systeemnaam',
|
||||
EXECUTE_SCHEDULE_SENT: 'Planlegger uitgevoerd succesvol'
|
||||
COMMANDS: 'Commando\'s',
|
||||
COMMANDS_UPDATED: 'Commando\'s bijgewerkt',
|
||||
COMMANDS_HELP_1: 'Definieer hergebruikbare benoemde commando\'s hieronder. Deze kunnen worden uitgevoerd vanuit de console, API/MQTT, of worden aangeroepen door de Scheduler',
|
||||
EXECUTE_COMMAND_SENT: 'Commando uitgevoerd.',
|
||||
};
|
||||
|
||||
export default nl;
|
||||
|
||||
@@ -286,14 +286,13 @@ const no: Translation = {
|
||||
STAY: 'Bli her',
|
||||
LEAVE: 'Forlat',
|
||||
SCHEDULER: 'Planlegger',
|
||||
SCHEDULER_HELP_1: 'Automatiser kommandoer ved å legge til skedulerte hendelser nedenfor. Sett et unikt navn for å slå på/av aktivering via API/MQTT',
|
||||
SCHEDULER_HELP_1: 'Automatiser kommandoer ved å legge til skedulerte hendelser nedenfor',
|
||||
SCHEDULER_HELP_2: 'Bruk 00:00 for å kjøre en gang ved oppstart',
|
||||
SCHEDULE: 'Planlegg',
|
||||
TIME: 'Tid',
|
||||
TIMER: 'Timer',
|
||||
ONCHANGE: 'På endring',
|
||||
CONDITION: 'Betingelse',
|
||||
IMMEDIATE: 'Umiddelbar',
|
||||
SCHEDULE_UPDATED: 'Planlegger er oppdatert',
|
||||
SCHEDULE_TIMER_1: 'ved oppstart',
|
||||
SCHEDULE_TIMER_2: 'hvert minutt',
|
||||
@@ -365,7 +364,10 @@ const no: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Dette vil lage en sikkerhetskopi av din fullstendige systemkonfigurasjon og innstillinger. Alle passord vil være lesbare i sikkerhetskopien. Vær forsiktig med deling! Vil du fortsette?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email sendt suksessfullt',
|
||||
SYSTEM_NAME: 'Systemnavn',
|
||||
EXECUTE_SCHEDULE_SENT: 'Planlegger utført suksessfullt'
|
||||
COMMANDS: 'Kommandoer',
|
||||
COMMANDS_UPDATED: 'Kommandoer oppdatert',
|
||||
COMMANDS_HELP_1: 'Definer egne kommandoer for EMS-Magistral',
|
||||
EXECUTE_COMMAND_SENT: 'Kommando utført.',
|
||||
};
|
||||
|
||||
export default no;
|
||||
|
||||
@@ -286,14 +286,13 @@ const pl: BaseTranslation = {
|
||||
STAY: 'Pozostań',
|
||||
LEAVE: 'Opuść',
|
||||
SCHEDULER: 'Harmonogram',
|
||||
SCHEDULER_HELP_1: 'Zautomatyzuj wykonywanie komend, dodając poniżej harmonogram zdarzeń. Nadaj mu unikalną nazwę, aby móc go aktywować/dezaktywować przez API/MQTT',
|
||||
SCHEDULER_HELP_1: 'Zautomatyzuj wykonywanie komend, dodając poniżej harmonogram zdarzeń',
|
||||
SCHEDULER_HELP_2: 'Wpisz 00:00 aby wykonywać jednorazowo przy starcie.',
|
||||
SCHEDULE: '{{H|h|}}armonogram{{|u|}}',
|
||||
TIME: '{{Czas|Godzina|}}',
|
||||
TIMER: '{{m|M|}}inutnik',
|
||||
ONCHANGE: 'O zmianie',
|
||||
CONDITION: 'Stan',
|
||||
IMMEDIATE: 'Natychmiastowy',
|
||||
SCHEDULE_UPDATED: 'Harmonogram został uaktualniony.',
|
||||
SCHEDULE_TIMER_1: 'przy starcie',
|
||||
SCHEDULE_TIMER_2: 'co minutę',
|
||||
@@ -365,7 +364,10 @@ const pl: BaseTranslation = {
|
||||
WARNING_SYSTEM_BACKUP: 'To spowoduje utworzenie kopii zapasowej całej konfiguracji i ustawień systemu. Wszystkie hasła będą widoczne w pliku kopii zapasowej. Bądź ostrożny przy udostępnianiu! Chcesz kontynuować?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email wysłany pomyślnie',
|
||||
SYSTEM_NAME: 'Nazwa systemu',
|
||||
EXECUTE_SCHEDULE_SENT: 'Harmonogram wykonany pomyślnie'
|
||||
COMMANDS: 'Komendy',
|
||||
COMMANDS_UPDATED: 'Komendy zostały zaktualizowane',
|
||||
COMMANDS_HELP_1: 'Zdefiniuj niestandardowe komendy dla magistrali EMS',
|
||||
EXECUTE_COMMAND_SENT: 'Komenda została wysłana.'
|
||||
};
|
||||
|
||||
export default pl;
|
||||
|
||||
@@ -286,14 +286,13 @@ const sk: Translation = {
|
||||
STAY: 'Zostať',
|
||||
LEAVE: 'Opustiť',
|
||||
SCHEDULER: 'Plánovač',
|
||||
SCHEDULER_HELP_1: 'Automatizujte príkazy pridaním naplánovaných udalostí nižšie. Nastavte jedinečné meno na aktiváciu/deaktiváciu cez API/MQTT',
|
||||
SCHEDULER_HELP_1: 'Automatizujte príkazy pridaním naplánovaných udalostí nižšie',
|
||||
SCHEDULER_HELP_2: 'Použite 00:00 na jednorazové spustenie pri štarte',
|
||||
SCHEDULE: 'Plánovač',
|
||||
TIME: 'Čas',
|
||||
TIMER: 'Časovač',
|
||||
ONCHANGE: 'Pri zmene',
|
||||
CONDITION: 'Podmienka',
|
||||
IMMEDIATE: 'Okamžite',
|
||||
SCHEDULE_UPDATED: 'Plánovanie aktualizované',
|
||||
SCHEDULE_TIMER_1: 'pri spustení',
|
||||
SCHEDULE_TIMER_2: 'každú minútu',
|
||||
@@ -365,7 +364,10 @@ const sk: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Toto vytvorí zálohu všetkých vašich celých systémových konfigurácií a nastavení. Všetky hesla budú čitateľné v zálohovom súbore. Buďte opatrní pri zdieľaní! Chcete pokračovať?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email bol úspešne odoslaný',
|
||||
SYSTEM_NAME: 'Názov systému',
|
||||
EXECUTE_SCHEDULE_SENT: 'Plán bol úspešne vykonaný'
|
||||
COMMANDS: 'Príkazy',
|
||||
COMMANDS_UPDATED: 'Príkazy aktualizované',
|
||||
COMMANDS_HELP_1: 'Definujte vlastné príkazy pre magistrali EMS',
|
||||
EXECUTE_COMMAND_SENT: 'Príkaz bol vykonaný.',
|
||||
};
|
||||
|
||||
export default sk;
|
||||
|
||||
@@ -286,14 +286,13 @@ const sv: Translation = {
|
||||
STAY: 'Stanna',
|
||||
LEAVE: 'Lämna',
|
||||
SCHEDULER: 'Schemaläggning',
|
||||
SCHEDULER_HELP_1: 'Automatisera kommandon genom att lägga till schemahändelser nedan. Ange ett unikt namn för att aktivera/avaktivera aktivering via API/MQTT',
|
||||
SCHEDULER_HELP_1: 'Automatisera kommandon genom att lägga till schemahändelser nedan',
|
||||
SCHEDULER_HELP_2: 'Använd 00:00 för att trigga en gång vid uppstart',
|
||||
SCHEDULE: 'schema',
|
||||
TIME: 'Tid',
|
||||
TIMER: 'Timer',
|
||||
ONCHANGE: 'Vid förändring',
|
||||
CONDITION: 'Villkor',
|
||||
IMMEDIATE: 'Omedelbar',
|
||||
SCHEDULE_UPDATED: 'Schema uppdaterat',
|
||||
SCHEDULE_TIMER_1: 'vid uppstart',
|
||||
SCHEDULE_TIMER_2: 'varje minut',
|
||||
@@ -365,7 +364,10 @@ const sv: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Detta kommer att skapa en säkerhetskopia av din fullständiga systemkonfiguration och inställningar. Alla lösenord kommer att vara läsbara i säkerhetskopien. Var försiktig med att dela! Vill du fortsätta?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email skickad lyckades',
|
||||
SYSTEM_NAME: 'Systemnamn',
|
||||
EXECUTE_SCHEDULE_SENT: 'Schema utfört'
|
||||
COMMANDS: 'Kommandon',
|
||||
COMMANDS_UPDATED: 'Kommandon uppdaterade',
|
||||
COMMANDS_HELP_1: 'Definiera egna kommandon för EMS-Magistral',
|
||||
EXECUTE_COMMAND_SENT: 'Kommando utfört.',
|
||||
};
|
||||
|
||||
export default sv;
|
||||
|
||||
@@ -286,14 +286,13 @@ const tr: Translation = {
|
||||
STAY: 'Kal',
|
||||
LEAVE: 'Çık',
|
||||
SCHEDULER: 'Zamanlayıcı',
|
||||
SCHEDULER_HELP_1: 'Komutları zamanlayarak otomatikleştirin. Benzersiz bir ad belirtin API/MQTT aracılığıyla etkinleştirmek/devre dışı bırakma',
|
||||
SCHEDULER_HELP_1: 'Komutları zamanlayarak otomatikleştirin',
|
||||
SCHEDULER_HELP_2: 'Başlangıçta bir kere tetiklemek için 00:00 kullanın',
|
||||
SCHEDULE: 'Zamanlama',
|
||||
TIME: 'Zaman',
|
||||
TIMER: 'Zamanlayıcı',
|
||||
ONCHANGE: 'Değişimde',
|
||||
CONDITION: 'Durum',
|
||||
IMMEDIATE: 'hemen',
|
||||
SCHEDULE_UPDATED: 'Zamanlama güncellendi',
|
||||
SCHEDULE_TIMER_1: 'Başlangıçta',
|
||||
SCHEDULE_TIMER_2: 'her dakikada',
|
||||
@@ -365,7 +364,10 @@ const tr: Translation = {
|
||||
WARNING_SYSTEM_BACKUP: 'Bu, sistem yapılandırmanızı ve ayarlarınızın bir yedeklemesi oluşturacaktır. Tüm şifreler yedekleme dosyasında okunabilir olacaktır. Paylaşırken dikkatli olun! Devam etmek istediğinize emin misiniz?',
|
||||
TEST_EMAIL_SUCCESSFUL: 'Test email başarıyla gönderildi',
|
||||
SYSTEM_NAME: 'Sistem Adı',
|
||||
EXECUTE_SCHEDULE_SENT: 'Zamanlama başarıyla uygulandı'
|
||||
COMMANDS: 'Komutlar',
|
||||
COMMANDS_UPDATED: 'Komutlar güncellendi',
|
||||
COMMANDS_HELP_1: 'Özel komutları EMS hattına tanımlayın',
|
||||
EXECUTE_COMMAND_SENT: 'Komut başarıyla çalıştırıldı.',
|
||||
};
|
||||
|
||||
export default tr;
|
||||
|
||||
Reference in New Issue
Block a user