From fe17411406ef1c1d70a5642d282c565d132e5c15 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 8 Jun 2024 15:07:25 +0200 Subject: [PATCH 1/6] default mqtt format is 3 (for 3.6) --- src/default_settings.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/default_settings.h b/src/default_settings.h index efabd8972..0f5661112 100644 --- a/src/default_settings.h +++ b/src/default_settings.h @@ -218,7 +218,7 @@ #endif #ifndef EMSESP_DEFAULT_ENTITY_FORMAT -#define EMSESP_DEFAULT_ENTITY_FORMAT 1 // in MQTT discovery, use shortnames and not multiple (prefixed with base) +#define EMSESP_DEFAULT_ENTITY_FORMAT 3 // in MQTT discovery, single instance, shortname, v3.6 #endif // matches Web UI settings From e9bba003afebe54581eeece1f154b8a9be2a3f9a Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 8 Jun 2024 15:08:21 +0200 Subject: [PATCH 2/6] change title --- interface/src/project/ModulesDialog.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/interface/src/project/ModulesDialog.tsx b/interface/src/project/ModulesDialog.tsx index f3293ab7a..f8479015a 100644 --- a/interface/src/project/ModulesDialog.tsx +++ b/interface/src/project/ModulesDialog.tsx @@ -55,9 +55,7 @@ const ModulesDialog = ({ return ( - - {LL.EDIT() + ' ' + LL.MODULES() + ' : ' + editItem.key} - + {LL.EDIT() + ' ' + editItem.key} Date: Sat, 8 Jun 2024 15:08:31 +0200 Subject: [PATCH 3/6] adjust modules text --- interface/src/i18n/de/index.ts | 2 +- interface/src/i18n/en/index.ts | 2 +- interface/src/i18n/fr/index.ts | 2 +- interface/src/i18n/it/index.ts | 2 +- interface/src/i18n/no/index.ts | 2 +- interface/src/i18n/pl/index.ts | 2 +- interface/src/i18n/sk/index.ts | 2 +- interface/src/i18n/sv/index.ts | 2 +- interface/src/i18n/tr/index.ts | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index 7f1e5569c..3d9400fac 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -327,7 +327,7 @@ const de: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', // TODO translate MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index d7763d269..8d75dc146 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -327,7 +327,7 @@ const en: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', MODULES: 'Modules', MODULES_UPDATED: 'Modules updated', - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', MODULES_NONE: 'No external modules detected' }; diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index 78eed56de..0d46fcbe9 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -327,7 +327,7 @@ const fr: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', // TODO translate MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 81b005740..280ec5f91 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -327,7 +327,7 @@ const it: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', // TODO translate MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts index 77178012d..33d548bce 100644 --- a/interface/src/i18n/no/index.ts +++ b/interface/src/i18n/no/index.ts @@ -327,7 +327,7 @@ const no: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', // TODO translate MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index 879abace2..e31b8ff60 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -327,7 +327,7 @@ const pl: BaseTranslation = { UPLOAD_DOWNLOAD_1: 'Wysyłanie/pobieranie ustawień i firmware', MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index 346396c33..c4c65ce65 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -327,7 +327,7 @@ const sk: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', // TODO translate MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index 533076383..5f06f30c8 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -327,7 +327,7 @@ const sv: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', // TODO translate MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index b0a85d26e..15c2b1e33 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -327,7 +327,7 @@ const tr: Translation = { UPLOAD_DOWNLOAD_1: 'Upload/Download Settings and Firmware', // TODO translate MODULES: 'Module', // TODO translate MODULES_UPDATED: 'Modules updated', // TODO translate - MODULES_DESCRIPTION: 'Click on the Module to Activate or de-activate EMS-ESP library modules', // TODO translate + MODULES_DESCRIPTION: 'Click on the Module to activate or de-activate EMS-ESP library modules', // TODO translate MODULES_NONE: 'No external modules detected' // TODO translate }; From 23fe7f6ad3ab0ed62b0b0f887de2467427b4b5b9 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 8 Jun 2024 15:08:40 +0200 Subject: [PATCH 4/6] remove Restart --- interface/src/project/Modules.tsx | 88 +++++++++---------------------- 1 file changed, 26 insertions(+), 62 deletions(-) diff --git a/interface/src/project/Modules.tsx b/interface/src/project/Modules.tsx index d60589721..6d639ba48 100644 --- a/interface/src/project/Modules.tsx +++ b/interface/src/project/Modules.tsx @@ -5,12 +5,9 @@ import { toast } from 'react-toastify'; import CancelIcon from '@mui/icons-material/Cancel'; import CircleIcon from '@mui/icons-material/Circle'; -import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew'; import WarningIcon from '@mui/icons-material/Warning'; import { Box, Button, Typography } from '@mui/material'; -import * as SystemApi from 'api/system'; - import { Body, Cell, @@ -26,11 +23,9 @@ import { BlockNavigation, ButtonRow, FormLoader, - MessageBox, SectionContent, useLayoutTitle } from 'components'; -import RestartMonitor from 'framework/system/RestartMonitor'; import { useI18nContext } from 'i18n/i18n-react'; import * as EMSESP from './api'; @@ -40,13 +35,10 @@ import type { ModuleItem, Modules } from './types'; const Modules: FC = () => { const { LL } = useI18nContext(); const [numChanges, setNumChanges] = useState(0); - const [licenseChanges, setLicenseChanges] = useState(0); const blocker = useBlocker(numChanges !== 0); const [selectedModuleItem, setSelectedModuleItem] = useState(); const [dialogOpen, setDialogOpen] = useState(false); - const [restarting, setRestarting] = useState(false); - const [restartNeeded, setRestartNeeded] = useState(false); const { data: modules, @@ -56,17 +48,6 @@ const Modules: FC = () => { initialData: [] }); - const { send: restartCommand } = useRequest(SystemApi.restart(), { - immediate: false - }); - - const restart = async () => { - await restartCommand().catch((error: Error) => { - toast.error(error.message); - }); - setRestarting(true); - }; - const { send: writeModules } = useRequest( (data: Modules) => EMSESP.writeModules(data), { @@ -140,17 +121,12 @@ const Modules: FC = () => { return mi.enabled !== mi.o_enabled || mi.license !== mi.o_license; } - function hasModuleLicenseChanged(mi: ModuleItem) { - return mi.license !== mi.o_license; - } - const updateModuleItem = (updatedItem: ModuleItem) => { updateState('modules', (data: ModuleItem[]) => { const new_data = data.map((mi) => mi.id === updatedItem.id ? { ...mi, ...updatedItem } : mi ); setNumChanges(new_data.filter((mi) => hasModulesChanged(mi)).length); - setLicenseChanges(new_data.filter((mi) => hasModuleLicenseChanged(mi)).length); return new_data; }); }; @@ -172,7 +148,6 @@ const Modules: FC = () => { .finally(() => { setNumChanges(0); }); - setRestartNeeded(licenseChanges > 0); }; const renderContent = () => { @@ -213,8 +188,10 @@ const Modules: FC = () => { {LL.NAME(0)} + {/* TODO translate */} Author {LL.VERSION()} + {/* TODO translate */} Message {LL.STATUS_OF('')} @@ -247,43 +224,30 @@ const Modules: FC = () => { )} - {restartNeeded ? ( - - - - ) : ( - - - {numChanges !== 0 && ( - - - - - )} - + + + {numChanges !== 0 && ( + + + + + )} - )} + ); }; @@ -291,7 +255,7 @@ const Modules: FC = () => { return ( {blocker ? : null} - {restarting ? : renderContent()} + {renderContent()} {selectedModuleItem && ( Date: Sat, 8 Jun 2024 15:08:48 +0200 Subject: [PATCH 5/6] update example --- pio_local.ini_example | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pio_local.ini_example b/pio_local.ini_example index 93138ea55..a066fe722 100644 --- a/pio_local.ini_example +++ b/pio_local.ini_example @@ -11,13 +11,13 @@ ; -DEMSESP_DE_ONLY ; only DE translated entity names ; -DEMSESP_EN_ONLY ; only EN translated entity names ; -DEMSESP_PINGTEST ; send log message every 1/2 second -; my_build_flags = -DEMSESP_TEST +my_build_flags = -DEMSESP_TEST ; my_build_flags = -DEMSESP_DEBUG -DEMSESP_TEST ; my_build_flags = -DEMSESP_DEBUG -DEMSESP_TEST -DEMSESP_PINGTEST [platformio] -default_envs = esp32_4M -; default_envs = esp32_16M +; default_envs = esp32_4M +default_envs = esp32_16M ; default_envs = lolin_s3 ; default_envs = native ; default_envs = debug @@ -26,10 +26,10 @@ default_envs = esp32_4M [env] ; upload settings ; for USB -; upload_protocol = esptool -; upload_port = /dev/ttyUSB* -; for OTA -upload_protocol = custom +upload_protocol = esptool +upload_port = /dev/ttyUSB* +; for OTA add scripts/upload.py to extra_scripts +; upload_protocol = custom custom_emsesp_ip = 10.10.10.173 ; custom_emsesp_ip = ems-esp.local custom_username = admin @@ -39,7 +39,6 @@ custom_password = admin lib_deps = file://../../modules/EMS-ESP-Modules bblanchon/ArduinoJson@^7.0.4 - https://github.com/mathieucarbou/AsyncTCP.git ; based on ESPHome [env:native] extra_scripts = @@ -54,10 +53,16 @@ extra_scripts = [env:lolin_s3] extra_scripts = -; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time + pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time scripts/rename_fw.py scripts/upload.py +[env:esp32_16M] +extra_scripts = +; pre:scripts/build_interface.py ; comment out if you don't want to re-build the WebUI each time + scripts/rename_fw.py +; scripts/upload.py + [env:custom] ; use for basic ESP boards with 4MB flash ; make sure -D TASMOTA_SDK is also enabled From 9d64282c0b88657d4abf19c6f19b9db80c011258 Mon Sep 17 00:00:00 2001 From: proddy Date: Sat, 8 Jun 2024 15:08:58 +0200 Subject: [PATCH 6/6] remove debug comment --- src/web/WebModulesService.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/web/WebModulesService.cpp b/src/web/WebModulesService.cpp index 3f00b6330..38835e2b1 100644 --- a/src/web/WebModulesService.cpp +++ b/src/web/WebModulesService.cpp @@ -50,7 +50,6 @@ void WebModulesService::loop() { // it adds data to an empty 'root' json object // and also calls when the Modules web page is refreshed/loaded void WebModules::read(WebModules & webModules, JsonObject root) { - emsesp_->logger().err("debug: in WebModules::read()"); // TODO remove JsonDocument doc_modules; JsonObject root_modules = doc_modules.to(); moduleLibrary.list(root_modules); // get list the external library modules, put in a json object