diff --git a/src/App.svelte b/src/App.svelte index 05d5b52..47a09d8 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -26,7 +26,7 @@ let version = 401; let debug = true; let LOG_MAX_MESSAGES = 10; - let reconnectTimeout = 30000; + let reconnectTimeout = 20000; let rebootingTimeout = 20000; let opened = false; let preventMove = false; @@ -785,6 +785,16 @@ myTimeout = setTimeout(rebootingTask, rebootingTimeout); } + function mqttConnect() { + errorsJson.mqtt = 8; + console.log("[i]", settingsJson); + wsSendMsg(selectedWs, "/sgnittes|" + JSON.stringify(settingsJson)); + //wsSendMsg(selectedWs, '/rorre|{"mqtt":8}'); + wsSendMsg(selectedWs, "/mqtt|"); + clearData(); + sendCurrentPageName(); + } + function rebootingTask() { clearTimeout(myTimeout); connectToAllDevices(); @@ -887,7 +897,7 @@ saveConfig()} /> - rebootEsp()} ssidDropdownClick={() => ssidDropdownClick()} saveSettings={() => saveSettings()} /> + rebootEsp()} ssidDropdownClick={() => ssidDropdownClick()} saveSettings={() => saveSettings()} mqttConnect={() => mqttConnect()} /> rebootEsp()} cancelAlarm={(alarmKey) => cancelAlarm(alarmKey)} version={version} /> @@ -938,15 +948,9 @@ .crd-itm-psn { @apply flex mb-3 h-8 items-center; } - .wgt-dscr-w { - @apply w-2/3; - } .wgt-dscr-stl { @apply pr-4 text-gray-500 font-bold; } - .wgt-w { - @apply flex justify-end w-1/3; - } /*====================================================others=====================================================*/ .btn-i { @apply py-2 px-4 bg-indigo-500 text-white font-semibold rounded-lg shadow-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-400 focus:ring-opacity-75; diff --git a/src/components/Alarm.svelte b/src/components/Alarm.svelte index 726a60f..398920c 100644 --- a/src/components/Alarm.svelte +++ b/src/components/Alarm.svelte @@ -1,20 +1,20 @@
- {#if title} + {#if title && !cross} +

{title}

+ {:else if title && cross}

{title}

- {#if showCloseBtn} - close()} /> - {/if} + close()} />
{/if} @@ -31,7 +31,7 @@ @apply mb-2 w-full p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-2 2xl:px-4 2xl:py-2 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg; } .alm-hdr { - @apply text-center text-base text-red-500 pb-0; + @apply text-center text-base text-red-400 font-bold pb-0; } } diff --git a/src/components/Card.svelte b/src/components/Card.svelte index 7c36e16..38f615c 100644 --- a/src/components/Card.svelte +++ b/src/components/Card.svelte @@ -1,22 +1,10 @@
- {#if title && !cloud} + {#if title}

{title}

- {:else if title && cloud} -
-
-

{title}

-
-
- -
-
{/if}
@@ -28,7 +16,7 @@ @layer components { .crd { - @apply w-full mb-2 p-2 sm:p-2 md:p-2 lg:p-2 xl:px-8 xl:py-4 2xl:px-8 2xl:py-4 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg; + @apply w-full mb-2 p-2 sm:p-2 md:p-2 lg:p-2 xl:px-4 xl:py-4 2xl:px-4 2xl:py-4 bg-white shadow-md lg:shadow-lg border border-gray-200 rounded-lg; } .crd-hdr { @apply text-center text-lg text-gray-500 font-bold pb-4; diff --git a/src/pages/Connection.svelte b/src/pages/Connection.svelte index 2fbfc7e..b8a8392 100644 --- a/src/pages/Connection.svelte +++ b/src/pages/Connection.svelte @@ -3,115 +3,142 @@ import Alarm from "../components/Alarm.svelte"; export let settingsJson; + //export let settingsJsonParced; export let errorsJson; + //export let errorsJsonParced; export let ssidJson; - let mqttConnected = true; + //export let ssidJsonParced; + + let promise = 0; + let next = (value) => new Promise((resolve) => setTimeout(() => resolve(++value), 500)); + export let ssidDropdownClick = () => {}; export let saveSettings = () => {}; + export let mqttConnect = () => {}; export let rebootEsp = () => {}; -
- -
-
-

Название устройства

+{#await promise} +

...

+{:then result} +
+ +
+
+

Название устройства

+
+
+ +
-
- +
+
+

Точка доступа

+
+
+ +
-
-
-
-

Точка доступа

+
+
+

Пароль точки доступа

+
+
+ +
-
- +
+
+

Название wifi сети

+
+
+ +
-
-
-
-

Пароль точки доступа

+
+
+

Пароль

+
+
+ +
-
- + {#if errorsJson.passer === 1} +
+ +
+ {/if} + + + + + +
+
+

Состояние подключения

+
+
+ {#if errorsJson.mqtt === 0} +

Подключено

+ {:else if errorsJson.mqtt === 8} +

Подключение

+ {:else} +

Ошибка

+ {/if} +
-
-
-
-

Название wifi сети

+
+
+

Название сервера

+
+
+ +
-
- +
+
+

Порт

+
+
+ +
-
-
-
-

Пароль

+
+
+

Префикс

+
+
+ +
-
- +
+
+

Имя пользователя

+
+
+ +
-
- {#if errorsJson.passer === 1} -
- +
+
+

Пароль

+
+
+ +
- {/if} - - - -
-
-

Название сервера

-
-
- -
-
-
-
-

Порт

-
-
- -
-
-
-
-

Префикс

-
-
- -
-
-
-
-

Имя пользователя

-
-
- -
-
-
-
-

Пароль

-
-
- -
-
- -
-
-
- - - -
+ + +
+
+ + + +
+{/await} diff --git a/src/pages/System.svelte b/src/pages/System.svelte index 34114d5..06abdfd 100644 --- a/src/pages/System.svelte +++ b/src/pages/System.svelte @@ -73,21 +73,23 @@
+ {#if errorsJson.wscle === 1} - cancelAlarm("wscle")}> + cancelAlarm("wscle")}>

Слишком много клиентов было открыто. Допускается не более четырех.

{/if} {#if errorsJson.jsbuf === 1} - cancelAlarm("jsbuf")}> + cancelAlarm("jsbuf")}>

Недостаточный размер буфера библиотеки Arduino Json. Устройство может вести себя непредсказуемо. Обратитесь к разработчику

{/if} {#if errorsJson.jserr > 0} - cancelAlarm("jserr")}> + cancelAlarm("jserr")}>

Ошибка записи/чтения json. Устройство может вести себя непредсказуемо. Количество ошибок: {errorsJson.jserr}. Обратитесь к разработчику.

{/if} + {#if errorsJson.bver != version}

Версия файловой системы не совпадает с версией прошивки. Вероятно произошла ошибка во время обновления устройства по воздуху.

@@ -98,6 +100,62 @@

Уровень сигнала WiFi предельно низкий, веб интерфейс может работать со сбоями и потерей данных, рекомендуется переместить устройство ближе к роутеру

{/if} + + {#if errorsJson.mqtt === -4} + +

Нет ответа от сервера

+
+ {/if} + {#if errorsJson.mqtt === -3} + +

Соединение было разорвано

+
+ {/if} + {#if errorsJson.mqtt === -2} + +

Ошибка соединения. Обычно возникает когда неверно указано название сервера MQTT

+
+ {/if} + {#if errorsJson.mqtt === -1} + +

Клиент был отключен

+
+ {/if} + {#if errorsJson.mqtt === 1} + +

Ошибка версии

+
+ {/if} + {#if errorsJson.mqtt === 2} + +

Отклонен идентификатор

+
+ {/if} + {#if errorsJson.mqtt === 3} + +

Не могу установить соединение

+
+ {/if} + {#if errorsJson.mqtt === 4} + +

Неправильное имя пользователя/пароль

+
+ {/if} + {#if errorsJson.mqtt === 5} + +

Не авторизован для подключения

+
+ {/if} + {#if errorsJson.mqtt === 6} + +

Название сервера пустое

+
+ {/if} + {#if errorsJson.mqtt === 7} + +

Имя пользователя или пароль пустые

+
+ {/if}
diff --git a/src/svg/Cloud.svelte b/src/svg/Cloud.svelte index 3e36a1e..3db6367 100644 --- a/src/svg/Cloud.svelte +++ b/src/svg/Cloud.svelte @@ -1,7 +1,9 @@ - - + + diff --git a/src/svg/Cross.svelte b/src/svg/Cross.svelte index 8480c29..e5f58b8 100644 --- a/src/svg/Cross.svelte +++ b/src/svg/Cross.svelte @@ -2,6 +2,6 @@ export let click = () => {}; - + diff --git a/src/svg/Open.svelte b/src/svg/Open.svelte index 12fc3ee..c5ddcba 100644 --- a/src/svg/Open.svelte +++ b/src/svg/Open.svelte @@ -2,4 +2,4 @@ export let click = () => {}; - + diff --git a/src/widgets/Anydata.svelte b/src/widgets/Anydata.svelte index 6af47d7..96a1e33 100644 --- a/src/widgets/Anydata.svelte +++ b/src/widgets/Anydata.svelte @@ -5,11 +5,11 @@
-
+
-
+
diff --git a/src/widgets/Input.svelte b/src/widgets/Input.svelte index 68897ae..857154c 100644 --- a/src/widgets/Input.svelte +++ b/src/widgets/Input.svelte @@ -6,11 +6,11 @@
-
+
-
+
{#if widget.type == "number"} ((widget["send"] = true), wsPush(widget.ws, widget.topic, widget.status))} bind:value={widget.status} step="0.1" type="number" /> {/if} diff --git a/src/widgets/Toggle.svelte b/src/widgets/Toggle.svelte index 56f263d..b8b7c60 100644 --- a/src/widgets/Toggle.svelte +++ b/src/widgets/Toggle.svelte @@ -6,11 +6,11 @@
-
+
-
+