mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 08:19:52 +03:00
add own entities read from ems-bus with free factor
This commit is contained in:
@@ -67,6 +67,19 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const downloadEntities = async () => {
|
||||
try {
|
||||
const response = await EMSESP.getEntities();
|
||||
if (response.status !== 200) {
|
||||
toast.error(LL.PROBLEM_LOADING());
|
||||
} else {
|
||||
saveFile(response.data, 'entities');
|
||||
}
|
||||
} catch (error) {
|
||||
toast.error(extractErrorMessage(error, LL.PROBLEM_LOADING()));
|
||||
}
|
||||
};
|
||||
|
||||
const downloadSchedule = async () => {
|
||||
try {
|
||||
const response = await EMSESP.getSchedule();
|
||||
@@ -125,6 +138,14 @@ const GeneralFileUpload: FC<UploadFileProps> = ({ uploadGeneralFile }) => {
|
||||
>
|
||||
{LL.CUSTOMIZATIONS()}
|
||||
</Button>
|
||||
<Button sx={{ ml: 2 }}
|
||||
startIcon={<DownloadIcon />}
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
onClick={() => downloadEntities()}
|
||||
>
|
||||
{LL.ENTITIES()}
|
||||
</Button>
|
||||
<Box color="warning.main">
|
||||
<Typography mt={2} mb={1} variant="body2">
|
||||
{LL.DOWNLOAD_SCHEDULE_TEXT()}{' '}
|
||||
|
||||
Reference in New Issue
Block a user