diff --git a/data/dev_conf.txt b/data/dev_conf.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/data/edit.htm.gz b/data/edit.htm.gz deleted file mode 100644 index 5786121f..00000000 Binary files a/data/edit.htm.gz and /dev/null differ diff --git a/data/items/items.txt b/data/items/items.txt index 032966d6..d19eba63 100644 --- a/data/items/items.txt +++ b/data/items/items.txt @@ -20,10 +20,8 @@ 20;0;bmp280-temp;id;anydataTemp;Сенсоры;Температура;order;addr[0x76];c[1] 21;0;impuls-out;id;na;na;na;order;pin 22;0;count-down;id;anydata;Таймер;Обратный#отчет;order -23;0;modbus;id;anydata;Modbus;Регистр;order;addr[1];reg[0];c[1] -24;0;button-out;id;toggle;Кнопки;Освещение;order;type[UART] -25;0;inoutput;id;anydata;Вывод;Вывод#uart;order -26;0;logging;id;chart;Графики;История;order;val[any];int[60];cnt[100] -27;0;uptime;id;anydataTime;Системные;%name%#uptime;order +23;0;inoutput;id;anydata;Вывод;Вывод#uart;order +24;0;logging;id;chart;Графики;История;order;val[any];int[60];cnt[100] +25;0;uptime;id;anydataTime;Системные;%name%#uptime;order diff --git a/data/presets/presets.c.txt b/data/presets/presets.c.txt deleted file mode 100644 index 5db609f9..00000000 --- a/data/presets/presets.c.txt +++ /dev/null @@ -1,46 +0,0 @@ -0;dallas-temp;t1;anydataTemp;Термостат1;Температура;1;pin[2];index[0];int[10] -0;logging;log1;chart;Термостат1;История;2;val[t1];int[60];cnt[100] -0;inoutput;tUp1;inputDigit;Термостат1;Верхний#порог;3 -0;inoutput;tLow1;inputDigit;Термостат1;Нижний#порог;4 -0;button-out;btn1;toggle;Термостат1;Нагрев;5;pin[12]* -0;dallas-temp;t2;anydataTemp;Термостат2;Температура;1;pin[2];index[0];int[60] -0;logging;log2;chart;Термостат2;История;2;val[t2];int[10];cnt[100] -0;inoutput;threshold;inputDigitTemp;Термостат2;Заданная#температура;3 -0;button-out;heater2;toggle;Термостат2;Нагреватель;7;pin[12] -0;inoutput;time21;inputTimeClock;Расписание2;Утренний#период;8 -0;inoutput;threshold1;inputDigitTemp;Расписание2;Температура;9 -0;inoutput;time22;inputTimeClock;Расписание2;Дневной#период;10 -0;inoutput;threshold2;inputDigitTemp;Расписание2;Температура;11 -0;inoutput;time23;inputTimeClock;Расписание2;Вечерний#период;12 -0;inoutput;threshold3;inputDigitTemp;Расписание2;Температура;13 -0;inoutput;time24;inputTimeClock;Расписание2;Ночной#период;14 -0;inoutput;threshold4;inputDigitTemp;Расписание2;Температура;15* -0;dht-hum;h3;anydataHum;Теплица3;Влажность;1;pin[2];type[dht11];c[1] -0;logging;log3;chart;Теплица3;История;2;val[hum];int[60];cnt[100] -0;inoutput;hUp3;inputDigit;Теплица3;Верхний#порог;3 -0;inoutput;hLow3;inputDigit;Теплица3;Нижний#порог;4 -0;button-out;hUp3;toggle;Теплица3;Полив;5;pin[12]* -0;button-out;btn41;toggle;Реле4;Освещение;1;pin[12] -0;button-out;btn42;toggle;Реле4;Освещение;2;pin[13] -0;inoutput;time41;inputTime;Реле4;Введите#время#включения;3 -0;inoutput;time42;inputTime;Реле4;Введите#время#выключения;4* -0;button-out;btn51;toggle;Свет5;Выключить#все;1 -0;button-out;btn52;toggle;Свет5;Гостинная;2;pin[12] -0;button-out;btn53;toggle;Свет5;Спальня;3;pin[13] -0;button-out;btn54;toggle;Свет5;Прихожая;4;pin[14] -0;pwm-out;pwm51;range;Свет5;Яркость;5;pin[15] -0;pwm-out;pwm52;range;Свет5;Яркость;6;pin[16] -0;inoutput;txt5;anydata;Свет5;Статус;7* -0;button-out;button;toggle;Таймер;Освещение;1;pin[12] -0;count-down;count;anydata;Таймер;Обратный#отчет;2 -0;inoutput;input;inputDigit;Таймер;Введите#цифру;3* -0;inoutput;text;anydataAlarm;Сигнализация;Движение:;1 -0;inoutput;time;anydataTime;Сигнализация;Время:;2 -0;button-in;sensor;na;na;na;3;pin[0];db[20] -0;button-out;reset;toggle;Сигнализация;Сбросить;4* -0;button-in;sensor;na;na;na;1;pin[0];db[20] -0;button-out;light;toggle;Освещение;Освещение;2;pin[13] -0;count-down;count;anydata;Освещение;Обратный#отчет;3 -0;inoutput;period;inputDigit;Освещение;Период#включения;4* -0;button-out;light;toggle;Кнопки;Освещение;1;pin[13] -0;button-in;switch;na;na;na;2;pin[0];db[20]* \ No newline at end of file diff --git a/data/presets/presets.s.txt b/data/presets/presets.s.txt deleted file mode 100644 index 0e36c7c1..00000000 --- a/data/presets/presets.s.txt +++ /dev/null @@ -1,84 +0,0 @@ -t1 > tUp1 -btn1 0 -telegram нагрев#выключен 1 -end -t1 < tLow1 -btn1 1 -telegram нагрев#включен 1 -end* -t2 > threshold+-2 -heater2 0 -end -t2 < threshold+-2 -heater2 1 -end -timenow = time21 -threshold threshold1 -end -timenow = time22 -threshold threshold2 -end -timenow = time23 -threshold threshold3 -end -timenow = time24 -threshold threshold4 -end* -h3 > hUp3 -hUp3 0 -telegram полив#выключен 1 -end -h3 < hLow3 -hUp3 1 -telegram полив#включен 1 -end* -timenow = time41 -btn41 1 -btn42 0 -end -timenow = time42 -btn41 0 -btn42 1 -end* -btn51 = 1 -btn52 1 -btn53 1 -btn54 1 -pwm51 200 -pwm52 800 -txt5 включено -end -btn51 = 0 -btn52 0 -btn53 0 -btn54 0 -pwm51 800 -pwm52 200 -txt5 выключено -end* -button = 1 -count input -end -count = 0 -button 0 -end* -sensor = 1 -text обнаружено -time %date% -telegram text обнаружено#движение 1 -end -reset = 1 -text не#обнаружено -time %date% -reset 0 -end* -sensor = 1 -light 1 -count period -end -count = 0 -light 0 -end* -switch = 1 -light change -end* \ No newline at end of file diff --git a/data/set.device.json b/data/set.device.json index bd7affaa..cf6a6369 100644 --- a/data/set.device.json +++ b/data/set.device.json @@ -92,11 +92,9 @@ "/set?addItem=20-ps": "20.Датчик давления bmp280", "/set?addItem=21-ips": "21.Создать импульсы через заданный промежуток времени (управление шд)", "/set?addItem=22-cnt": "22.Таймер обратного отчета", - "/set?addItem=23-mb": "23.Прочитать регистр modbus устройства", - "/set?addItem=24-btn": "24.UART кнопка (шлет свое состояние в UART)", - "/set?addItem=25-txt": "25.UART виджет (позволяет вывести полученные данные в любой виджет)", - "/set?addItem=26-log": "26.Логгирование и вывод в график любой величины", - "/set?addItem=27-ut": "27.Отобразить время работы устройства" + "/set?addItem=23-txt": "23.Виджет для отображения информации полученной из uart, get-запроса, или по udp", + "/set?addItem=24-log": "24.Логгирование и вывод в график любой величины", + "/set?addItem=25-ut": "25.Отобразить время работы устройства" } }, { diff --git a/data/set.utilities.json b/data/set.utilities.json index dee60f7c..16f10037 100644 --- a/data/set.utilities.json +++ b/data/set.utilities.json @@ -52,6 +52,16 @@ { "type": "hr" }, + { + "type": "checkbox", + "name": "uartEvents", + "title": "Включить отправку всех событий в UART", + "action": "/set?uartEvents=[[uartEvents]]", + "state": "{{uartEvents}}" + }, + { + "type": "hr" + }, { "type": "h4", "title": "Скорость", diff --git a/doc/calculator.xlsx b/doc/calculator.xlsx new file mode 100644 index 00000000..6fd98cf2 Binary files /dev/null and b/doc/calculator.xlsx differ diff --git a/doc/old files/items/analog-adc.txt b/doc/old files/items/analog-adc.txt new file mode 100644 index 00000000..8bc0e914 --- /dev/null +++ b/doc/old files/items/analog-adc.txt @@ -0,0 +1 @@ +0;analog-adc;id;fillgauge;Сенсоры;Аналоговый;order;gol;map[0,1024,0,100];c[1] \ No newline at end of file diff --git a/doc/old files/items/bme280-hum.txt b/doc/old files/items/bme280-hum.txt new file mode 100644 index 00000000..c8afd255 --- /dev/null +++ b/doc/old files/items/bme280-hum.txt @@ -0,0 +1 @@ +0;bme280-hum;id;anydataHum;Сенсоры;Влажность;order;addr[0x76];c[1] \ No newline at end of file diff --git a/doc/old files/items/bme280-press.txt b/doc/old files/items/bme280-press.txt new file mode 100644 index 00000000..f79973e2 --- /dev/null +++ b/doc/old files/items/bme280-press.txt @@ -0,0 +1 @@ +0;bme280-press;id;anydataPress;Сенсоры;Давление;order;addr[0x76];c[1] \ No newline at end of file diff --git a/doc/old files/items/bme280-temp.txt b/doc/old files/items/bme280-temp.txt new file mode 100644 index 00000000..6e5e9003 --- /dev/null +++ b/doc/old files/items/bme280-temp.txt @@ -0,0 +1 @@ +0;bme280-temp;id;anydataTemp;Сенсоры;Температура;order;addr[0x76];c[1] \ No newline at end of file diff --git a/doc/old files/items/bmp280-press.txt b/doc/old files/items/bmp280-press.txt new file mode 100644 index 00000000..44b9e8c9 --- /dev/null +++ b/doc/old files/items/bmp280-press.txt @@ -0,0 +1 @@ +0;bmp280-press;id;anydataPress;Сенсоры;Давление;order;addr[0x76];c[1] \ No newline at end of file diff --git a/doc/old files/items/bmp280-temp.txt b/doc/old files/items/bmp280-temp.txt new file mode 100644 index 00000000..c3cb42eb --- /dev/null +++ b/doc/old files/items/bmp280-temp.txt @@ -0,0 +1 @@ +0;bmp280-temp;id;anydataTemp;Сенсоры;Температура;order;addr[0x76];c[1] \ No newline at end of file diff --git a/doc/old files/items/button-in.txt b/doc/old files/items/button-in.txt new file mode 100644 index 00000000..79d79ec9 --- /dev/null +++ b/doc/old files/items/button-in.txt @@ -0,0 +1 @@ +0;button-in;id;toggle;Кнопки;Освещение;order;pin;db[20] \ No newline at end of file diff --git a/doc/old files/items/button-out.inv.txt b/doc/old files/items/button-out.inv.txt new file mode 100644 index 00000000..5499a108 --- /dev/null +++ b/doc/old files/items/button-out.inv.txt @@ -0,0 +1 @@ +0;button-out;id;toggle;Кнопки;Освещение;order;pin;inv[1] \ No newline at end of file diff --git a/doc/old files/items/button-out.npin.txt b/doc/old files/items/button-out.npin.txt new file mode 100644 index 00000000..ecffd881 --- /dev/null +++ b/doc/old files/items/button-out.npin.txt @@ -0,0 +1 @@ +0;button-out;id;toggle;Кнопки;Освещение;order \ No newline at end of file diff --git a/doc/old files/items/button-out.pin.txt b/doc/old files/items/button-out.pin.txt new file mode 100644 index 00000000..b0645025 --- /dev/null +++ b/doc/old files/items/button-out.pin.txt @@ -0,0 +1 @@ +0;button-out;id;toggle;Кнопки;Освещение;order;pin \ No newline at end of file diff --git a/doc/old files/items/count-down.txt b/doc/old files/items/count-down.txt new file mode 100644 index 00000000..3300573c --- /dev/null +++ b/doc/old files/items/count-down.txt @@ -0,0 +1 @@ +0;count-down;id;anydata;Таймер;Обратный#отчет;order \ No newline at end of file diff --git a/doc/old files/items/dallas-temp.txt b/doc/old files/items/dallas-temp.txt new file mode 100644 index 00000000..0da8bdca --- /dev/null +++ b/doc/old files/items/dallas-temp.txt @@ -0,0 +1 @@ +0;dallas-temp;id;anydataTemp;Сенсоры;Температура;order;sal;index[0];int[10] \ No newline at end of file diff --git a/doc/old files/items/dht11-hum.txt b/doc/old files/items/dht11-hum.txt new file mode 100644 index 00000000..b7d9a820 --- /dev/null +++ b/doc/old files/items/dht11-hum.txt @@ -0,0 +1 @@ +0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;thd;type[dht11];c[1] \ No newline at end of file diff --git a/doc/old files/items/dht11-temp.txt b/doc/old files/items/dht11-temp.txt new file mode 100644 index 00000000..39c5e949 --- /dev/null +++ b/doc/old files/items/dht11-temp.txt @@ -0,0 +1 @@ +0;dht-temp;id;anydataTemp;Сенсоры;Температура;order;thd;type[dht11];c[1] \ No newline at end of file diff --git a/doc/old files/items/dht22-hum.txt b/doc/old files/items/dht22-hum.txt new file mode 100644 index 00000000..ab69cf97 --- /dev/null +++ b/doc/old files/items/dht22-hum.txt @@ -0,0 +1 @@ +0;dht-hum;id;anydataHum;Сенсоры;Влажность;order;thd;type[dht22];c[1] \ No newline at end of file diff --git a/doc/old files/items/dht22-temp.txt b/doc/old files/items/dht22-temp.txt new file mode 100644 index 00000000..d14a434d --- /dev/null +++ b/doc/old files/items/dht22-temp.txt @@ -0,0 +1 @@ +0;dht-temp;id;anydataTemp;Сенсоры;Температура;order;thd;type[dht22];c[1] \ No newline at end of file diff --git a/doc/old files/items/impuls-out.txt b/doc/old files/items/impuls-out.txt new file mode 100644 index 00000000..99994ae5 --- /dev/null +++ b/doc/old files/items/impuls-out.txt @@ -0,0 +1 @@ +0;impuls-out;id;na;na;na;order;pin \ No newline at end of file diff --git a/doc/old files/items/input-digit.txt b/doc/old files/items/input-digit.txt new file mode 100644 index 00000000..7df7260e --- /dev/null +++ b/doc/old files/items/input-digit.txt @@ -0,0 +1 @@ +0;inoutput;id;inputDigit;Ввод;Введите#цифру;order \ No newline at end of file diff --git a/doc/old files/items/input-time.txt b/doc/old files/items/input-time.txt new file mode 100644 index 00000000..3fc078b0 --- /dev/null +++ b/doc/old files/items/input-time.txt @@ -0,0 +1 @@ +0;inoutput;id;inputTime;Ввод;Введите#время;order \ No newline at end of file diff --git a/doc/old files/items/logging.txt b/doc/old files/items/logging.txt new file mode 100644 index 00000000..8253774f --- /dev/null +++ b/doc/old files/items/logging.txt @@ -0,0 +1 @@ +0;logging;id;chart;Графики;История;order;val[any];int[60];cnt[100] \ No newline at end of file diff --git a/doc/old files/items/modbus.txt b/doc/old files/items/modbus.txt new file mode 100644 index 00000000..a782395a --- /dev/null +++ b/doc/old files/items/modbus.txt @@ -0,0 +1 @@ +0;modbus;id;anydata;Modbus;Регистр;order;addr[1];reg[0];c[1] \ No newline at end of file diff --git a/doc/old files/items/output-text.txt b/doc/old files/items/output-text.txt new file mode 100644 index 00000000..65d45284 --- /dev/null +++ b/doc/old files/items/output-text.txt @@ -0,0 +1 @@ +0;inoutput;id;anydata;Вывод;Сигнализация;order \ No newline at end of file diff --git a/doc/old files/items/pwm-out.txt b/doc/old files/items/pwm-out.txt new file mode 100644 index 00000000..2acbb459 --- /dev/null +++ b/doc/old files/items/pwm-out.txt @@ -0,0 +1 @@ +0;pwm-out;id;range;Ползунки;Яркость;order;pin \ No newline at end of file diff --git a/doc/old files/items/uart-button.txt b/doc/old files/items/uart-button.txt new file mode 100644 index 00000000..ee2a6b22 --- /dev/null +++ b/doc/old files/items/uart-button.txt @@ -0,0 +1 @@ +0;button-out;id;toggle;Кнопки;Освещение;order;type[UART] \ No newline at end of file diff --git a/doc/old files/items/uart-widget.txt b/doc/old files/items/uart-widget.txt new file mode 100644 index 00000000..469ab016 --- /dev/null +++ b/doc/old files/items/uart-widget.txt @@ -0,0 +1 @@ +0;inoutput;id;anydata;Вывод;Вывод#uart;order \ No newline at end of file diff --git a/doc/old files/items/ultrasonic-cm.txt b/doc/old files/items/ultrasonic-cm.txt new file mode 100644 index 00000000..c5d518c3 --- /dev/null +++ b/doc/old files/items/ultrasonic-cm.txt @@ -0,0 +1 @@ +0;ultrasonic-cm;id;anydata;Сенсоры;Расстояние;order;cin;map[0,500,0,100];c[1];int[10] \ No newline at end of file diff --git a/doc/old files/items/uptime.txt b/doc/old files/items/uptime.txt new file mode 100644 index 00000000..972241b4 --- /dev/null +++ b/doc/old files/items/uptime.txt @@ -0,0 +1 @@ +0;uptime;id;anydataTime;Системные;%name%#uptime;order \ No newline at end of file diff --git a/doc/old files/presets/1.c.txt b/doc/old files/presets/1.c.txt new file mode 100644 index 00000000..abcd06dc --- /dev/null +++ b/doc/old files/presets/1.c.txt @@ -0,0 +1,5 @@ +0;dallas-temp;temp;anydataTemp;Термостат;Температура;1;pin[2];index[0];int[10] +0;logging;log;chart;Термостат;История;2;val[temp];int[60];cnt[100] +0;inoutput;inputU;inputDigit;Термостат;Верхний#порог;3 +0;inoutput;inputL;inputDigit;Термостат;Нижний#порог;4 +0;button-out;button;toggle;Термостат;Нагрев;5;pin[12] \ No newline at end of file diff --git a/doc/old files/presets/1.s.txt b/doc/old files/presets/1.s.txt new file mode 100644 index 00000000..dc4c8c07 --- /dev/null +++ b/doc/old files/presets/1.s.txt @@ -0,0 +1,8 @@ +temp > inputU +button 0 +telegram нагрев#выключен 1 +end +temp < inputL +button 1 +telegram нагрев#включен 1 +end \ No newline at end of file diff --git a/doc/old files/presets/2.c.txt b/doc/old files/presets/2.c.txt new file mode 100644 index 00000000..d91fa5c7 --- /dev/null +++ b/doc/old files/presets/2.c.txt @@ -0,0 +1,12 @@ +0;dallas-temp;temp;anydataTemp;Термостат;Температура;1;pin[2];index[0];int[60] +0;logging;log;chart;Термостат;История;2;val[temp];int[10];cnt[100] +0;inoutput;threshold;inputDigitTemp;Термостат;Заданная#температура;3 +0;button-out;heater;toggle;Термостат;Нагреватель;7;pin[12] +0;inoutput;time1;inputTimeClock;Расписание;Утренний#период;8 +0;inoutput;threshold1;inputDigitTemp;Расписание;Температура;9 +0;inoutput;time2;inputTimeClock;Расписание;Дневной#период;10 +0;inoutput;threshold2;inputDigitTemp;Расписание;Температура;11 +0;inoutput;time3;inputTimeClock;Расписание;Вечерний#период;12 +0;inoutput;threshold3;inputDigitTemp;Расписание;Температура;13 +0;inoutput;time4;inputTimeClock;Расписание;Ночной#период;14 +0;inoutput;threshold4;inputDigitTemp;Расписание;Температура;15 \ No newline at end of file diff --git a/doc/old files/presets/2.s.txt b/doc/old files/presets/2.s.txt new file mode 100644 index 00000000..5a6f36f1 --- /dev/null +++ b/doc/old files/presets/2.s.txt @@ -0,0 +1,18 @@ +temp > threshold+-2 +heater 0 +end +temp < threshold+-2 +heater 1 +end +timenow = time1 +threshold threshold1 +end +timenow = time2 +threshold threshold2 +end +timenow = time3 +threshold threshold3 +end +timenow = time4 +threshold threshold4 +end \ No newline at end of file diff --git a/doc/old files/presets/3.c.txt b/doc/old files/presets/3.c.txt new file mode 100644 index 00000000..fb2c602b --- /dev/null +++ b/doc/old files/presets/3.c.txt @@ -0,0 +1,5 @@ +0;dht-hum;hum;anydataHum;Теплица;Влажность;1;pin[2];type[dht11];c[1] +0;logging;log;chart;Теплица;История;2;val[hum];int[60];cnt[100] +0;inoutput;inputU;inputDigit;Теплица;Верхний#порог;3 +0;inoutput;inputL;inputDigit;Теплица;Нижний#порог;4 +0;button-out;button;toggle;Теплица;Полив;5;pin[12] \ No newline at end of file diff --git a/doc/old files/presets/3.s.txt b/doc/old files/presets/3.s.txt new file mode 100644 index 00000000..f69cdc54 --- /dev/null +++ b/doc/old files/presets/3.s.txt @@ -0,0 +1,8 @@ +hum > inputU +button 0 +telegram полив#выключен 1 +end +hum < inputL +button 1 +telegram полив#включен 1 +end \ No newline at end of file diff --git a/doc/old files/presets/4.c.txt b/doc/old files/presets/4.c.txt new file mode 100644 index 00000000..3f1ccaa1 --- /dev/null +++ b/doc/old files/presets/4.c.txt @@ -0,0 +1,4 @@ +0;button-out;button1;toggle;Реле;Освещение;1;pin[12] +0;button-out;button2;toggle;Реле;Освещение;2;pin[13] +0;inoutput;T1;inputTime;Реле;Введите#время#включения;3 +0;inoutput;T2;inputTime;Реле;Введите#время#выключения;4 \ No newline at end of file diff --git a/doc/old files/presets/4.s.txt b/doc/old files/presets/4.s.txt new file mode 100644 index 00000000..844d1c5b --- /dev/null +++ b/doc/old files/presets/4.s.txt @@ -0,0 +1,8 @@ +timenow = T1 +button1 1 +button2 0 +end +timenow = T2 +button1 0 +button2 1 +end \ No newline at end of file diff --git a/doc/old files/presets/5.c.txt b/doc/old files/presets/5.c.txt new file mode 100644 index 00000000..359a7a52 --- /dev/null +++ b/doc/old files/presets/5.c.txt @@ -0,0 +1,7 @@ +0;button-out;button-out-1;toggle;Кнопки;Выключить#все;1 +0;button-out;button-out-2;toggle;Кнопки;Гостинная;2;pin[12] +0;button-out;button-out-3;toggle;Кнопки;Спальня;3;pin[13] +0;button-out;button-out-4;toggle;Кнопки;Прихожая;4;pin[14] +0;pwm-out;pwm-out-5;range;Кнопки;Яркость;5;pin[15] +0;pwm-out;pwm-out-6;range;Кнопки;Яркость;6;pin[16] +0;inoutput;output-text-7;anydata;Кнопки;Статус;7 \ No newline at end of file diff --git a/doc/old files/presets/5.s.txt b/doc/old files/presets/5.s.txt new file mode 100644 index 00000000..0424728a --- /dev/null +++ b/doc/old files/presets/5.s.txt @@ -0,0 +1,16 @@ +button-out-1 = 1 +button-out-2 1 +button-out-3 1 +button-out-4 1 +pwm-out-5 200 +pwm-out-6 800 +output-text-7 включено +end +button-out-1 = 0 +button-out-2 0 +button-out-3 0 +button-out-4 0 +pwm-out-5 800 +pwm-out-6 200 +output-text-7 выключено +end \ No newline at end of file diff --git a/doc/old files/presets/6.c.txt b/doc/old files/presets/6.c.txt new file mode 100644 index 00000000..c7fd096a --- /dev/null +++ b/doc/old files/presets/6.c.txt @@ -0,0 +1,3 @@ +0;button-out;button;toggle;Таймер;Освещение;1;pin[12] +0;count-down;count;anydata;Таймер;Обратный#отчет;2 +0;inoutput;input;inputDigit;Таймер;Введите#цифру;3 \ No newline at end of file diff --git a/doc/old files/presets/6.s.txt b/doc/old files/presets/6.s.txt new file mode 100644 index 00000000..06b70a4a --- /dev/null +++ b/doc/old files/presets/6.s.txt @@ -0,0 +1,6 @@ +button = 1 +count input +end +count = 0 +button 0 +end \ No newline at end of file diff --git a/doc/old files/presets/7.c.txt b/doc/old files/presets/7.c.txt new file mode 100644 index 00000000..984c6b8d --- /dev/null +++ b/doc/old files/presets/7.c.txt @@ -0,0 +1,4 @@ +0;inoutput;text;anydataAlarm;Сигнализация;Движение:;1 +0;inoutput;time;anydataTime;Сигнализация;Время:;2 +0;button-in;sensor;na;na;na;3;pin[0];db[20] +0;button-out;reset;toggle;Сигнализация;Сбросить;4 \ No newline at end of file diff --git a/doc/old files/presets/7.s.txt b/doc/old files/presets/7.s.txt new file mode 100644 index 00000000..32d28e78 --- /dev/null +++ b/doc/old files/presets/7.s.txt @@ -0,0 +1,10 @@ +sensor = 1 +text обнаружено +time %date% +telegram text обнаружено#движение 1 +end +reset = 1 +text не#обнаружено +time %date% +reset 0 +end \ No newline at end of file diff --git a/doc/old files/presets/8.c.txt b/doc/old files/presets/8.c.txt new file mode 100644 index 00000000..d18bdd0b --- /dev/null +++ b/doc/old files/presets/8.c.txt @@ -0,0 +1,4 @@ +0;button-in;sensor;na;na;na;1;pin[0];db[20] +0;button-out;light;toggle;Освещение;Освещение;2;pin[13] +0;count-down;count;anydata;Освещение;Обратный#отчет;3 +0;inoutput;period;inputDigit;Освещение;Период#включения;4 \ No newline at end of file diff --git a/doc/old files/presets/8.s.txt b/doc/old files/presets/8.s.txt new file mode 100644 index 00000000..10d55654 --- /dev/null +++ b/doc/old files/presets/8.s.txt @@ -0,0 +1,7 @@ +sensor = 1 +light 1 +count period +end +count = 0 +light 0 +end \ No newline at end of file diff --git a/doc/old files/presets/9.c.txt b/doc/old files/presets/9.c.txt new file mode 100644 index 00000000..502f3ae4 --- /dev/null +++ b/doc/old files/presets/9.c.txt @@ -0,0 +1,2 @@ +0;button-out;light;toggle;Кнопки;Освещение;1;pin[13] +0;button-in;switch;na;na;na;2;pin[0];db[20] \ No newline at end of file diff --git a/doc/old files/presets/9.s.txt b/doc/old files/presets/9.s.txt new file mode 100644 index 00000000..6f6d7dcc --- /dev/null +++ b/doc/old files/presets/9.s.txt @@ -0,0 +1,3 @@ +switch = 1 +light change +end \ No newline at end of file diff --git a/include/Consts.h b/include/Consts.h index dd97d73a..6b4e6764 100644 --- a/include/Consts.h +++ b/include/Consts.h @@ -1,8 +1,8 @@ #pragma once //===========Firmware============================================================================================================================================= -#define FIRMWARE_VERSION 272 -//#define FLASH_SIZE_1MB true +#define FIRMWARE_VERSION 273 +#define FLASH_SIZE_1MB true //================================================================================================================================================================== #define NUM_BUTTONS 6 #define LED_PIN 2 diff --git a/platformio.ini b/platformio.ini index f5848391..bd0eef56 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,6 +1,6 @@ [platformio] -default_envs = esp8266 +default_envs = esp8266_01_1m ;============================================================================================================================================= [common_env_data] lib_deps_external = diff --git a/src/BufferExecute.cpp b/src/BufferExecute.cpp index b28778bb..e0752de6 100644 --- a/src/BufferExecute.cpp +++ b/src/BufferExecute.cpp @@ -1,5 +1,6 @@ #include "BufferExecute.h" #include "Global.h" +#include "SoftUART.h" // #include "items/vSensorDallas.h" #include "items/vSensorUltrasonic.h" @@ -11,9 +12,18 @@ #include "items/vCountDown.h" void loopCmdAdd(const String& cmdStr) { - orderBuf += cmdStr; - if (!cmdStr.endsWith(",")) { - orderBuf += ","; + if (cmdStr.endsWith(",")) { + orderBuf += cmdStr; +#ifdef uartEnable + if (jsonReadBool(configSetupJson, "uart")) { + if (jsonReadBool(configSetupJson, "uartEvents")) { + if (myUART) { + myUART->print(cmdStr); + SerialPrint("I", "<=UART", cmdStr); + } + } + } +#endif } } diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp index 951d16c4..fa334f78 100644 --- a/src/MqttClient.cpp +++ b/src/MqttClient.cpp @@ -1,5 +1,5 @@ #include "MqttClient.h" - +#include "BufferExecute.h" #include #include "items/vLogging.h" #include "Class/NotAsync.h" @@ -132,10 +132,13 @@ void mqttCallback(char* topic, uint8_t* payload, size_t length) { String key = selectFromMarkerToMarker(topicStr, "/", 3); - orderBuf += key; - orderBuf += " "; - orderBuf += payloadStr; - orderBuf += ","; + String order; + order += key; + order += " "; + order += payloadStr; + order += ","; + + loopCmdAdd(order); SerialPrint("I", "=>MQTT", "Msg from iotmanager app: " + key + " " + payloadStr); } diff --git a/src/SoftUART.cpp b/src/SoftUART.cpp index 00673fce..c40a3f08 100644 --- a/src/SoftUART.cpp +++ b/src/SoftUART.cpp @@ -2,6 +2,7 @@ #ifdef uartEnable #include "SoftUART.h" #include "Global.h" +#include "BufferExecute.h" #ifdef ESP8266 SoftwareSerial* myUART = nullptr; @@ -10,7 +11,7 @@ HardwareSerial* myUART = nullptr; #endif void uartInit() { - if (!jsonReadBool(configSetupJson, "uartEnable")) { + if (!jsonReadBool(configSetupJson, "uart")) { return; } if (!myUART) { @@ -27,7 +28,7 @@ void uartInit() { void uartHandle() { if (myUART) { - if (!jsonReadBool(configSetupJson, "uartEnable")) { + if (!jsonReadBool(configSetupJson, "uart")) { return; } static String incStr; @@ -49,7 +50,7 @@ void parse(String& incStr) { incStr.replace("\n", ""); if (incStr.indexOf("set") != -1) { incStr = deleteBeforeDelimiter(incStr, " "); - orderBuf += incStr; + loopCmdAdd(incStr); SerialPrint("I", "=>UART", incStr); } } diff --git a/src/Telegram.cpp b/src/Telegram.cpp index ee8fabb9..6663b20c 100644 --- a/src/Telegram.cpp +++ b/src/Telegram.cpp @@ -1,6 +1,7 @@ #include "Consts.h" #ifdef telegramEnable #include "Telegram.h" +#include "BufferExecute.h" CTBot* myBot{ nullptr }; void telegramInit() { @@ -49,7 +50,7 @@ void telegramMsgParse(String msg) { if (msg.indexOf("set") != -1) { msg = deleteBeforeDelimiter(msg, "_"); msg.replace("_", " "); - orderBuf += String(msg) + ","; + loopCmdAdd(String(msg) + ","); myBot->sendMessage(jsonReadInt(configSetupJson, "chatId"), "order done"); SerialPrint("<-", "Telegram", "chat ID: " + String(jsonReadInt(configSetupJson, "chatId")) + ", msg: " + String(msg)); } diff --git a/src/Web.cpp b/src/Web.cpp index 31a93c3d..6027fcc5 100644 --- a/src/Web.cpp +++ b/src/Web.cpp @@ -19,65 +19,55 @@ bool parseRequestForPreset(AsyncWebServerRequest* request, uint8_t& preset) { void web_init() { server.on("/set", HTTP_GET, [](AsyncWebServerRequest* request) { //==============================set.device.json==================================================================================================== - if (request->hasArg("addItem")) { + if (request->hasArg(F("addItem"))) { addItem2(request->getParam("addItem")->value()); request->redirect("/?set.device"); } - if (request->hasArg("addPreset")) { - addPreset2(request->getParam("addPreset")->value().toInt()); - jsonWriteStr(configSetupJson, "warning1", F("

