diff --git a/data_svelte/config.json b/data_svelte/config.json index 7ced6dcf..583d056b 100644 --- a/data_svelte/config.json +++ b/data_svelte/config.json @@ -1,93 +1,14 @@ [ - { - "type": "Variable", - "subtype": "ButtonOut", - "id": "btn1", - "widget": "toggle", - "page": "Кнопки", - "descr": "Освещение", - "gpio": 13, - "inv": false - }, - { - "type": "Variable", - "subtype": "PwmOut", - "id": "pwm1", - "widget": "range", - "page": "Регуляторы", - "descr": "Освещение", - "gpio": 14, - "inv": false - }, { "type": "Reading", - "subtype": "ButtonIn", - "id": "btn", - "widget": "toggle", - "page": "Кнопки", - "descr": "Освещение", - "gpio": 12, - "inv": false - }, - { - "type": "Reading", - "subtype": "OutputValue", - "id": "txt", - "widget": "anydataRed", - "page": "Предупреждения", - "descr": "Статус" - }, - { - "type": "Reading", - "subtype": "InputValue", - "id": "txt", - "widget": "inputDgt", - "page": "Лимиты", - "descr": "Порог" - }, - { - "type": "Reading", - "subtype": "Bme280", + "subtype": "AnalogAdc", "id": "t", "widget": "anydataTmp", "page": "Сенсоры", - "descr": "Температура" - }, - { - "type": "Reading", - "subtype": "Bme280", - "id": "p", - "widget": "anydataMm", - "page": "Сенсоры", - "descr": "Давление" - }, - { - "type": "Reading", - "subtype": "Bme280", - "id": "h", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "Влажность", - "int": 10, - "addr": "0x78" - }, - { - "type": "Reading", - "subtype": "AnalogAdc", - "id": "t1", - "widget": "anydataDef", - "page": "Сенсоры", - "descr": "Температура", - "pin": 0, - "int": 10 - }, - { - "type": "Reading", - "subtype": "AnalogAdc", - "id": "t2", - "widget": "anydataTmp", - "page": "Сенсоры", "descr": "Температура", + "map": "1,1024,1,1024", + "plus": 0, + "multiply": 1, "pin": 0, "int": 15 } diff --git a/data_svelte/test.json b/data_svelte/test.json index 0e82979d..7ced6dcf 100644 --- a/data_svelte/test.json +++ b/data_svelte/test.json @@ -70,5 +70,25 @@ "descr": "Влажность", "int": 10, "addr": "0x78" + }, + { + "type": "Reading", + "subtype": "AnalogAdc", + "id": "t1", + "widget": "anydataDef", + "page": "Сенсоры", + "descr": "Температура", + "pin": 0, + "int": 10 + }, + { + "type": "Reading", + "subtype": "AnalogAdc", + "id": "t2", + "widget": "anydataTmp", + "page": "Сенсоры", + "descr": "Температура", + "pin": 0, + "int": 15 } ] \ No newline at end of file diff --git a/src/ESPConfiguration.cpp b/src/ESPConfiguration.cpp index 2743c54d..922621ba 100644 --- a/src/ESPConfiguration.cpp +++ b/src/ESPConfiguration.cpp @@ -25,7 +25,6 @@ void configure(String path) { myIoTSensor = (IoTSensor*)getAPI(subtype, jsonArrayElement); if (myIoTSensor) { iotSensors.push_back(myIoTSensor); - // createWidget(jsonArrayElement); } } } diff --git a/src/StandWebServer.cpp b/src/StandWebServer.cpp index cccf63bb..e4da5df3 100644 --- a/src/StandWebServer.cpp +++ b/src/StandWebServer.cpp @@ -229,6 +229,10 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length) writeFileUint8tByFrames("config.json", payload, length, headerLenth, 256); } + if (headerStr == "/tuoyal") { + writeFileUint8tByFrames("layout.json", payload, length, headerLenth, 256); + } + } break; case WStype_BIN: {