add udp support and some new functions

This commit is contained in:
Dmitry Borisenko
2020-04-05 01:52:02 +02:00
parent 5250049e08
commit ba30af5182
23 changed files with 464 additions and 257 deletions

18
data/config-all.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "IoTmanager",
"chipID": "",
"ssidAP": "WiFi",
"passwordAP": "",
"ssid": "your_ssid",
"password": "your_password",
"timezone": 3,
"mqttServer": "",
"mqttPort": 0,
"mqttPrefix": "/IoTmanager",
"mqttUser": "",
"mqttPass": "",
"scenario": "1",
"pushingbox_id": "",
"web_login": "admin",
"web_pass": "admin"
}

View File

@@ -1,18 +0,0 @@
{
"SSDP": "IoTmanager",
"chipID": "",
"ssidAP": "WiFi",
"passwordAP": "",
"ssid": "rise",
"password": "hostel3333",
"timezone": 2,
"mqttServer": "mqtt.ioty.ru",
"mqttPort": 1883,
"mqttPrefix": "/rise",
"mqttUser": "test",
"mqttPass": "test",
"scenario": "1",
"pushingbox_id": "",
"web_login": "admin",
"web_pass": "admin"
}

View File

@@ -1,16 +1,16 @@
{
"SSDP": "MODULES",
"name": "IoTmanager",
"chipID": "",
"ssidAP": "WiFi",
"passwordAP": "",
"ssid": "your_ssid",
"password": "your_password",
"timezone": 3,
"mqttServer": "",
"mqttPort": 0,
"mqttPrefix": "/IoTmanager",
"mqttUser": "",
"mqttPass": "",
"ssid": "rise",
"password": "hostel3333",
"timezone": 2,
"mqttServer": "mqtt.ioty.ru",
"mqttPort": 1883,
"mqttPrefix": "/rise",
"mqttUser": "test",
"mqttPass": "test",
"scenario": "1",
"pushingbox_id": "",
"web_login": "admin",

View File

@@ -8,7 +8,7 @@
"content": [
{
"type": "h5",
"title": "{{SSDP}}",
"title": "{{name}}",
"class": "alert-warning"
},
{
@@ -62,7 +62,7 @@
"state": "firmware.c.txt",
"style": "width:100%;height:400px",
"title": "Сохранить",
"action": "/all_modules_init",
"action": "/init?arg=2",
"class": "btn btn-block btn-success"
},
{
@@ -79,7 +79,7 @@
"type": "checkbox",
"name": "scenario",
"title": "Включить сценарии",
"action": "/scenario?status=[[scenario]]",
"action": "/init?arg=[[scenario]]",
"state": "{{scenario}}"
},
{
@@ -90,8 +90,8 @@
"type": "file",
"state": "firmware.s.txt",
"style": "width:100%;height:400px",
"title": "Сохранить и включить",
"action": "/scenario?status=1",
"title": "Сохранить",
"action": "/init?arg=4",
"class": "btn btn-block btn-success"
},
{
@@ -100,13 +100,13 @@
{
"type": "link",
"title": "Очистить логи сенсоров",
"action": "/cleanlog",
"action": "/init?arg=3",
"class": "btn btn-block btn-success"
},
{
"type": "link",
"title": "Главная",
"action": "/page.htm?index",
"action": "/",
"class": "btn btn-block btn-danger btn-sm"
}
]

65
data/dev.json Normal file
View File

@@ -0,0 +1,65 @@
{
"configs": [
"/config.live.json",
"/config.setup.json"
],
"title": "Главная",
"class": "col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
"content": [
{
"type": "h5",
"title": "{{name}}",
"class": "alert-warning"
},
{
"type": "h3",
"title": "Список других устройств в сети:"
},
{
"type": "hr"
},
{
"type": "csv",
"title": [
"html",
"html",
"html"
],
"state": "dev.csv",
"style": "width:100%;",
"class": "nan"
},
{
"type": "hr"
},
{
"type": "link",
"title": "Переформировать список устройств",
"action": "udp?arg=2",
"class": "btn btn-block btn-success"
},
{
"type": "link",
"title": "Обновить страницу",
"action": "udp?arg=3",
"class": "btn btn-block btn-success"
},
{
"type": "hr"
},
{
"type": "text",
"class": "alert alert-warning",
"title": "После нажатия на кнопку 'Переформировать список устройств' ждите примерно минуту, а затем обновите страницу и список появится вновь"
},
{
"type": "hr"
},
{
"type": "link",
"title": "Главная",
"action": "/",
"class": "btn btn-block btn-danger"
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

View File

@@ -8,7 +8,7 @@
"content": [
{
"type": "h5",
"title": "{{SSDP}}",
"title": "{{name}}",
"class": "alert-warning"
},
{
@@ -37,28 +37,37 @@
{
"type": "link",
"title": "Конфигурация устройства",
"action": "/page.htm?configuration",
"action": "/?configuration",
"class": "btn btn-block btn-primary"
},
{
"type": "hr"
},
{
"type": "link",
"title": "Список других устройств в сети",
"action": "/?dev",
"class": "btn btn-block btn-warning"
},
{
"type": "hr"
},
{
"type": "link",
"title": "Конфигурация WIFI",
"action": "/page.htm?setup",
"action": "/?setup",
"class": "btn btn-block btn-success"
},
{
"type": "link",
"title": "Конфигурация MQTT",
"action": "/page.htm?mqtt",
"action": "/?mqtt",
"class": "btn btn-block btn-success"
},
{
"type": "link",
"title": "Конфигурация push",
"action": "/page.htm?pushingbox",
"action": "/?pushingbox",
"class": "btn btn-block btn-success"
},
{
@@ -73,7 +82,7 @@
{
"type": "button",
"title": "Обновить прошивку",
"action": "/upgrade",
"action": "/check",
"response": "[[my-block]]",
"class": "btn btn-block btn-success"
},

Binary file not shown.

Binary file not shown.

View File

@@ -1,96 +1,106 @@
{
"configs": [
"/config.setup.json"
],
"class":"col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
"content": [
{
"type": "h5",
"title": "{{SSDP}}",
"class":"alert-warning"
},
{
"type": "h4",
"title": "Server name:"
},
{
"type": "input",
"title": "",
"name":"1",
"state": "{{mqttServer}}"
},
{
"type": "h4",
"title": "Port:"
},
{
"type": "input",
"title": "",
"name":"2",
"state": "{{mqttPort}}"
},
{
"type": "h4",
"title": "Prefix:"
},
{
"type": "input",
"title": "",
"name":"3",
"state": "{{mqttPrefix}}"
},
{
"type": "h4",
"title": "User name:"
},
{
"type": "input",
"title": "",
"name":"4",
"state": "{{mqttUser}}"
},
{
"type": "h4",
"title": "Password:"
},
{
"type": "input",
"title": "",
"name":"5",
"state": "{{mqttPass}}"
},
{
"type":"h3",
"name":"my-block",
"style":"position:fixed;top:30%;left:50%;width:400px;margin-left:-200px;text-align:center;",
"class":"hidden"
},
{
"type": "button",
"title":"Сохранить",
"action": "mqttSave?mqttServer=[[1]]&mqttPort=[[2]]&mqttPrefix=[[3]]&mqttUser=[[4]]&mqttPass=[[5]]",
"class": "btn btn-block btn-success",
"style": "width:100%;display:inline"
},
{
"type": "button",
"title":"Проверить соединение с MQTT",
"action": "mqttCheck",
"response":"[[my-block]]",
"class": "btn btn-block btn-success",
"style": "width:100%;display:inline"
},
{
"type": "link",
"title": "Перезагрузить устройство",
"action": "javascript:if(confirm(renameBlock(jsonResponse,'Перезагрузить?'))){send_request(this,'/restart?device=ok');}",
"class": "btn btn-block btn-warning"
},
{
"type": "link",
"title": "Главная",
"action": "/page.htm?index",
"class": "btn btn-block btn-danger btn-sm"
}
]
}
"configs": [
"/config.setup.json"
],
"class": "col-sm-offset-1 col-sm-10 col-md-offset-2 col-md-8 col-lg-offset-3 col-lg-6",
"content": [
{
"type": "h5",
"title": "{{name}}",
"class": "alert-warning"
},
{
"type": "h4",
"title": "Server name:"
},
{
"type": "input",
"title": "",
"name": "1",
"state": "{{mqttServer}}"
},
{
"type": "h4",
"title": "Port:"
},
{
"type": "input",
"title": "",
"name": "2",
"state": "{{mqttPort}}"
},
{
"type": "h4",
"title": "Prefix:"
},
{
"type": "input",
"title": "",
"name": "3",
"state": "{{mqttPrefix}}"
},
{
"type": "h4",
"title": "User name:"
},
{
"type": "input",
"title": "",
"name": "4",
"state": "{{mqttUser}}"
},
{
"type": "h4",
"title": "Password:"
},
{
"type": "input",
"title": "",
"name": "5",
"state": "{{mqttPass}}"
},
{
"type": "h3",
"name": "my-block",
"style": "position:fixed;top:30%;left:50%;width:400px;margin-left:-200px;text-align:center;",
"class": "hidden"
},
{
"type": "text",
"class": "alert alert-warning",
"title": "Прежде чем нажимать на кнопку 'Отправить настройки MQTT' сохрание их, если Вы их меняли. Настройки получат и перезапишут все устройства в локальной сети"
},
{
"type": "button",
"title": "Сохранить",
"action": "mqttSave?mqttServer=[[1]]&mqttPort=[[2]]&mqttPrefix=[[3]]&mqttUser=[[4]]&mqttPass=[[5]]",
"class": "btn btn-block btn-success"
},
{
"type": "button",
"title": "Отправить настройки MQTT с этого устройства на все остальные",
"action": "udp?arg=1",
"class": "btn btn-block btn-success"
},
{
"type": "button",
"title": "Проверить соединение с MQTT",
"action": "mqttCheck",
"response": "[[my-block]]",
"class": "btn btn-block btn-success"
},
{
"type": "link",
"title": "Перезагрузить устройство",
"action": "javascript:if(confirm(renameBlock(jsonResponse,'Перезагрузить?'))){send_request(this,'/restart?device=ok');}",
"class": "btn btn-block btn-success"
},
{
"type": "link",
"title": "Главная",
"action": "/",
"class": "btn btn-block btn-danger btn-sm"
}
]
}

Binary file not shown.

View File

@@ -6,7 +6,7 @@
"content": [
{
"type": "h5",
"title": "{{SSDP}}",
"title": "{{name}}",
"class":"alert-warning"
},
{
@@ -39,7 +39,7 @@
{
"type": "link",
"title": "Главная",
"action": "/page.htm?index",
"action": "/",
"class": "btn btn-block btn-danger btn-sm"
}
]

View File

@@ -7,7 +7,7 @@
"content": [
{
"type": "h5",
"title": "{{SSDP}}",
"title": "{{name}}",
"class":"alert-warning"
},
{
@@ -26,14 +26,14 @@
{
"type": "input",
"title": "Имя устройства",
"name":"ssdp",
"state": "{{SSDP}}",
"name":"dev_name",
"state": "{{name}}",
"pattern": "[0-9a-zA-Zа-яА-Я.\\- ]{1,20}"
},
{
"type": "button",
"title": "Сохранить",
"action": "ssdp?ssdp=[[ssdp]]",
"action": "name?arg=[[dev_name]]",
"class": "btn btn-block btn-success"
},
{