Требуется перезагрузка

")); - request->redirect("/?set.device"); + if (request->hasArg(F("addPreset"))) { + addPreset2(request->getParam(F("addPreset"))->value().toInt()); + if (FLASH_SIZE_1MB) { + jsonWriteStr(configSetupJson, F("warning1"), F("

Присеты не доступны, модуль на 1mb

")); + } + else { + jsonWriteStr(configSetupJson, F("warning1"), F("

Требуется перезагрузка

")); + } + request->redirect(F("/?set.device")); } - if (request->hasArg("delChoosingItems")) { - jsonWriteStr(configSetupJson, "warning1", F("

Требуется перезагрузка

")); + if (request->hasArg(F("delChoosingItems"))) { + jsonWriteStr(configSetupJson, F("warning1"), F("

Требуется перезагрузка

")); myNotAsyncActions->make(do_delChoosingItems); request->send(200); } - if (request->hasArg("delAllItems")) { + if (request->hasArg(F("delAllItems"))) { delAllItems(); cleanLogAndData(); - jsonWriteStr(configSetupJson, "warning1", F("

Требуется перезагрузка

")); - request->redirect("/?set.device"); + jsonWriteStr(configSetupJson, F("warning1"), F("

Требуется перезагрузка

")); + request->redirect(F("/?set.device")); } - if (request->hasArg("saveItems")) { + if (request->hasArg(F("saveItems"))) { myNotAsyncActions->make(do_deviceInit); request->send(200); } - if (request->hasArg("scen")) { - bool value = request->getParam("scen")->value().toInt(); - jsonWriteBool(configSetupJson, "scen", value); + if (request->hasArg(F("scen"))) { + bool value = request->getParam(F("scen"))->value().toInt(); + jsonWriteBool(configSetupJson, F("scen"), value); saveConfig(); loadScenario(); request->send(200); } - if (request->hasArg("sceninit")) { + if (request->hasArg(F("sceninit"))) { loadScenario(); request->send(200); } - //if (request->hasArg("snaUdp")) { - // bool value = request->getParam("snaUdp")->value().toInt(); - // jsonWriteBool(configSetupJson, "snaUdp", value); - // saveConfig(); - // #ifdef UDP_ENABLED - // asyncUdpInit(); - // #endif - // request->send(200); - //} - - //if (request->hasArg("scenUdp")) { - // myNotAsyncActions->make(do_sendScenUDP); - // request->send(200); - //} - - if (request->hasArg("MqttIn")) { - bool value = request->getParam("MqttIn")->value().toInt(); + if (request->hasArg(F("MqttIn"))) { + bool value = request->getParam(F("MqttIn"))->value().toInt(); jsonWriteBool(configSetupJson, "MqttIn", value); saveConfig(); mqtt.subscribe((mqttPrefix + "/+/+/event").c_str()); @@ -85,111 +75,103 @@ void web_init() { request->send(200); } - if (request->hasArg("MqttOut")) { - bool value = request->getParam("MqttOut")->value().toInt(); - jsonWriteBool(configSetupJson, "MqttOut", value); + if (request->hasArg(F("MqttOut"))) { + bool value = request->getParam(F("MqttOut"))->value().toInt(); + jsonWriteBool(configSetupJson, F("MqttOut"), value); saveConfig(); request->send(200); } - if (request->hasArg("scenMqtt")) { + if (request->hasArg(F("scenMqtt"))) { myNotAsyncActions->make(do_sendScenMQTT); request->send(200); } - if (request->hasArg("cleanlog")) { + if (request->hasArg(F("cleanlog"))) { cleanLogAndData(); request->send(200); } //==============================wifi settings============================================= - if (request->hasArg("devname")) { - jsonWriteStr(configSetupJson, "name", request->getParam("devname")->value()); + if (request->hasArg(F("devname"))) { + jsonWriteStr(configSetupJson, F("name"), request->getParam(F("devname"))->value()); saveConfig(); request->send(200); } - if (request->hasArg("routerssid")) { - jsonWriteStr(configSetupJson, "routerssid", request->getParam("routerssid")->value()); + if (request->hasArg(F("routerssid"))) { + jsonWriteStr(configSetupJson, F("routerssid"), request->getParam(F("routerssid"))->value()); saveConfig(); request->send(200); } - if (request->hasArg("routerpass")) { - jsonWriteStr(configSetupJson, "routerpass", request->getParam("routerpass")->value()); + if (request->hasArg(F("routerpass"))) { + jsonWriteStr(configSetupJson, F("routerpass"), request->getParam(F("routerpass"))->value()); saveConfig(); request->send(200); } - if (request->hasArg("apssid")) { - jsonWriteStr(configSetupJson, "apssid", request->getParam("apssid")->value()); + if (request->hasArg(F("apssid"))) { + jsonWriteStr(configSetupJson, F("apssid"), request->getParam(F("apssid"))->value()); saveConfig(); request->send(200, "text/text", "OK"); } - if (request->hasArg("appass")) { - jsonWriteStr(configSetupJson, "appass", request->getParam("appass")->value()); + if (request->hasArg(F("appass"))) { + jsonWriteStr(configSetupJson, F("appass"), request->getParam(F("appass"))->value()); saveConfig(); request->send(200); } - if (request->hasArg("weblogin")) { - jsonWriteStr(configSetupJson, "weblogin", request->getParam("weblogin")->value()); + if (request->hasArg(F("weblogin"))) { + jsonWriteStr(configSetupJson, F("weblogin"), request->getParam(F("weblogin"))->value()); saveConfig(); request->send(200); } - if (request->hasArg("webpass")) { - jsonWriteStr(configSetupJson, "webpass", request->getParam("webpass")->value()); + if (request->hasArg(F("webpass"))) { + jsonWriteStr(configSetupJson, F("webpass"), request->getParam(F("webpass"))->value()); saveConfig(); request->send(200); } - if (request->hasArg("timezone")) { - String timezoneStr = request->getParam("timezone")->value(); - jsonWriteStr(configSetupJson, "timezone", timezoneStr); + if (request->hasArg(F("timezone"))) { + String timezoneStr = request->getParam(F("timezone"))->value(); + jsonWriteStr(configSetupJson, F("timezone"), timezoneStr); saveConfig(); timeNow->setTimezone(timezoneStr.toInt()); request->send(200); } - if (request->hasArg("ntp")) { - String ntpStr = request->getParam("ntp")->value(); - jsonWriteStr(configSetupJson, "ntp", ntpStr); + if (request->hasArg(F("ntp"))) { + String ntpStr = request->getParam(F("ntp"))->value(); + jsonWriteStr(configSetupJson, F("ntp"), ntpStr); saveConfig(); timeNow->setNtpPool(ntpStr); request->send(200); } - if (request->hasArg("blink")) { - bool value = request->getParam("blink")->value().toInt(); - jsonWriteBool(configSetupJson, "blink", value); + if (request->hasArg(F("blink"))) { + bool value = request->getParam(F("blink"))->value().toInt(); + jsonWriteBool(configSetupJson, F("blink"), value); saveConfig(); request->send(200); } - if (request->hasArg("reqReset")) { + if (request->hasArg(F("reqReset"))) { String tmp = "{}"; jsonWriteStr(tmp, "title", F("Вы действительно хотите перезагрузить устройство?Идет перезагрузка устройства')\">Перезагрузить")); jsonWriteStr(tmp, "class", "pop-up"); request->send(200, "text/html", tmp); } - if (request->hasArg("reset")) { + if (request->hasArg(F("reset"))) { ESP.restart(); request->send(200); } - if (request->hasArg("test")) { - if (request->getParam("test")->value() == "ok") { - Serial.println("test pass"); - } - request->send(200); - } - //==============================mqtt settings============================================= - if (request->hasArg("mqttServer")) { jsonWriteStr(configSetupJson, "mqttServer", request->getParam("mqttServer")->value()); saveConfig(); @@ -237,7 +219,7 @@ void web_init() { request->send(200, "text/html", payload); } - //==============================push settings============================================= + //==============================telegram settings============================================= if (request->hasArg("telegramApi")) { jsonWriteStr(configSetupJson, "telegramApi", request->getParam("telegramApi")->value()); saveConfig(); @@ -266,15 +248,21 @@ void web_init() { myNotAsyncActions->make(do_BUSSCAN); request->redirect("/?set.utilities"); } - if (request->hasArg("uartEnable")) { - bool value = request->getParam("uartEnable")->value().toInt(); - jsonWriteBool(configSetupJson, "uartEnable", value); + if (request->hasArg("uart")) { + bool value = request->getParam("uart")->value().toInt(); + jsonWriteBool(configSetupJson, "uart", value); saveConfig(); #ifdef uartEnable uartInit(); #endif request->send(200); } + if (request->hasArg("uartEvents")) { + bool value = request->getParam("uartEvents")->value().toInt(); + jsonWriteBool(configSetupJson, "uartEvents", value); + saveConfig(); + request->send(200); + } if (request->hasArg("uartS")) { jsonWriteStr(configSetupJson, "uartS", request->getParam("uartS")->value()); saveConfig(); @@ -309,22 +297,7 @@ void web_init() { } }); - //==============================list of items===================================================== - //server.on("/del", HTTP_GET, [](AsyncWebServerRequest* request) { - // if (request->hasArg("file")) { - // itemsFile = request->getParam("file")->value(); - // } - // if (request->hasArg("line")) { - // itemsLine = request->getParam("line")->value(); - // } - // delElementFlag = true; - // deviceInit(); - // request->redirect("/?setn.device"); - //}); - /* - * Check - */ server.on("/check", HTTP_GET, [](AsyncWebServerRequest* request) { myNotAsyncActions->make(do_GETLASTVERSION); SerialPrint("I", "Update", "firmware version: " + String(lastVersion)); diff --git a/src/items/vButtonOut.cpp b/src/items/vButtonOut.cpp index 3ef137b0..fb422e34 100644 --- a/src/items/vButtonOut.cpp +++ b/src/items/vButtonOut.cpp @@ -20,17 +20,6 @@ ButtonOut::ButtonOut(String pin, boolean inv, String key, String type) { ButtonOut::~ButtonOut() {} void ButtonOut::execute(String state) { - if (_type == "UART") { - if (jsonReadBool(configSetupJson, "uartEnable")) { -#ifdef uartEnable - if (myUART) { - String msg = _key + " " + state; - myUART->print(msg); - SerialPrint("I", "<=UART", msg); - } -#endif - } - } if (state != "" && _pin != "") { if (state == "change") { state = String(!digitalRead(_pin.toInt()));