diff --git a/interface/src/app/main/api.ts b/interface/src/app/main/api.ts index 7f123c7b6..b2c4bd0d0 100644 --- a/interface/src/app/main/api.ts +++ b/interface/src/app/main/api.ts @@ -50,9 +50,6 @@ export const writeAnalogSensor = (as: WriteAnalogSensor) => // Activity export const readActivity = () => alovaInstance.Get('/rest/activity'); -// Scan devices -export const scanDevices = () => alovaInstance.Post('/rest/scanDevices'); - // API, used in HelpInformation export const API = (apiCall: APIcall) => alovaInstance.Post('/api', apiCall); diff --git a/interface/src/app/status/Activity.tsx b/interface/src/app/status/Activity.tsx index 84c5199be..1caf3ee86 100644 --- a/interface/src/app/status/Activity.tsx +++ b/interface/src/app/status/Activity.tsx @@ -27,7 +27,7 @@ const SystemActivity: FC = () => { const { LL } = useI18nContext(); - useLayoutTitle(LL.EMS_BUS_STATUS()); + useLayoutTitle(LL.DATA_TRAFFIC()); const stats_theme = tableTheme({ Table: ` diff --git a/interface/src/app/status/Status.tsx b/interface/src/app/status/Status.tsx index 0a2db86cf..e3e1f679a 100644 --- a/interface/src/app/status/Status.tsx +++ b/interface/src/app/status/Status.tsx @@ -56,7 +56,6 @@ const SystemStatus: FC = () => { const { me } = useContext(AuthenticatedContext); const [confirmRestart, setConfirmRestart] = useState(false); - const [confirmScan, setConfirmScan] = useState(false); const [processing, setProcessing] = useState(false); const [restarting, setRestarting] = useState(); @@ -74,10 +73,6 @@ const SystemStatus: FC = () => { error } = useRequest(SystemApi.readSystemStatus, { force: true }); - const { send: scanDevices } = useRequest(EMSESP.scanDevices, { - immediate: false - }); - const theme = useTheme(); const formatDurationSec = (duration_sec: number) => { @@ -108,14 +103,20 @@ const SystemStatus: FC = () => { if (data) { switch (data.status) { case busConnectionStatus.BUS_STATUS_CONNECTED: - return LL.CONNECTED(0) + ' (' + formatDurationSec(data.bus_uptime) + ')'; + return ( + 'EMS ' + + LL.CONNECTED(0) + + ' (' + + formatDurationSec(data.bus_uptime) + + ')' + ); case busConnectionStatus.BUS_STATUS_TX_ERRORS: - return LL.TX_ISSUES(); + return 'EMS ' + LL.TX_ISSUES(); case busConnectionStatus.BUS_STATUS_OFFLINE: - return LL.DISCONNECTED(); + return 'EMS ' + LL.DISCONNECTED(); } } - return 'Unknown'; + return 'EMS state unknown'; }; const busStatusHighlight = () => { @@ -200,46 +201,6 @@ const SystemStatus: FC = () => { const activeHighlight = (value: boolean) => value ? theme.palette.success.main : theme.palette.info.main; - const scan = async () => { - await scanDevices() - .then(() => { - toast.info(LL.SCANNING() + '...'); - }) - .catch((error: Error) => { - toast.error(error.message); - }); - setConfirmScan(false); - }; - - const renderScanDialog = () => ( - setConfirmScan(false)} - > - {LL.SCAN_DEVICES()} - {LL.EMS_SCAN()} - - - - - - ); - const restart = async () => { setProcessing(true); await restartCommand() @@ -318,56 +279,6 @@ const SystemStatus: FC = () => { return ( <> - - - - - - - - {me.admin && ( - - )} - - - - - - - - - - {me.admin && ( - - )} - - @@ -390,11 +301,33 @@ const SystemStatus: FC = () => { )} + + + + + + + + {me.admin && ( + + )} + + @@ -458,7 +391,6 @@ const SystemStatus: FC = () => { /> - {renderScanDialog()} {renderRestartDialog()} diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index 095e75bbe..f0405f0a3 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -71,13 +71,11 @@ const de: Translation = { TX_ISSUES: 'Tx-Probleme - versuchen Sie einen anderen Tx-Modus', DISCONNECTED: 'Getrennt', EMS_SCAN: 'Möchten Sie wirklich eine vollständige Gerätesuche des EMS-Busses starten?', - EMS_BUS_STATUS: 'EMS-Busstatus', - ACTIVE_DEVICES: 'Aktive Geräte und Sensoren', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'EMS Gerät', SUCCESS: 'ERFOLG', FAIL: 'FEHLER', QUALITY: 'QUALITÄT', - SCAN_DEVICES: 'Nach neuen Geräten suchen', SCAN: 'Suche', STATUS_NAMES: [ 'EMS-Telegramme empfangen (Rx)', @@ -89,9 +87,6 @@ const de: Translation = { 'API-Aufrufe', 'Syslog-Mitteilungen' ], - NUM_DEVICES: '{num} Gerät{{e}}', - NUM_TEMP_SENSORS: '{num} Temperatursensor{{en}}', - NUM_ANALOG_SENSORS: '{num} Analogsensor{{en}}', NUM_DAYS: '{num} Tag{{e}}', NUM_SECONDS: '{num} Sekunde{{n}}', NUM_HOURS: '{num} Stunde{{n}}', diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index 6cf6791bd..78086b8ff 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -71,13 +71,11 @@ const en: Translation = { TX_ISSUES: 'Tx issues - check Tx Mode', DISCONNECTED: 'Disconnected', EMS_SCAN: 'Are you sure you want to initiate a full device scan of the EMS bus?', - EMS_BUS_STATUS: 'EMS Bus Status', - ACTIVE_DEVICES: 'Active Devices & Sensors', + DATA_TRAFFIC: 'Data Traffic', EMS_DEVICE: 'EMS Device', SUCCESS: 'SUCCESS', FAIL: 'FAIL', QUALITY: 'QUALITY', - SCAN_DEVICES: 'Scan for new devices', SCAN: 'Scan', STATUS_NAMES: [ 'EMS Telegrams Received (Rx)', @@ -89,9 +87,6 @@ const en: Translation = { 'API Calls', 'Syslog Messages' ], - NUM_DEVICES: '{num} Device{{s}}', - NUM_TEMP_SENSORS: '{num} Temperature Sensor{{s}}', - NUM_ANALOG_SENSORS: '{num} Analog Sensor{{s}}', NUM_DAYS: '{num} day{{s}}', NUM_SECONDS: '{num} second{{s}}', NUM_HOURS: '{num} hour{{s}}', diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index 91eba1fc2..7a6d8c7fa 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -71,13 +71,11 @@ const fr: Translation = { TX_ISSUES: 'Problèmes de transmission (Tx) - Essayez un autre mode Tx', DISCONNECTED: 'Déconnecté', EMS_SCAN: 'Etes-vous sûr de vouloir lancer un scan complet du bus EMS ?', - EMS_BUS_STATUS: 'Statut du bus EMS', - ACTIVE_DEVICES: 'Appareils et capteurs actifs', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'Appareils EMS', SUCCESS: 'SUCCÈS', FAIL: 'ÉCHEC', QUALITY: 'QUALITÉ', - SCAN_DEVICES: 'Rechercher de nouveaux appareils', SCAN: 'Scan', STATUS_NAMES: [ 'Télégrammes EMS reçus (Rx)', @@ -89,9 +87,6 @@ const fr: Translation = { "Appels à l'API", 'Messages Syslog' ], - NUM_DEVICES: '{num} Appareil{{s}}', - NUM_TEMP_SENSORS: '{num} Capteur{{s}} de température', - NUM_ANALOG_SENSORS: '{num} Capteur{{s}} analogique{{s}}', NUM_DAYS: '{num} jour{{s}}', NUM_SECONDS: '{num} seconde{{s}}', NUM_HOURS: '{num} heure{{s}}', diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index f7d4b5866..ac0b40a65 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -71,13 +71,11 @@ const it: Translation = { TX_ISSUES: 'Problema di Tx - prova una modalità differente', DISCONNECTED: 'Disconnesso', EMS_SCAN: 'Sei sicuro di voler iniziare una scansione completa del bus EMS ?', - EMS_BUS_STATUS: 'Stato Bus EMS', - ACTIVE_DEVICES: 'Dispositivi & sensori attivi', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'Dispositivo EMS ', SUCCESS: 'SUCCESSO', FAIL: 'FALLITO', QUALITY: 'QUALITÂ', - SCAN_DEVICES: 'Scansione per nuovi dispositivi', SCAN: 'Scansione', STATUS_NAMES: [ 'Telegrammi EMS Ricevuti (Rx)', @@ -89,9 +87,6 @@ const it: Translation = { 'Chiamate API', 'Messaggi Syslog' ], - NUM_DEVICES: '{num} Dispositivi {{s}}', - NUM_TEMP_SENSORS: '{num} Sensori Temperatura {{s}}', - NUM_ANALOG_SENSORS: '{num} Sensori Analogici {{s}}', NUM_DAYS: '{num} giorni {{s}}', NUM_SECONDS: '{num} secondi {{s}}', NUM_HOURS: '{num} ore {{s}}', diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index cbdf41b41..68f7a7f0e 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -71,13 +71,11 @@ const nl: Translation = { TX_ISSUES: 'Tx bus probleem. Probeer een andere Tx verzendmodus', DISCONNECTED: 'Niet verbonden', EMS_SCAN: 'Weet je zeker dat je een volledige EMS bus scan uit wilt voeren?', - EMS_BUS_STATUS: 'EMS busstatus', - ACTIVE_DEVICES: 'Actieve Apparaten & Sensoren', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'EMS Apparaat', SUCCESS: 'SUCCESS', FAIL: 'MISLUKT', QUALITY: 'QUALITEIT', - SCAN_DEVICES: 'Scannen naar nieuwe apparaten', SCAN: 'Scan', STATUS_NAMES: [ 'EMS Telegrammen ontvangen (Rx)', @@ -89,9 +87,6 @@ const nl: Translation = { 'API calls', 'Syslog berichten' ], - NUM_DEVICES: '{num} Apparaat{{en}}', - NUM_TEMP_SENSORS: '{num} Temperatuursensor{{en}}', - NUM_ANALOG_SENSORS: '{num} Analoge sensor{{en}}', NUM_DAYS: '{num} dag{{en}}', NUM_SECONDS: '{num} second{{en}}', NUM_HOURS: '{num} {{uur|uren}}', diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts index 315043a67..64b213371 100644 --- a/interface/src/i18n/no/index.ts +++ b/interface/src/i18n/no/index.ts @@ -71,13 +71,11 @@ const no: Translation = { TX_ISSUES: 'Tx problemer - prøv en annen Tx Modus', DISCONNECTED: 'Frakoblet', EMS_SCAN: 'Er du sikker på du vil starte full søking av EMS bussen?', - EMS_BUS_STATUS: 'EMS Buss Status', - ACTIVE_DEVICES: 'Aktive Enheter og Sensorer', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'EMS Enhet', SUCCESS: 'VELLYKKET', FAIL: 'MISLYKKET', QUALITY: 'KVALITET', - SCAN_DEVICES: 'Søk etter nye enheter', SCAN: 'Søk', STATUS_NAMES: [ 'EMS Telegrammer Mottatt (Rx)', @@ -89,9 +87,6 @@ const no: Translation = { 'API Anrop', 'Syslog Meldinger' ], - NUM_DEVICES: '{num} Enhet{{er}}', - NUM_TEMP_SENSORS: '{num} Temperatursensor{{er}}', - NUM_ANALOG_SENSORS: '{num} Analogsensor{{er}}', NUM_DAYS: '{num} Dag{{er}}', NUM_SECONDS: '{num} Sekund{{er}}', NUM_HOURS: '{num} Time{{r}}', diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index 834b60b25..1801513ab 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -71,13 +71,11 @@ const pl: BaseTranslation = { TX_ISSUES: 'problem z zapisem na magistralę EMS, spróbuj wybrać inny "Tryb transmisji (Tx)"', DISCONNECTED: 'brak połączenia', EMS_SCAN: 'Czy na pewno wykonać pełne skanowanie magistrali EMS?', - EMS_BUS_STATUS: 'Status magistrali EMS', - ACTIVE_DEVICES: 'Aktywne urządzenia i czujniki', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'Urządzenie EMS', SUCCESS: 'Udane', FAIL: 'Nieudane', QUALITY: 'Jakość', - SCAN_DEVICES: 'Wyszukiwanie nowych urządzeń', SCAN: 'Skanuj', STATUS_NAMES: [ 'EMS, telegramy odebrane (Rx)', @@ -89,9 +87,6 @@ const pl: BaseTranslation = { 'Wywołania API', 'Wpisy w SysLog' ], - NUM_DEVICES: '{num} urządze{{ń|nie|nia|nia|ń}} EMS', - NUM_TEMP_SENSORS: '{num} czujni{{ków|k|ki|ki|ków}} temperatury', - NUM_ANALOG_SENSORS: '{num} inn{{ych|e|e|e|ych}} urządze{{ń|nie|nia(two)|nia|ń}} podłączon{{ych|e|e|e|ych}} do EMS-ESP', NUM_DAYS: '{num} d{{ni|zień|ni|ni|ni}}', NUM_SECONDS: '{num} sekun{{d|da|dy|dy|d}}', NUM_HOURS: '{num} godzi{{n|na|ny|ny|n}}', diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index df5ce744d..62c991461 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -71,13 +71,11 @@ const sk: Translation = { TX_ISSUES: 'Problémy s Tx – skontrolujte Tx režim', DISCONNECTED: 'Odpojené', EMS_SCAN: 'Naozaj chcete spustiť úplnú kontrolu zariadenia zbernice EMS?', - EMS_BUS_STATUS: 'Stav zbernice EMS', - ACTIVE_DEVICES: 'Aktívne zariadenia a snímače', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'EMS zariadenie', SUCCESS: 'ÚSPEŠNÉ', FAIL: 'ZLÝHANIE', QUALITY: 'KVALITA', - SCAN_DEVICES: 'Scan pre nové zariadenia', SCAN: 'Scan', STATUS_NAMES: [ 'EMS Telegramy prijaté (Rx)', @@ -89,9 +87,6 @@ const sk: Translation = { 'Externé API volania', 'Syslog správy' ], - NUM_DEVICES: '{num} Zariaden{{í|ie|ia|ia|í|í}}', - NUM_TEMP_SENSORS: '{num} Teplotn{{ých|ý|é|é|ých|ých}} sníma{{čov|č|če|če|čov|čov}}', - NUM_ANALOG_SENSORS: '{num} Analogov{{ých|ý|é|é|ých|ých}} sníma{{čov|č|če|če|čov|čov}}', NUM_DAYS: '{num} d{{ní|eň|ní|ní|ní|ní}}', NUM_SECONDS: '{num} sek{{únd|unda|undy|undy|únd|únd}}', NUM_HOURS: '{num} hod{{ín|ina|iny|iny|ín|ín}}', diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index ec06fb2cf..6026de769 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -71,13 +71,11 @@ const sv: Translation = { TX_ISSUES: 'Sändfel - Prova ett annat TX-läge', DISCONNECTED: 'Nedkopplad', EMS_SCAN: 'Är du säker att du vill initiera en full genomsökning av EMS-bussen?', - EMS_BUS_STATUS: 'Status', - ACTIVE_DEVICES: 'Aktiva Enheter', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'EMS Enhet', SUCCESS: 'Lyckades', FAIL: 'Misslyckades', QUALITY: 'Kvalitet', - SCAN_DEVICES: 'Sök efter nya enheter', SCAN: 'Sök', STATUS_NAMES: [ 'EMS-telegram (Rx)', @@ -89,9 +87,6 @@ const sv: Translation = { 'API-anrop', 'Syslog-meddelanden' ], - NUM_DEVICES: '{num} Enhet{{er}}', - NUM_TEMP_SENSORS: '{num} Temperatur-sensor{{er}}', - NUM_ANALOG_SENSORS: '{num} Analoga Sensor{{er}}', NUM_DAYS: '{num} dag{{ar}}', NUM_SECONDS: '{num} sekund{{er}}', NUM_HOURS: '{num} timmar', diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index 1616a09c6..07c7b1f84 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -71,13 +71,11 @@ const tr: Translation = { TX_ISSUES: 'Tx sorunu - başka bir Tx Modu deneyin', DISCONNECTED: 'Bağlantı kesildi', EMS_SCAN: 'EMS Hattında tam bir cihaz taraması başlatmak istediğinizden emin misiniz?', - EMS_BUS_STATUS: 'EMS Hattı Durumu', - ACTIVE_DEVICES: 'Aktif Cihazlar ve Sensörler', + DATA_TRAFFIC: 'Data Traffic', // TODO Translate EMS_DEVICE: 'EMS Cihazı', SUCCESS: 'BAŞARILI', FAIL: 'HATA', QUALITY: 'KALİTE', - SCAN_DEVICES: 'Yeni cihaz taraması', SCAN: 'Tara', STATUS_NAMES: [ 'EMS Telegramlar Alındı (Rx)', @@ -89,9 +87,6 @@ const tr: Translation = { 'API Aramaları', 'Sistem Kayıt Mesajları' ], - NUM_DEVICES: '{num} Cihaz{{ları}}', - NUM_TEMP_SENSORS: '{num} Sıcaklık Sensör{{leri}}', - NUM_ANALOG_SENSORS: '{num} Analog Sensör{{ler}}', NUM_DAYS: '{num} gün{{ler}}', NUM_SECONDS: '{num} saniye{{ler}}', NUM_HOURS: '{num} saat{{ler}}', diff --git a/mock-api/rest_server.ts b/mock-api/rest_server.ts index 9b860c338..a79e400a6 100644 --- a/mock-api/rest_server.ts +++ b/mock-api/rest_server.ts @@ -425,7 +425,6 @@ const EMSESP_SETTINGS_ENDPOINT = REST_ENDPOINT_ROOT + 'settings'; const EMSESP_CORE_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'coreData'; const EMSESP_SENSOR_DATA_ENDPOINT = REST_ENDPOINT_ROOT + 'sensorData'; const EMSESP_DEVICES_ENDPOINT = REST_ENDPOINT_ROOT + 'devices'; -const EMSESP_SCANDEVICES_ENDPOINT = REST_ENDPOINT_ROOT + 'scanDevices'; const EMSESP_DEVICEDATA_ENDPOINT1 = REST_ENDPOINT_ROOT + 'deviceData'; const EMSESP_DEVICEDATA_ENDPOINT2 = REST_ENDPOINT_ROOT + 'deviceData/:id?'; @@ -4325,8 +4324,6 @@ router return { devices: sorted_devices }; }) - .post(EMSESP_SCANDEVICES_ENDPOINT, () => status(200)) - .get(EMSESP_DEVICEDATA_ENDPOINT1, (request) => request.query.id ? deviceData(Number(request.query.id)) : status(404) ) diff --git a/src/web/WebDataService.cpp b/src/web/WebDataService.cpp index 46c2d26a1..7cfb6b2f0 100644 --- a/src/web/WebDataService.cpp +++ b/src/web/WebDataService.cpp @@ -43,18 +43,6 @@ WebDataService::WebDataService(AsyncWebServer * server, SecurityManager * securi server->on(SENSOR_DATA_SERVICE_PATH, HTTP_GET, securityManager->wrapRequest([this](AsyncWebServerRequest * request) { sensor_data(request); }, AuthenticationPredicates::IS_AUTHENTICATED)); - - // POST's - server->on(SCAN_DEVICES_SERVICE_PATH, - HTTP_POST, - securityManager->wrapRequest([this](AsyncWebServerRequest * request) { scan_devices(request); }, AuthenticationPredicates::IS_ADMIN)); -} - -// scan devices service -void WebDataService::scan_devices(AsyncWebServerRequest * request) { - EMSESP::logger().info("Scanning devices..."); - EMSESP::scan_devices(); - request->send(200); } // this is used in the dashboard and contains all ems device information diff --git a/src/web/WebDataService.h b/src/web/WebDataService.h index f85fbe358..390cb80e9 100644 --- a/src/web/WebDataService.h +++ b/src/web/WebDataService.h @@ -28,7 +28,6 @@ #define WRITE_DEVICE_VALUE_SERVICE_PATH "/rest/writeDeviceValue" #define WRITE_TEMPERATURE_SENSOR_SERVICE_PATH "/rest/writeTemperatureSensor" #define WRITE_ANALOG_SENSOR_SERVICE_PATH "/rest/writeAnalogSensor" -#define SCAN_DEVICES_SERVICE_PATH "/rest/scanDevices" namespace emsesp { @@ -50,7 +49,6 @@ class WebDataService { void write_device_value(AsyncWebServerRequest * request, JsonVariant json); void write_temperature_sensor(AsyncWebServerRequest * request, JsonVariant json); void write_analog_sensor(AsyncWebServerRequest * request, JsonVariant json); - void scan_devices(AsyncWebServerRequest * request); // command }; } // namespace emsesp diff --git a/src/web/WebStatusService.cpp b/src/web/WebStatusService.cpp index 929ec0f97..63cbd1766 100644 --- a/src/web/WebStatusService.cpp +++ b/src/web/WebStatusService.cpp @@ -24,6 +24,7 @@ namespace emsesp { +// /rest/ESPSystemStatus WebStatusService::WebStatusService(AsyncWebServer * server, SecurityManager * securityManager) { server->on(ESPSYSTEM_STATUS_SERVICE_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { ESPsystemStatus(request); }); server->on(SYSTEM_STATUS_SERVICE_PATH, HTTP_GET, [this](AsyncWebServerRequest * request) { systemStatus(request); });