mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
@@ -131,7 +131,11 @@ if deviceName == 'esp8266_1mb_ota' or deviceName == 'esp8285_1mb_ota' or deviceN
|
|||||||
copy_tree("data_lite", "data_svelte")
|
copy_tree("data_lite", "data_svelte")
|
||||||
else:
|
else:
|
||||||
copy_tree("data_full", "data_svelte")
|
copy_tree("data_full", "data_svelte")
|
||||||
|
|
||||||
|
deviceType = 'esp32*'
|
||||||
|
if not 'esp32' in deviceName:
|
||||||
|
deviceType = 'esp82*'
|
||||||
|
|
||||||
# генерируем файлы проекта на основе подготовленного профиля
|
# генерируем файлы проекта на основе подготовленного профиля
|
||||||
# заполняем конфигурационный файл прошивки параметрами из профиля
|
# заполняем конфигурационный файл прошивки параметрами из профиля
|
||||||
with open("data_svelte/settings.json", "r", encoding='utf-8') as read_file:
|
with open("data_svelte/settings.json", "r", encoding='utf-8') as read_file:
|
||||||
@@ -158,15 +162,28 @@ for section, modules in profJson['modules'].items():
|
|||||||
with open(module['path'] + "/modinfo.json", "r", encoding='utf-8') as read_file:
|
with open(module['path'] + "/modinfo.json", "r", encoding='utf-8') as read_file:
|
||||||
moduleJson = json.load(read_file)
|
moduleJson = json.load(read_file)
|
||||||
if deviceName in moduleJson['usedLibs']: # проверяем поддерживает ли модуль текущее устройство
|
if deviceName in moduleJson['usedLibs']: # проверяем поддерживает ли модуль текущее устройство
|
||||||
activeModulesName.append(moduleJson['about']['moduleName']) # запоминаем имена для использования на след шагах
|
if not 'exclude' in moduleJson['usedLibs'][deviceName]: # смотрим не нужно ли исключить данный модуль из указанной платы deviceName
|
||||||
includeDirs = includeDirs + "\n+<" + module['path'].replace("src/", "") + ">" # запоминаем пути к модулям для компиляции
|
activeModulesName.append(moduleJson['about']['moduleName']) # запоминаем имена для использования на след шагах
|
||||||
for libPath in moduleJson['usedLibs'][deviceName]: # запоминаем библиотеки необходимые модулю для текущей платы
|
includeDirs = includeDirs + "\n+<" + module['path'].replace("src/", "") + ">" # запоминаем пути к модулям для компиляции
|
||||||
allLibs = allLibs + "\n" + libPath
|
for libPath in moduleJson['usedLibs'][deviceName]: # запоминаем библиотеки необходимые модулю для текущей платы
|
||||||
for configItemsJson in moduleJson['configItem']:
|
allLibs = allLibs + "\n" + libPath
|
||||||
configItemsJson['num'] = itemsCount
|
for configItemsJson in moduleJson['configItem']:
|
||||||
configItemsJson['name'] = str(itemsCount) + ". " + configItemsJson['name']
|
configItemsJson['num'] = itemsCount
|
||||||
itemsCount = itemsCount + 1
|
configItemsJson['name'] = str(itemsCount) + ". " + configItemsJson['name']
|
||||||
itemsJson.append(configItemsJson)
|
itemsCount = itemsCount + 1
|
||||||
|
itemsJson.append(configItemsJson)
|
||||||
|
else: # В первую очередь ищем по имени deviceName, чтобы для данной платы можно было уточнить либы. Если не нашли плату по имени в usedLibs пробуем найти её по типу deviceType
|
||||||
|
if deviceType in moduleJson['usedLibs']: # проверяем поддерживает ли модуль текущее устройство
|
||||||
|
activeModulesName.append(moduleJson['about']['moduleName']) # запоминаем имена для использования на след шагах
|
||||||
|
includeDirs = includeDirs + "\n+<" + module['path'].replace("src/", "") + ">" # запоминаем пути к модулям для компиляции
|
||||||
|
for libPath in moduleJson['usedLibs'][deviceType]: # запоминаем библиотеки необходимые модулю для текущей платы
|
||||||
|
allLibs = allLibs + "\n" + libPath
|
||||||
|
for configItemsJson in moduleJson['configItem']:
|
||||||
|
configItemsJson['num'] = itemsCount
|
||||||
|
configItemsJson['name'] = str(itemsCount) + ". " + configItemsJson['name']
|
||||||
|
itemsCount = itemsCount + 1
|
||||||
|
itemsJson.append(configItemsJson)
|
||||||
|
|
||||||
with open("data_svelte/items.json", "w", encoding='utf-8') as write_file:
|
with open("data_svelte/items.json", "w", encoding='utf-8') as write_file:
|
||||||
json.dump(itemsJson, write_file, ensure_ascii=False, indent=4, sort_keys=False)
|
json.dump(itemsJson, write_file, ensure_ascii=False, indent=4, sort_keys=False)
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
"bootloader_qio_80m": "0x1000",
|
"bootloader_qio_80m": "0x1000",
|
||||||
"firmware": "0x10000",
|
"firmware": "0x10000",
|
||||||
"partitions": "0x8000",
|
"partitions": "0x8000",
|
||||||
"littlefs": "0x290000"
|
"littlefs": "0x310000"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "esp32_16mb",
|
"name": "esp32_16mb",
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/Math",
|
"path": "src/modules/virtual/Math",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/owmWeather",
|
"path": "src/modules/virtual/owmWeather",
|
||||||
@@ -290,12 +290,20 @@
|
|||||||
"path": "src/modules/sensors/Mhz19",
|
"path": "src/modules/sensors/Mhz19",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/sensors/MQgas",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Ntc",
|
"path": "src/modules/sensors/Ntc",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Pzem004t",
|
"path": "src/modules/sensors/Pzem004t",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/sensors/Pzem004t_v2",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -340,6 +348,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"executive_devices": [
|
"executive_devices": [
|
||||||
|
{
|
||||||
|
"path": "src/modules/exec/AnalogBtn",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/exec/ButtonIn",
|
"path": "src/modules/exec/ButtonIn",
|
||||||
"active": true
|
"active": true
|
||||||
@@ -436,12 +448,16 @@
|
|||||||
"screens": [
|
"screens": [
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/DwinI",
|
"path": "src/modules/display/DwinI",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Lcd2004",
|
"path": "src/modules/display/Lcd2004",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/display/Nextion",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/NextionUpload",
|
"path": "src/modules/display/NextionUpload",
|
||||||
"active": false
|
"active": false
|
||||||
@@ -460,7 +476,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/TM16XX",
|
"path": "src/modules/display/TM16XX",
|
||||||
"active": true
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Ws2812b",
|
"path": "src/modules/display/Ws2812b",
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/Math",
|
"path": "src/modules/virtual/Math",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/owmWeather",
|
"path": "src/modules/virtual/owmWeather",
|
||||||
@@ -168,12 +168,20 @@
|
|||||||
"path": "src/modules/sensors/Mhz19",
|
"path": "src/modules/sensors/Mhz19",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/sensors/MQgas",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Ntc",
|
"path": "src/modules/sensors/Ntc",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Pzem004t",
|
"path": "src/modules/sensors/Pzem004t",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/sensors/Pzem004t_v2",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -218,6 +226,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"executive_devices": [
|
"executive_devices": [
|
||||||
|
{
|
||||||
|
"path": "src/modules/exec/AnalogBtn",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/exec/ButtonIn",
|
"path": "src/modules/exec/ButtonIn",
|
||||||
"active": true
|
"active": true
|
||||||
@@ -314,12 +326,16 @@
|
|||||||
"screens": [
|
"screens": [
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/DwinI",
|
"path": "src/modules/display/DwinI",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Lcd2004",
|
"path": "src/modules/display/Lcd2004",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/display/Nextion",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/NextionUpload",
|
"path": "src/modules/display/NextionUpload",
|
||||||
"active": false
|
"active": false
|
||||||
@@ -338,7 +354,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/TM16XX",
|
"path": "src/modules/display/TM16XX",
|
||||||
"active": true
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Ws2812b",
|
"path": "src/modules/display/Ws2812b",
|
||||||
|
|||||||
@@ -68,7 +68,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "5. Погода OWM",
|
"name": "5. Math library",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "IoTMath",
|
||||||
|
"id": "math",
|
||||||
|
"widget": "anydataValue",
|
||||||
|
"page": "Математика",
|
||||||
|
"descr": "",
|
||||||
|
"num": 5
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "6. Погода OWM",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "owmWeather",
|
"subtype": "owmWeather",
|
||||||
"id": "owm",
|
"id": "owm",
|
||||||
@@ -86,11 +97,11 @@
|
|||||||
"round": 1,
|
"round": 1,
|
||||||
"val": "...",
|
"val": "...",
|
||||||
"debug": 0,
|
"debug": 0,
|
||||||
"num": 5
|
"num": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "6. Таймер",
|
"name": "7. Таймер",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Timer",
|
"subtype": "Timer",
|
||||||
"id": "timer",
|
"id": "timer",
|
||||||
@@ -102,11 +113,11 @@
|
|||||||
"ticker": 1,
|
"ticker": 1,
|
||||||
"repeat": 1,
|
"repeat": 1,
|
||||||
"needSave": 0,
|
"needSave": 0,
|
||||||
"num": 6
|
"num": 7
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "7. Окно ввода числа (переменная)",
|
"name": "8. Окно ввода числа (переменная)",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Variable",
|
"subtype": "Variable",
|
||||||
"id": "value",
|
"id": "value",
|
||||||
@@ -120,11 +131,11 @@
|
|||||||
"plus": 0,
|
"plus": 0,
|
||||||
"multiply": 1,
|
"multiply": 1,
|
||||||
"round": 0,
|
"round": 0,
|
||||||
"num": 7
|
"num": 8
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "8. Окно ввода времени",
|
"name": "9. Окно ввода времени",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Variable",
|
"subtype": "Variable",
|
||||||
"id": "time",
|
"id": "time",
|
||||||
@@ -134,11 +145,11 @@
|
|||||||
"descr": "Введите время",
|
"descr": "Введите время",
|
||||||
"int": "0",
|
"int": "0",
|
||||||
"val": "02:00",
|
"val": "02:00",
|
||||||
"num": 8
|
"num": 9
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "9. Окно ввода даты",
|
"name": "10. Окно ввода даты",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Variable",
|
"subtype": "Variable",
|
||||||
"id": "time",
|
"id": "time",
|
||||||
@@ -148,11 +159,11 @@
|
|||||||
"descr": "Введите дату",
|
"descr": "Введите дату",
|
||||||
"int": "0",
|
"int": "0",
|
||||||
"val": "24.05.2022",
|
"val": "24.05.2022",
|
||||||
"num": 9
|
"num": 10
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "10. Окно ввода текста",
|
"name": "11. Окно ввода текста",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Variable",
|
"subtype": "Variable",
|
||||||
"id": "txt",
|
"id": "txt",
|
||||||
@@ -162,11 +173,11 @@
|
|||||||
"descr": "Введите текст",
|
"descr": "Введите текст",
|
||||||
"int": "0",
|
"int": "0",
|
||||||
"val": "текст",
|
"val": "текст",
|
||||||
"num": 10
|
"num": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "11. Вывод значения",
|
"name": "12. Вывод значения",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Variable",
|
"subtype": "Variable",
|
||||||
"id": "vout",
|
"id": "vout",
|
||||||
@@ -180,11 +191,11 @@
|
|||||||
"plus": 0,
|
"plus": 0,
|
||||||
"multiply": 1,
|
"multiply": 1,
|
||||||
"round": 0,
|
"round": 0,
|
||||||
"num": 11
|
"num": 12
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "12. Виртуальная кнопка",
|
"name": "13. Виртуальная кнопка",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "VButton",
|
"subtype": "VButton",
|
||||||
"id": "vbtn",
|
"id": "vbtn",
|
||||||
@@ -194,13 +205,13 @@
|
|||||||
"descr": "Кнопка",
|
"descr": "Кнопка",
|
||||||
"int": "0",
|
"int": "0",
|
||||||
"val": "0",
|
"val": "0",
|
||||||
"num": 12
|
"num": 13
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "sensors"
|
"header": "sensors"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "13. A02 Дальность",
|
"name": "14. A02 Дальность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "A02Distance",
|
"subtype": "A02Distance",
|
||||||
"id": "dist",
|
"id": "dist",
|
||||||
@@ -209,10 +220,14 @@
|
|||||||
"descr": "Дальность",
|
"descr": "Дальность",
|
||||||
"int": 5,
|
"int": 5,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 13
|
"tx": 17,
|
||||||
|
"rx": 16,
|
||||||
|
"line": 2,
|
||||||
|
"speed": 9600,
|
||||||
|
"num": 14
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "14. Acs712 Ток",
|
"name": "15. Acs712 Ток",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Acs712",
|
"subtype": "Acs712",
|
||||||
"id": "amp",
|
"id": "amp",
|
||||||
@@ -227,11 +242,11 @@
|
|||||||
"sens": 100,
|
"sens": 100,
|
||||||
"adczero": 512,
|
"adczero": 512,
|
||||||
"btn-setZero": "nil",
|
"btn-setZero": "nil",
|
||||||
"num": 14
|
"num": 15
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "15. AHTXX Температура",
|
"name": "16. AHTXX Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "AhtXXt",
|
"subtype": "AhtXXt",
|
||||||
"id": "Temp20",
|
"id": "Temp20",
|
||||||
@@ -242,11 +257,11 @@
|
|||||||
"addr": "0x38",
|
"addr": "0x38",
|
||||||
"shtType": 1,
|
"shtType": 1,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 15
|
"num": 16
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "16. AHTXX Влажность",
|
"name": "17. AHTXX Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "AhtXXh",
|
"subtype": "AhtXXh",
|
||||||
"id": "Hum20",
|
"id": "Hum20",
|
||||||
@@ -257,11 +272,11 @@
|
|||||||
"addr": "0x38",
|
"addr": "0x38",
|
||||||
"shtType": 1,
|
"shtType": 1,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 16
|
"num": 17
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "17. Аналоговый сенсор",
|
"name": "18. Аналоговый сенсор",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "AnalogAdc",
|
"subtype": "AnalogAdc",
|
||||||
"id": "t",
|
"id": "t",
|
||||||
@@ -275,11 +290,11 @@
|
|||||||
"pin": 0,
|
"pin": 0,
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"avgSteps": 1,
|
"avgSteps": 1,
|
||||||
"num": 17
|
"num": 18
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "18. BME280 Температура",
|
"name": "19. BME280 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bme280t",
|
"subtype": "Bme280t",
|
||||||
"id": "Tmp3",
|
"id": "Tmp3",
|
||||||
@@ -289,11 +304,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0x77",
|
"addr": "0x77",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 18
|
"num": 19
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "19. BME280 Давление",
|
"name": "20. BME280 Давление",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bme280p",
|
"subtype": "Bme280p",
|
||||||
"id": "Press3",
|
"id": "Press3",
|
||||||
@@ -303,11 +318,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0x77",
|
"addr": "0x77",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 19
|
"num": 20
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "20. BME280 Влажность",
|
"name": "21. BME280 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bme280h",
|
"subtype": "Bme280h",
|
||||||
"id": "Hum3",
|
"id": "Hum3",
|
||||||
@@ -317,11 +332,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0x77",
|
"addr": "0x77",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 20
|
"num": 21
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "21. BME280 Tочка росы",
|
"name": "22. BME280 Tочка росы",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bme280dp",
|
"subtype": "Bme280dp",
|
||||||
"id": "Dew3",
|
"id": "Dew3",
|
||||||
@@ -331,11 +346,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0x77",
|
"addr": "0x77",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 21
|
"num": 22
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "22. BMP280 Температура",
|
"name": "23. BMP280 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bmp280t",
|
"subtype": "Bmp280t",
|
||||||
"id": "tmp3",
|
"id": "tmp3",
|
||||||
@@ -345,11 +360,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0x77",
|
"addr": "0x77",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 22
|
"num": 23
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "23. BMP280 Давление",
|
"name": "24. BMP280 Давление",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Bmp280p",
|
"subtype": "Bmp280p",
|
||||||
"id": "Press3",
|
"id": "Press3",
|
||||||
@@ -359,11 +374,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0x77",
|
"addr": "0x77",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 23
|
"num": 24
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "24. DHT11 Температура",
|
"name": "25. DHT11 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Dht1122t",
|
"subtype": "Dht1122t",
|
||||||
"id": "tmp3",
|
"id": "tmp3",
|
||||||
@@ -373,11 +388,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"pin": 0,
|
"pin": 0,
|
||||||
"senstype": "dht11",
|
"senstype": "dht11",
|
||||||
"num": 24
|
"num": 25
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "25. DHT11 Влажность",
|
"name": "26. DHT11 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Dht1122h",
|
"subtype": "Dht1122h",
|
||||||
"id": "Hum3",
|
"id": "Hum3",
|
||||||
@@ -387,11 +402,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"pin": 0,
|
"pin": 0,
|
||||||
"senstype": "dht11",
|
"senstype": "dht11",
|
||||||
"num": 25
|
"num": 26
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "26. DS18B20 Температура",
|
"name": "27. DS18B20 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Ds18b20",
|
"subtype": "Ds18b20",
|
||||||
"id": "dstmp",
|
"id": "dstmp",
|
||||||
@@ -403,11 +418,11 @@
|
|||||||
"index": 0,
|
"index": 0,
|
||||||
"addr": "",
|
"addr": "",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 26
|
"num": 27
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "27. Аналоговый счетчик импульсов",
|
"name": "28. Аналоговый счетчик импульсов",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Impulse",
|
"subtype": "Impulse",
|
||||||
"id": "impulse",
|
"id": "impulse",
|
||||||
@@ -420,11 +435,52 @@
|
|||||||
"pinMode": "INPUT",
|
"pinMode": "INPUT",
|
||||||
"debounceDelay": 3,
|
"debounceDelay": 3,
|
||||||
"multiply": 1,
|
"multiply": 1,
|
||||||
"num": 27
|
"num": 28
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "28. PZEM 004t Напряжение",
|
"name": "29. MQ газовые анализаторы",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "MQgas",
|
||||||
|
"id": "MQ",
|
||||||
|
"widget": "anydataPpm",
|
||||||
|
"page": "Сенсоры",
|
||||||
|
"descr": "MQ-135",
|
||||||
|
"Series": 135,
|
||||||
|
"Gas": "CO2",
|
||||||
|
"Rl on board": 10,
|
||||||
|
"Ro in clean air": 0,
|
||||||
|
"Rl/Ro in clean air": 0,
|
||||||
|
"PPM in clean air": 397.13,
|
||||||
|
"aLimit": -0.42,
|
||||||
|
"bLimit": 1.92,
|
||||||
|
"Warm up time": 60,
|
||||||
|
"Sample interval": 20,
|
||||||
|
"Sample times": 10,
|
||||||
|
"Calibtation intensity": 5,
|
||||||
|
"autoCalibration": 1,
|
||||||
|
"autoCalib.Period": 24,
|
||||||
|
"TempHum correction": 1,
|
||||||
|
"temperature": 20,
|
||||||
|
"idTempSensor": "",
|
||||||
|
"humidity": 50,
|
||||||
|
"idHumSensor": "",
|
||||||
|
"k1": 0.00672096284322792,
|
||||||
|
"k2": -0.0159038179354688,
|
||||||
|
"b1": -0.741244323718154,
|
||||||
|
"b2": 1.77535862501753,
|
||||||
|
"Debug": 1,
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 1,
|
||||||
|
"pin-Esp32": 34,
|
||||||
|
"operating voltage": 3.3,
|
||||||
|
"int": 15,
|
||||||
|
"num": 29
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "30. PZEM 004t Напряжение",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004v",
|
"subtype": "Pzem004v",
|
||||||
"id": "v",
|
"id": "v",
|
||||||
@@ -434,11 +490,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 28
|
"num": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "29. PZEM 004t Сила тока",
|
"name": "31. PZEM 004t Сила тока",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004a",
|
"subtype": "Pzem004a",
|
||||||
"id": "a",
|
"id": "a",
|
||||||
@@ -448,11 +504,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 29
|
"num": 31
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "30. PZEM 004t Мощность",
|
"name": "32. PZEM 004t Мощность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004w",
|
"subtype": "Pzem004w",
|
||||||
"id": "w",
|
"id": "w",
|
||||||
@@ -462,11 +518,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 30
|
"num": 32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "31. PZEM 004t Энергия",
|
"name": "33. PZEM 004t Энергия",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004wh",
|
"subtype": "Pzem004wh",
|
||||||
"id": "wh",
|
"id": "wh",
|
||||||
@@ -476,11 +532,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 31
|
"num": 33
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "32. PZEM 004t Частота",
|
"name": "34. PZEM 004t Частота",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004hz",
|
"subtype": "Pzem004hz",
|
||||||
"id": "hz",
|
"id": "hz",
|
||||||
@@ -490,11 +546,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 32
|
"num": 34
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "33. PZEM 004t Косинус",
|
"name": "35. PZEM 004t Косинус",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004pf",
|
"subtype": "Pzem004pf",
|
||||||
"id": "pf",
|
"id": "pf",
|
||||||
@@ -504,11 +560,11 @@
|
|||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 33
|
"num": 35
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "34. PZEM настройка",
|
"name": "36. PZEM настройка",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pzem004cmd",
|
"subtype": "Pzem004cmd",
|
||||||
"id": "set",
|
"id": "set",
|
||||||
@@ -517,14 +573,28 @@
|
|||||||
"descr": "",
|
"descr": "",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"addr": "0xF8",
|
"addr": "0xF8",
|
||||||
"changeaddr": 0,
|
"btn-changeaddr": "0x01",
|
||||||
"setaddr": "0x01",
|
"btn-reset": "",
|
||||||
"reset": 0,
|
"num": 36
|
||||||
"num": 34
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "35. Часы реального времени",
|
"name": "37. PZEM uart",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Pzem004uart",
|
||||||
|
"id": "upzem",
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "",
|
||||||
|
"descr": "",
|
||||||
|
"tx": 17,
|
||||||
|
"rx": 16,
|
||||||
|
"line": 2,
|
||||||
|
"speed": 9600,
|
||||||
|
"num": 37
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "38. Часы реального времени",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "RTC",
|
"subtype": "RTC",
|
||||||
"id": "rtc",
|
"id": "rtc",
|
||||||
@@ -540,11 +610,12 @@
|
|||||||
"int": 5,
|
"int": 5,
|
||||||
"btn-setUTime": "0",
|
"btn-setUTime": "0",
|
||||||
"btn-setSysTime": "nil",
|
"btn-setSysTime": "nil",
|
||||||
"num": 35
|
"num": 38
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "36. (S8) Cенсор качества воздуха",
|
"global": 0,
|
||||||
"num": 36,
|
"name": "39. (S8) Cенсор качества воздуха",
|
||||||
|
"num": 39,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "S8co",
|
"subtype": "S8co",
|
||||||
"id": "s8co",
|
"id": "s8co",
|
||||||
@@ -558,7 +629,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "37. Sht20 Температура",
|
"name": "40. Sht20 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20t",
|
"subtype": "Sht20t",
|
||||||
"id": "tmp2",
|
"id": "tmp2",
|
||||||
@@ -567,11 +638,11 @@
|
|||||||
"descr": "Температура",
|
"descr": "Температура",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 37
|
"num": 40
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "38. Sht20 Влажность",
|
"name": "41. Sht20 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht20h",
|
"subtype": "Sht20h",
|
||||||
"id": "Hum2",
|
"id": "Hum2",
|
||||||
@@ -580,11 +651,11 @@
|
|||||||
"descr": "Влажность",
|
"descr": "Влажность",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 38
|
"num": 41
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "39. Sht30 Температура",
|
"name": "42. Sht30 Температура",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht30t",
|
"subtype": "Sht30t",
|
||||||
"id": "tmp30",
|
"id": "tmp30",
|
||||||
@@ -593,11 +664,11 @@
|
|||||||
"descr": "SHT30 Температура",
|
"descr": "SHT30 Температура",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 39
|
"num": 42
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "40. Sht30 Влажность",
|
"name": "43. Sht30 Влажность",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sht30h",
|
"subtype": "Sht30h",
|
||||||
"id": "Hum30",
|
"id": "Hum30",
|
||||||
@@ -606,12 +677,12 @@
|
|||||||
"descr": "SHT30 Влажность",
|
"descr": "SHT30 Влажность",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"round": 1,
|
"round": 1,
|
||||||
"num": 40
|
"num": 43
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "41. HC-SR04 Ультразвуковой дальномер",
|
"name": "44. HC-SR04 Ультразвуковой дальномер",
|
||||||
"num": 41,
|
"num": 44,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sonar",
|
"subtype": "Sonar",
|
||||||
"id": "sonar",
|
"id": "sonar",
|
||||||
@@ -623,7 +694,7 @@
|
|||||||
"int": 5
|
"int": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "42. UART",
|
"name": "45. UART",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "UART",
|
"subtype": "UART",
|
||||||
"page": "",
|
"page": "",
|
||||||
@@ -635,14 +706,28 @@
|
|||||||
"line": 2,
|
"line": 2,
|
||||||
"speed": 9600,
|
"speed": 9600,
|
||||||
"eventFormat": 0,
|
"eventFormat": 0,
|
||||||
"num": 42
|
"num": 45
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "executive_devices"
|
"header": "executive_devices"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "43. Кнопка подключенная к пину",
|
"name": "46. Аналоговая кнопка",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "AnalogBtn",
|
||||||
|
"id": "abtn",
|
||||||
|
"widget": "toggle",
|
||||||
|
"page": "Кнопки",
|
||||||
|
"descr": "Освещение",
|
||||||
|
"pin": 34,
|
||||||
|
"aValue": -1,
|
||||||
|
"delta": 50,
|
||||||
|
"num": 46
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "47. Кнопка подключенная к пину",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonIn",
|
"subtype": "ButtonIn",
|
||||||
"id": "btn",
|
"id": "btn",
|
||||||
@@ -657,11 +742,11 @@
|
|||||||
"debounceDelay": 50,
|
"debounceDelay": 50,
|
||||||
"fixState": 0,
|
"fixState": 0,
|
||||||
"inv": 0,
|
"inv": 0,
|
||||||
"num": 43
|
"num": 47
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "44. Управление пином",
|
"name": "48. Управление пином",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "ButtonOut",
|
"subtype": "ButtonOut",
|
||||||
"needSave": 0,
|
"needSave": 0,
|
||||||
@@ -672,11 +757,11 @@
|
|||||||
"int": 0,
|
"int": 0,
|
||||||
"inv": 0,
|
"inv": 0,
|
||||||
"pin": 2,
|
"pin": 2,
|
||||||
"num": 44
|
"num": 48
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "45. Пассивный звуковой извещатель",
|
"name": "49. Пассивный звуковой извещатель",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Buzzer",
|
"subtype": "Buzzer",
|
||||||
"id": "buzzer",
|
"id": "buzzer",
|
||||||
@@ -695,11 +780,11 @@
|
|||||||
"cycle": 0,
|
"cycle": 0,
|
||||||
"indication": 1,
|
"indication": 1,
|
||||||
"val": 0,
|
"val": 0,
|
||||||
"num": 45
|
"num": 49
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "46. Энкодер",
|
"name": "50. Энкодер",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Encoder",
|
"subtype": "Encoder",
|
||||||
"id": "enc",
|
"id": "enc",
|
||||||
@@ -712,11 +797,11 @@
|
|||||||
"step": 1,
|
"step": 1,
|
||||||
"stepOnPress": 5,
|
"stepOnPress": 5,
|
||||||
"pins": "4,5,2",
|
"pins": "4,5,2",
|
||||||
"num": 46
|
"num": 50
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "47. Сервопривод",
|
"name": "51. Сервопривод",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "IoTServo",
|
"subtype": "IoTServo",
|
||||||
"id": "servo",
|
"id": "servo",
|
||||||
@@ -726,13 +811,14 @@
|
|||||||
"pin": 12,
|
"pin": 12,
|
||||||
"minPulseWidth": 544,
|
"minPulseWidth": 544,
|
||||||
"maxPulseWidth": 2400,
|
"maxPulseWidth": 2400,
|
||||||
"neutralPulseWidth": 1500,
|
"minAngle": 0,
|
||||||
|
"maxAngle": 180,
|
||||||
"trackingID": "",
|
"trackingID": "",
|
||||||
"num": 47
|
"num": 51
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "48. Расширитель портов Mcp23017",
|
"name": "52. Расширитель портов Mcp23017",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mcp23017",
|
"subtype": "Mcp23017",
|
||||||
"id": "Mcp",
|
"id": "Mcp",
|
||||||
@@ -742,11 +828,11 @@
|
|||||||
"int": "0",
|
"int": "0",
|
||||||
"addr": "0x20",
|
"addr": "0x20",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"num": 48
|
"num": 52
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "49. MP3 плеер",
|
"name": "53. MP3 плеер",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mp3",
|
"subtype": "Mp3",
|
||||||
"id": "mp3",
|
"id": "mp3",
|
||||||
@@ -756,11 +842,11 @@
|
|||||||
"int": 1,
|
"int": 1,
|
||||||
"pins": "14,12",
|
"pins": "14,12",
|
||||||
"volume": 20,
|
"volume": 20,
|
||||||
"num": 49
|
"num": 53
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "50. Сенсорная кнопка",
|
"name": "54. Сенсорная кнопка",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Multitouch",
|
"subtype": "Multitouch",
|
||||||
"id": "impulse",
|
"id": "impulse",
|
||||||
@@ -774,11 +860,11 @@
|
|||||||
"pinMode": "INPUT",
|
"pinMode": "INPUT",
|
||||||
"debounceDelay": 50,
|
"debounceDelay": 50,
|
||||||
"PWMDelay": 500,
|
"PWMDelay": 500,
|
||||||
"num": 50
|
"num": 54
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "51. Расширитель портов Pcf8574",
|
"name": "55. Расширитель портов Pcf8574",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Pcf8574",
|
"subtype": "Pcf8574",
|
||||||
"id": "Pcf",
|
"id": "Pcf",
|
||||||
@@ -788,11 +874,11 @@
|
|||||||
"int": "0",
|
"int": "0",
|
||||||
"addr": "0x20",
|
"addr": "0x20",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"num": 51
|
"num": 55
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "52. PWM ESP8266",
|
"name": "56. PWM ESP8266",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "Pwm8266",
|
"subtype": "Pwm8266",
|
||||||
"id": "pwm",
|
"id": "pwm",
|
||||||
@@ -804,11 +890,11 @@
|
|||||||
"freq": 5000,
|
"freq": 5000,
|
||||||
"val": 0,
|
"val": 0,
|
||||||
"apin": -1,
|
"apin": -1,
|
||||||
"num": 52
|
"num": 56
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "53. Телеграм-Лайт",
|
"name": "57. Телеграм-Лайт",
|
||||||
"type": "Writing",
|
"type": "Writing",
|
||||||
"subtype": "TelegramLT",
|
"subtype": "TelegramLT",
|
||||||
"id": "tg",
|
"id": "tg",
|
||||||
@@ -817,14 +903,29 @@
|
|||||||
"descr": "",
|
"descr": "",
|
||||||
"token": "",
|
"token": "",
|
||||||
"chatID": "",
|
"chatID": "",
|
||||||
"num": 53
|
"num": 57
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"header": "screens"
|
"header": "screens"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "58. LCD Dwin экран",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "DwinI",
|
||||||
|
"id": "dwin",
|
||||||
|
"widget": "",
|
||||||
|
"page": "",
|
||||||
|
"descr": "",
|
||||||
|
"tx": 17,
|
||||||
|
"rx": 16,
|
||||||
|
"line": 2,
|
||||||
|
"speed": 9600,
|
||||||
|
"btn-uploadUI": "",
|
||||||
|
"num": 58
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "54. LCD экран 2004",
|
"name": "59. LCD экран 2004",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
@@ -837,10 +938,10 @@
|
|||||||
"id2show": "",
|
"id2show": "",
|
||||||
"prefix": "",
|
"prefix": "",
|
||||||
"postfix": "",
|
"postfix": "",
|
||||||
"num": 54
|
"num": 59
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "55. LCD экран 1602",
|
"name": "60. LCD экран 1602",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Lcd2004",
|
"subtype": "Lcd2004",
|
||||||
"id": "Lcd",
|
"id": "Lcd",
|
||||||
@@ -853,11 +954,11 @@
|
|||||||
"id2show": "",
|
"id2show": "",
|
||||||
"prefix": "",
|
"prefix": "",
|
||||||
"postfix": "",
|
"postfix": "",
|
||||||
"num": 55
|
"num": 60
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"global": 0,
|
"global": 0,
|
||||||
"name": "56. OLED экран 64 8266",
|
"name": "61. OLED экран 64 8266",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Oled64",
|
"subtype": "Oled64",
|
||||||
"id": "Oled",
|
"id": "Oled",
|
||||||
@@ -870,26 +971,6 @@
|
|||||||
"id2show": "",
|
"id2show": "",
|
||||||
"prefix": "",
|
"prefix": "",
|
||||||
"postfix": "",
|
"postfix": "",
|
||||||
"num": 56
|
"num": 61
|
||||||
},
|
|
||||||
{
|
|
||||||
"global": 0,
|
|
||||||
"name": "57. 7 сегментный дисплей TM16XX",
|
|
||||||
"type": "Writing",
|
|
||||||
"subtype": "TM16XX",
|
|
||||||
"id": "tm",
|
|
||||||
"widget": "inputTxt",
|
|
||||||
"page": "screens",
|
|
||||||
"descr": "Экран",
|
|
||||||
"round": 0,
|
|
||||||
"chip": 1637,
|
|
||||||
"numDigits": 4,
|
|
||||||
"DIO": "13",
|
|
||||||
"CLK": "14",
|
|
||||||
"STB": "12",
|
|
||||||
"intensity": "5",
|
|
||||||
"on": "1",
|
|
||||||
"id2show": "",
|
|
||||||
"num": 57
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include "BuildTime.h"
|
#include "BuildTime.h"
|
||||||
|
|
||||||
// Версия прошивки
|
// Версия прошивки
|
||||||
#define FIRMWARE_VERSION 455
|
#define FIRMWARE_VERSION 456
|
||||||
|
|
||||||
#ifdef esp8266_1mb_ota
|
#ifdef esp8266_1mb_ota
|
||||||
#define FIRMWARE_NAME "esp8266_1mb_ota"
|
#define FIRMWARE_NAME "esp8266_1mb_ota"
|
||||||
|
|||||||
@@ -146,7 +146,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/Math",
|
"path": "src/modules/virtual/Math",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/virtual/owmWeather",
|
"path": "src/modules/virtual/owmWeather",
|
||||||
@@ -290,12 +290,20 @@
|
|||||||
"path": "src/modules/sensors/Mhz19",
|
"path": "src/modules/sensors/Mhz19",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/sensors/MQgas",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Ntc",
|
"path": "src/modules/sensors/Ntc",
|
||||||
"active": false
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/sensors/Pzem004t",
|
"path": "src/modules/sensors/Pzem004t",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/sensors/Pzem004t_v2",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -340,6 +348,10 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"executive_devices": [
|
"executive_devices": [
|
||||||
|
{
|
||||||
|
"path": "src/modules/exec/AnalogBtn",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/exec/ButtonIn",
|
"path": "src/modules/exec/ButtonIn",
|
||||||
"active": true
|
"active": true
|
||||||
@@ -436,12 +448,16 @@
|
|||||||
"screens": [
|
"screens": [
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/DwinI",
|
"path": "src/modules/display/DwinI",
|
||||||
"active": false
|
"active": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Lcd2004",
|
"path": "src/modules/display/Lcd2004",
|
||||||
"active": true
|
"active": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "src/modules/display/Nextion",
|
||||||
|
"active": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/NextionUpload",
|
"path": "src/modules/display/NextionUpload",
|
||||||
"active": false
|
"active": false
|
||||||
@@ -460,7 +476,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/TM16XX",
|
"path": "src/modules/display/TM16XX",
|
||||||
"active": true
|
"active": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "src/modules/display/Ws2812b",
|
"path": "src/modules/display/Ws2812b",
|
||||||
|
|||||||
@@ -544,17 +544,16 @@ lib_deps =
|
|||||||
adafruit/Adafruit BusIO @ ^1.13.2
|
adafruit/Adafruit BusIO @ ^1.13.2
|
||||||
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
|
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
|
||||||
adafruit/Adafruit BusIO @ ^1.13.2
|
adafruit/Adafruit BusIO @ ^1.13.2
|
||||||
|
plerup/EspSoftwareSerial
|
||||||
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
|
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
|
||||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||||
https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED
|
https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED
|
||||||
https://github.com/adafruit/Adafruit-GFX-Library
|
https://github.com/adafruit/Adafruit-GFX-Library
|
||||||
https://github.com/maxint-rd/TM16xx
|
|
||||||
adafruit/Adafruit GFX Library @ ^1.11.5
|
|
||||||
adafruit/Adafruit BusIO @ ^1.13.2
|
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
+<modules/virtual/Cron>
|
+<modules/virtual/Cron>
|
||||||
+<modules/virtual/Loging>
|
+<modules/virtual/Loging>
|
||||||
+<modules/virtual/LogingDaily>
|
+<modules/virtual/LogingDaily>
|
||||||
|
+<modules/virtual/Math>
|
||||||
+<modules/virtual/owmWeather>
|
+<modules/virtual/owmWeather>
|
||||||
+<modules/virtual/Timer>
|
+<modules/virtual/Timer>
|
||||||
+<modules/virtual/Variable>
|
+<modules/virtual/Variable>
|
||||||
@@ -568,13 +567,15 @@ build_src_filter =
|
|||||||
+<modules/sensors/Dht1122>
|
+<modules/sensors/Dht1122>
|
||||||
+<modules/sensors/Ds18b20>
|
+<modules/sensors/Ds18b20>
|
||||||
+<modules/sensors/Impulse>
|
+<modules/sensors/Impulse>
|
||||||
+<modules/sensors/Pzem004t>
|
+<modules/sensors/MQgas>
|
||||||
|
+<modules/sensors/Pzem004t_v2>
|
||||||
+<modules/sensors/RTC>
|
+<modules/sensors/RTC>
|
||||||
+<modules/sensors/S8>
|
+<modules/sensors/S8>
|
||||||
+<modules/sensors/Sht20>
|
+<modules/sensors/Sht20>
|
||||||
+<modules/sensors/Sht30>
|
+<modules/sensors/Sht30>
|
||||||
+<modules/sensors/Sonar>
|
+<modules/sensors/Sonar>
|
||||||
+<modules/sensors/UART>
|
+<modules/sensors/UART>
|
||||||
|
+<modules/exec/AnalogBtn>
|
||||||
+<modules/exec/ButtonIn>
|
+<modules/exec/ButtonIn>
|
||||||
+<modules/exec/ButtonOut>
|
+<modules/exec/ButtonOut>
|
||||||
+<modules/exec/Buzzer>
|
+<modules/exec/Buzzer>
|
||||||
@@ -586,9 +587,9 @@ build_src_filter =
|
|||||||
+<modules/exec/Pcf8574>
|
+<modules/exec/Pcf8574>
|
||||||
+<modules/exec/Pwm8266>
|
+<modules/exec/Pwm8266>
|
||||||
+<modules/exec/TelegramLT>
|
+<modules/exec/TelegramLT>
|
||||||
|
+<modules/display/DwinI>
|
||||||
+<modules/display/Lcd2004>
|
+<modules/display/Lcd2004>
|
||||||
+<modules/display/Oled64>
|
+<modules/display/Oled64>
|
||||||
+<modules/display/TM16XX>
|
|
||||||
|
|
||||||
[env:esp32_4mb_fromitems]
|
[env:esp32_4mb_fromitems]
|
||||||
lib_deps =
|
lib_deps =
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t* payload, size_t length)
|
|||||||
if (headerStr == "/oiranecs|") {
|
if (headerStr == "/oiranecs|") {
|
||||||
writeFileUint8tByFrames("scenario.txt", payload, length, headerLenth, 256);
|
writeFileUint8tByFrames("scenario.txt", payload, length, headerLenth, 256);
|
||||||
clearConfigure();
|
clearConfigure();
|
||||||
|
globalVarsSync(); // в том числе подгружаем сохраненные значения элементов с флешки
|
||||||
configure("/config.json");
|
configure("/config.json");
|
||||||
iotScen.loadScenario("/scenario.txt");
|
iotScen.loadScenario("/scenario.txt");
|
||||||
// создаем событие завершения конфигурирования для возможности
|
// создаем событие завершения конфигурирования для возможности
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
void* getAPI_Cron(String subtype, String params);
|
void* getAPI_Cron(String subtype, String params);
|
||||||
void* getAPI_Loging(String subtype, String params);
|
void* getAPI_Loging(String subtype, String params);
|
||||||
void* getAPI_LogingDaily(String subtype, String params);
|
void* getAPI_LogingDaily(String subtype, String params);
|
||||||
|
void* getAPI_IoTMath(String subtype, String params);
|
||||||
void* getAPI_owmWeather(String subtype, String params);
|
void* getAPI_owmWeather(String subtype, String params);
|
||||||
void* getAPI_Timer(String subtype, String params);
|
void* getAPI_Timer(String subtype, String params);
|
||||||
void* getAPI_Variable(String subtype, String params);
|
void* getAPI_Variable(String subtype, String params);
|
||||||
@@ -16,13 +17,15 @@ void* getAPI_Bmp280(String subtype, String params);
|
|||||||
void* getAPI_Dht1122(String subtype, String params);
|
void* getAPI_Dht1122(String subtype, String params);
|
||||||
void* getAPI_Ds18b20(String subtype, String params);
|
void* getAPI_Ds18b20(String subtype, String params);
|
||||||
void* getAPI_Impulse(String subtype, String params);
|
void* getAPI_Impulse(String subtype, String params);
|
||||||
void* getAPI_Pzem004(String subtype, String params);
|
void* getAPI_MQgas(String subtype, String params);
|
||||||
|
void* getAPI_Pzem004_v2(String subtype, String params);
|
||||||
void* getAPI_RTC(String subtype, String params);
|
void* getAPI_RTC(String subtype, String params);
|
||||||
void* getAPI_S8(String subtype, String params);
|
void* getAPI_S8(String subtype, String params);
|
||||||
void* getAPI_Sht20(String subtype, String params);
|
void* getAPI_Sht20(String subtype, String params);
|
||||||
void* getAPI_Sht30(String subtype, String params);
|
void* getAPI_Sht30(String subtype, String params);
|
||||||
void* getAPI_Sonar(String subtype, String params);
|
void* getAPI_Sonar(String subtype, String params);
|
||||||
void* getAPI_UART(String subtype, String params);
|
void* getAPI_UART(String subtype, String params);
|
||||||
|
void* getAPI_AnalogBtn(String subtype, String params);
|
||||||
void* getAPI_ButtonIn(String subtype, String params);
|
void* getAPI_ButtonIn(String subtype, String params);
|
||||||
void* getAPI_ButtonOut(String subtype, String params);
|
void* getAPI_ButtonOut(String subtype, String params);
|
||||||
void* getAPI_Buzzer(String subtype, String params);
|
void* getAPI_Buzzer(String subtype, String params);
|
||||||
@@ -34,15 +37,16 @@ void* getAPI_Multitouch(String subtype, String params);
|
|||||||
void* getAPI_Pcf8574(String subtype, String params);
|
void* getAPI_Pcf8574(String subtype, String params);
|
||||||
void* getAPI_Pwm8266(String subtype, String params);
|
void* getAPI_Pwm8266(String subtype, String params);
|
||||||
void* getAPI_TelegramLT(String subtype, String params);
|
void* getAPI_TelegramLT(String subtype, String params);
|
||||||
|
void* getAPI_DwinI(String subtype, String params);
|
||||||
void* getAPI_Lcd2004(String subtype, String params);
|
void* getAPI_Lcd2004(String subtype, String params);
|
||||||
void* getAPI_Oled64(String subtype, String params);
|
void* getAPI_Oled64(String subtype, String params);
|
||||||
void* getAPI_TM16XX(String subtype, String params);
|
|
||||||
|
|
||||||
void* getAPI(String subtype, String params) {
|
void* getAPI(String subtype, String params) {
|
||||||
void* tmpAPI;
|
void* tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Cron(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Cron(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Loging(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Loging(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_LogingDaily(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_LogingDaily(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
if ((tmpAPI = getAPI_IoTMath(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_owmWeather(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_owmWeather(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Timer(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI;
|
||||||
@@ -56,13 +60,15 @@ if ((tmpAPI = getAPI_Bmp280(subtype, params)) != nullptr) return tmpAPI;
|
|||||||
if ((tmpAPI = getAPI_Dht1122(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Dht1122(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Ds18b20(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Impulse(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Impulse(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Pzem004(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_MQgas(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
if ((tmpAPI = getAPI_Pzem004_v2(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_RTC(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_RTC(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_S8(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_S8(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Sht20(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Sht30(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Sht30(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_UART(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_UART(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
if ((tmpAPI = getAPI_AnalogBtn(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_ButtonIn(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_ButtonIn(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_ButtonOut(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_ButtonOut(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Buzzer(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Buzzer(subtype, params)) != nullptr) return tmpAPI;
|
||||||
@@ -74,8 +80,8 @@ if ((tmpAPI = getAPI_Multitouch(subtype, params)) != nullptr) return tmpAPI;
|
|||||||
if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_TelegramLT(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
if ((tmpAPI = getAPI_DwinI(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Lcd2004(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Oled64(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Oled64(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_TM16XX(subtype, params)) != nullptr) return tmpAPI;
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -4,19 +4,103 @@
|
|||||||
#include <TM1637.h>
|
#include <TM1637.h>
|
||||||
#include <TM1638.h>
|
#include <TM1638.h>
|
||||||
#include <TM16xxDisplay.h>
|
#include <TM16xxDisplay.h>
|
||||||
|
#include <TM16xxbuttons.h>
|
||||||
|
|
||||||
|
|
||||||
|
TM16xxButtons* buttons = nullptr; // указатель на объект управления кнопками для TM1638 иначе nullptr
|
||||||
|
IoTItem* iotItemObj = nullptr; // указатель на объект конфигурации для доступа из функций calback
|
||||||
|
|
||||||
|
void setIotItemValue(int buttonNum, int state) {
|
||||||
|
if (iotItemObj) {
|
||||||
|
String id = iotItemObj->getID() + "_" + String(buttonNum);
|
||||||
|
for (std::list<IoTItem*>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
||||||
|
if ((*it)->getID() == id) {
|
||||||
|
IoTValue value;
|
||||||
|
value.valD = state;
|
||||||
|
(*it)->setValue(value);
|
||||||
|
//value.valD = 0; // сбрасываем состояние в нулевое если статус конечный (т.к. библиотека отрабатывает события не по порядку)
|
||||||
|
//if (state == 1 || state == 5 || state == 2) (*it)->setValue(value, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Release function will be called when a button was released.
|
||||||
|
// It can be used for fast actions when no click or double click needs to be detected.
|
||||||
|
void fnRelease(byte nButton) {
|
||||||
|
// using isPressed or is LongPressed a shift-key can be implemented
|
||||||
|
if(buttons->isLongPressed(0))
|
||||||
|
Serial.print(F("Button 0 still longpressed. "));
|
||||||
|
else if(buttons->isPressed(0))
|
||||||
|
Serial.print(F("Button 0 still pressed. "));
|
||||||
|
|
||||||
|
Serial.print(F("Button "));
|
||||||
|
Serial.print(nButton);
|
||||||
|
Serial.println(F(" release."));
|
||||||
|
|
||||||
|
setIotItemValue(nButton, 0);
|
||||||
|
} // release
|
||||||
|
|
||||||
|
|
||||||
|
// This function will be called when a button was pressed 1 time (without a second press).
|
||||||
|
void fnClick(byte nButton) {
|
||||||
|
Serial.print(F("Button "));
|
||||||
|
Serial.print(nButton);
|
||||||
|
Serial.println(F(" click."));
|
||||||
|
|
||||||
|
setIotItemValue(nButton, 1);
|
||||||
|
} // click
|
||||||
|
|
||||||
|
|
||||||
|
// This function will be called when a button was pressed 2 times in a short timeframe.
|
||||||
|
void fnDoubleclick(byte nButton) {
|
||||||
|
Serial.print(F("Button "));
|
||||||
|
Serial.print(nButton);
|
||||||
|
Serial.println(F(" doubleclick."));
|
||||||
|
|
||||||
|
setIotItemValue(nButton, 2);
|
||||||
|
} // doubleclick
|
||||||
|
|
||||||
|
|
||||||
|
// This function will be called once, when a button is pressed for a long time.
|
||||||
|
void fnLongPressStart(byte nButton) {
|
||||||
|
Serial.print(F("Button "));
|
||||||
|
Serial.print(nButton);
|
||||||
|
Serial.println(F(" longPress start"));
|
||||||
|
|
||||||
|
setIotItemValue(nButton, 3);
|
||||||
|
} // longPressStart
|
||||||
|
|
||||||
|
|
||||||
|
// This function will be called often, while a button is pressed for a long time.
|
||||||
|
void fnLongPress(byte nButton) {
|
||||||
|
Serial.print(F("Button "));
|
||||||
|
Serial.print(nButton);
|
||||||
|
Serial.println(F(" longPress..."));
|
||||||
|
|
||||||
|
setIotItemValue(nButton, 4);
|
||||||
|
} // longPress
|
||||||
|
|
||||||
|
|
||||||
|
// This function will be called once, when a button is released after beeing pressed for a long time.
|
||||||
|
void fnLongPressStop(byte nButton) {
|
||||||
|
Serial.print(F("Button "));
|
||||||
|
Serial.print(nButton);
|
||||||
|
Serial.println(F(" longPress stop"));
|
||||||
|
|
||||||
|
setIotItemValue(nButton, 5);
|
||||||
|
} // longPressStop
|
||||||
|
|
||||||
|
|
||||||
class TM16XX : public IoTItem {
|
class TM16XX : public IoTItem {
|
||||||
private:
|
private:
|
||||||
TM16xxDisplay *_display = nullptr;
|
TM16xxDisplay *_display = nullptr;
|
||||||
TM16xx *_module = nullptr;
|
TM16xx *_module = nullptr;
|
||||||
std::vector<String> _ids2show;
|
String _id2show;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TM16XX(String parameters) : IoTItem(parameters) {
|
TM16XX(String parameters) : IoTItem(parameters) {
|
||||||
//jsonRead(parameters, "id2show", _id2show);
|
|
||||||
|
|
||||||
int DIO, CLK, STB, chip, numDigits, intensity;
|
int DIO, CLK, STB, chip, numDigits, intensity;
|
||||||
bool onoff;
|
bool onoff;
|
||||||
String id2show;
|
String id2show;
|
||||||
@@ -28,58 +112,97 @@ class TM16XX : public IoTItem {
|
|||||||
jsonRead(parameters, "intensity", intensity);
|
jsonRead(parameters, "intensity", intensity);
|
||||||
jsonRead(parameters, "on", onoff);
|
jsonRead(parameters, "on", onoff);
|
||||||
|
|
||||||
jsonRead(parameters, "id2show", id2show);
|
jsonRead(parameters, "id2show", _id2show);
|
||||||
if (id2show != "") _ids2show = splitStr(id2show, ",");
|
|
||||||
|
|
||||||
if (chip == 1637) {
|
if (chip == 1637) {
|
||||||
_module = new TM1637(DIO, CLK, numDigits);
|
_module = new TM1637(DIO, CLK, numDigits);
|
||||||
} else if (chip == 1638) {
|
} else if (chip == 1638) {
|
||||||
_module = new TM1638(DIO, CLK, STB, numDigits);
|
_module = new TM1638(DIO, CLK, STB, numDigits);
|
||||||
|
buttons = new TM16xxButtons(_module);
|
||||||
|
buttons->attachRelease(fnRelease);
|
||||||
|
buttons->attachClick(fnClick);
|
||||||
|
buttons->attachDoubleClick(fnDoubleclick);
|
||||||
|
buttons->attachLongPressStart(fnLongPressStart);
|
||||||
|
buttons->attachLongPressStop(fnLongPressStop);
|
||||||
|
buttons->attachDuringLongPress(fnLongPress);
|
||||||
}
|
}
|
||||||
_module->setupDisplay(onoff, intensity);
|
_module->setupDisplay(onoff, intensity);
|
||||||
_display = new TM16xxDisplay(_module, numDigits);
|
_display = new TM16xxDisplay(_module, numDigits);
|
||||||
|
_display->println(getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
void doByInterval() {
|
byte btLeds=0;
|
||||||
|
byte btPosition=0;
|
||||||
|
void loop() {
|
||||||
|
if(buttons) buttons->tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setValue(const IoTValue& Value, bool genEvent = true) {
|
void setValue(const IoTValue& Value, bool genEvent = true) {
|
||||||
if (_display == nullptr) return;
|
if (_display == nullptr) return;
|
||||||
|
|
||||||
value = Value;
|
value = Value;
|
||||||
_display->println(getValue());
|
//_display->println(getValue());
|
||||||
|
_display->printf("%4s\n", getValue());
|
||||||
IoTItem::setValue(Value, genEvent);
|
IoTItem::setValue(Value, genEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onRegEvent(IoTItem* eventItem) {
|
void onRegEvent(IoTItem* eventItem) {
|
||||||
if (_display == nullptr) return;
|
if (_display == nullptr) return;
|
||||||
if (!eventItem || _ids2show.size() == 0) return;
|
if (!eventItem || _id2show == "") return;
|
||||||
|
|
||||||
|
//_display->println(eventItem->getValue());
|
||||||
|
if (_id2show == eventItem->getID()) {
|
||||||
|
setValue(eventItem->value, false);
|
||||||
|
}
|
||||||
|
// } else {
|
||||||
|
// _display->println();
|
||||||
|
// for (int i = 0; i < _ids2show.size(); i++) {
|
||||||
|
// IoTItem* item = findIoTItem(_ids2show[i]);
|
||||||
|
// if (item) {
|
||||||
|
// _display->print(item->getValue());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
if (strInVector(eventItem->getID(), _ids2show)) {
|
IoTValue execute(String command, std::vector<IoTValue>& param) {
|
||||||
if (_ids2show.size() == 1) {
|
if (command == "setLEDs") {
|
||||||
_display->println(eventItem->getValue());
|
if (param.size() == 1) {
|
||||||
} else {
|
((TM1638*)_module)->setLEDs(param[0].valD);
|
||||||
_display->println();
|
}
|
||||||
for (int i = 0; i < _ids2show.size(); i++) {
|
} else if (command == "onLED") {
|
||||||
IoTItem* item = findIoTItem(_ids2show[i]);
|
if (param.size() == 1) {
|
||||||
if (item) {
|
((TM1638*)_module)->setLED(TM1638_COLOR_RED, param[0].valD - 1);
|
||||||
_display->print(item->getValue());
|
}
|
||||||
}
|
} else if (command == "offLED") {
|
||||||
}
|
if (param.size() == 1) {
|
||||||
|
((TM1638*)_module)->setLED(TM1638_COLOR_GREEN, param[0].valD - 1);
|
||||||
|
}
|
||||||
|
} else if (command == "setParamLED") {
|
||||||
|
if (param.size() == 2) {
|
||||||
|
_module->setupDisplay(param[0].valD, param[1].valD);
|
||||||
|
}
|
||||||
|
} else if (command == "id2show") {
|
||||||
|
if (param.size() == 1) {
|
||||||
|
_id2show = param[0].valS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
~TM16XX() {
|
~TM16XX() {
|
||||||
delete _display;
|
if (_display) delete _display;
|
||||||
delete _module;
|
if (_module) delete _module;
|
||||||
|
if (buttons) delete buttons;
|
||||||
|
iotItemObj = nullptr;
|
||||||
|
buttons = nullptr;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
void *getAPI_TM16XX(String subtype, String param) {
|
void *getAPI_TM16XX(String subtype, String param) {
|
||||||
if (subtype == F("TM16XX")) {
|
if (subtype == F("TM16XX")) {
|
||||||
return new TM16XX(param);
|
return iotItemObj = new TM16XX(param);
|
||||||
} else {
|
} else {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
243
src/modules/display/TM16XX/example.json
Normal file
243
src/modules/display/TM16XX/example.json
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
{
|
||||||
|
"mark": "iotm",
|
||||||
|
"config": [
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "TM16XX",
|
||||||
|
"id": "tm",
|
||||||
|
"widget": "inputDgt",
|
||||||
|
"page": "screens",
|
||||||
|
"descr": "Экран",
|
||||||
|
"round": 0,
|
||||||
|
"chip": "1638",
|
||||||
|
"numDigits": "8",
|
||||||
|
"DIO": "13",
|
||||||
|
"CLK": "14",
|
||||||
|
"STB": "27",
|
||||||
|
"intensity": "5",
|
||||||
|
"on": "1",
|
||||||
|
"id2show": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "ButtonOut",
|
||||||
|
"needSave": 0,
|
||||||
|
"id": "led",
|
||||||
|
"widget": "toggle",
|
||||||
|
"page": "screens",
|
||||||
|
"descr": "Освещение",
|
||||||
|
"int": 0,
|
||||||
|
"inv": 0,
|
||||||
|
"pin": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_16",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_18",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_20",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_22",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_17",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_19",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_21",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "tm_23",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Вывод",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "Timer",
|
||||||
|
"id": "timer1",
|
||||||
|
"widget": "anydataDef",
|
||||||
|
"page": "Таймеры",
|
||||||
|
"descr": "Таймер1",
|
||||||
|
"int": 1,
|
||||||
|
"countDown": "1000",
|
||||||
|
"ticker": "1",
|
||||||
|
"repeat": 1,
|
||||||
|
"needSave": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "Timer",
|
||||||
|
"id": "timer2",
|
||||||
|
"widget": "anydataDef",
|
||||||
|
"page": "Таймеры",
|
||||||
|
"descr": "Таймер2",
|
||||||
|
"int": "15",
|
||||||
|
"countDown": "1000",
|
||||||
|
"ticker": 1,
|
||||||
|
"repeat": 1,
|
||||||
|
"needSave": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "page",
|
||||||
|
"needSave": 0,
|
||||||
|
"widget": "anydataDef",
|
||||||
|
"page": "Таймеры",
|
||||||
|
"descr": "Значение",
|
||||||
|
"int": "0",
|
||||||
|
"val": "1",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
scenario=>if tm_23 == 1 then tm.offLED(8) # выкл 8 леда при одном клике на кнопку 23
|
||||||
|
if tm_23 == 2 then tm.onLED(8) # вкл 8 леда при двойном клике на кнопку 23
|
||||||
|
if tm_23 == 5 then { # сброс всех индикаторов при долгом нажатии на кнопку 23
|
||||||
|
tm = 0
|
||||||
|
tm.setLEDs(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if tm_16 == 4 then tm = tm - 100 # уменьшаем на 100 и увеличиваем при длительном нажатии
|
||||||
|
if tm_18 == 4 then tm = tm + 100
|
||||||
|
|
||||||
|
if tm_16 == 1 then tm = tm - 1
|
||||||
|
if tm_18 == 1 then tm = tm + 1
|
||||||
|
|
||||||
|
if tm_16 == 2 then tm = tm - 1000
|
||||||
|
if tm_18 == 2 then tm = tm + 1000
|
||||||
|
|
||||||
|
if timer1 >= 0 then tm.setLEDs(timer1)
|
||||||
|
|
||||||
|
if tm_20 == 1 then tm = "HELLO!!"
|
||||||
|
|
||||||
|
if tm_22 == 1 then tm.setParamLED(0, 7)
|
||||||
|
if tm_17 == 1 then tm.setParamLED(1, 7)
|
||||||
|
if tm_17 == 2 then tm.setParamLED(1, 0)
|
||||||
|
|
||||||
|
if timer1 >= 0 & page == 1 then tm = "ttt1" + timer1
|
||||||
|
if timer2 >= 0 & page == 2 then tm = "ttt2" + timer2
|
||||||
|
if timer1 >= 0 | timer2 >= 0 then {
|
||||||
|
if page == 3 then tm = timer1 + " " + timer2
|
||||||
|
}
|
||||||
|
if page == 0 then tm.setParamLED(0, 5)
|
||||||
|
if page > 0 then tm.setParamLED(1, 5)
|
||||||
|
|
||||||
|
if tm_19 == 1 then page = page - 1
|
||||||
|
if tm_21 == 1 then page = page + 1
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"numDigits": 4,
|
"numDigits": 4,
|
||||||
"DIO": "13",
|
"DIO": "13",
|
||||||
"CLK": "14",
|
"CLK": "14",
|
||||||
"STB": "12",
|
"STB": "21",
|
||||||
"intensity": "5",
|
"intensity": "5",
|
||||||
"on": "1",
|
"on": "1",
|
||||||
"id2show": ""
|
"id2show": ""
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
"esp8266_4mb": 15
|
"esp8266_4mb": 15
|
||||||
},
|
},
|
||||||
"moduleDesc": "Позволяет выводить на 7 сегментный экран серии TM16XX (TM1637, TM1638). Может быть расширен до поддержки TM1616, TM1620, TM1628, TM1630, TM1637, TM1638, TM1640, TM1650, TM1652 и TM1668",
|
"moduleDesc": "Позволяет выводить на 7 сегментный экран серии TM16XX (TM1637, TM1638). Может быть расширен до поддержки TM1616, TM1620, TM1628, TM1630, TM1637, TM1638, TM1640, TM1650, TM1652 и TM1668",
|
||||||
|
"retInfo": "Если не установлен ИД для отслеживания значения, то внутренняя переменная будет использоваться как источник для информации",
|
||||||
"propInfo": {
|
"propInfo": {
|
||||||
"int": "Период времени в секундах обновления информации на экране по конкретному элементу.",
|
"int": "Период времени в секундах обновления информации на экране по конкретному элементу.",
|
||||||
"chip": "Номер чипа TM1637 или TM1638",
|
"chip": "Номер чипа TM1637 или TM1638",
|
||||||
@@ -42,54 +43,28 @@
|
|||||||
"intensity": "Яркость 0-7",
|
"intensity": "Яркость 0-7",
|
||||||
"on": "Вкл/выкл при старте 1/0",
|
"on": "Вкл/выкл при старте 1/0",
|
||||||
"STB": "Номер пина стекового сигнала - не используется на определенных моделях",
|
"STB": "Номер пина стекового сигнала - не используется на определенных моделях",
|
||||||
"id2show": "id элемента конфигурации для отображения. Если пустая строка, то дисплей использует свою переменную. Если указать несколько значений через запятую, то все данные будут последовательно выводиться в строку."
|
"id2show": "id элемента конфигурации для отображения. Если пустая строка, то дисплей использует свою переменную."
|
||||||
},
|
},
|
||||||
"funcInfo": [
|
"funcInfo": [
|
||||||
{
|
{
|
||||||
"name": "noBacklight",
|
"name": "setLEDs",
|
||||||
"descr": "Выключить подсветку",
|
"descr": "Зажигает верхние светодиоды через установку байта, где каждый разряд соответствует диоду. От 0 до 255",
|
||||||
"params": []
|
"params": ["Значение байта"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "backlight",
|
"name": "onLED",
|
||||||
"descr": "Включить подсветку",
|
"descr": "Включить один диод",
|
||||||
"params": []
|
"params": ["Номер диода"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "noDisplay",
|
"name": "offLED",
|
||||||
"descr": "Спрятать все данные",
|
"descr": "Выключить один диод",
|
||||||
"params": []
|
"params": ["Номер диода"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "display",
|
"name": "setParamLED",
|
||||||
"descr": "Показать данные на экране",
|
"descr": "Включить/выключить (1/0) и установить яркость от 0 до 7 дисплея",
|
||||||
"params": []
|
"params": ["Вкл/Выкл", "Яркость"]
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "toggle",
|
|
||||||
"descr": "Переключает видимость значений на экране",
|
|
||||||
"params": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "x",
|
|
||||||
"descr": "Устанавливает первую координату",
|
|
||||||
"params": [
|
|
||||||
"Номер строки первого символа"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "y",
|
|
||||||
"descr": "Устанавливает вторую координату",
|
|
||||||
"params": [
|
|
||||||
"Номер столбца первого символа"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "descr",
|
|
||||||
"descr": "Задает приставку слева от значения",
|
|
||||||
"params": [
|
|
||||||
"Строка"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "id2show",
|
"name": "id2show",
|
||||||
@@ -100,56 +75,16 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"defActive": true,
|
"defActive": false,
|
||||||
"usedLibs": {
|
"usedLibs": {
|
||||||
"esp32_4mb": [
|
"esp32*": [
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
"https://github.com/maxint-rd/TM16xx",
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
"https://github.com/adafruit/Adafruit-GFX-Library",
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||||
],
|
],
|
||||||
"esp32_4mb3f": [
|
"esp82*": [
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
"https://github.com/maxint-rd/TM16xx",
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
"https://github.com/adafruit/Adafruit-GFX-Library",
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp32cam_4mb": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp8266_4mb": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp8266_1mb": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp8266_1mb_ota": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp8285_1mb": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp8285_1mb_ota": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp8266_2mb": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
|
||||||
],
|
|
||||||
"esp8266_2mb_ota": [
|
|
||||||
"https://github.com/maxint-rd/TM16xx",
|
|
||||||
"adafruit/Adafruit GFX Library @ ^1.11.5",
|
|
||||||
"adafruit/Adafruit BusIO @ ^1.13.2"
|
"adafruit/Adafruit BusIO @ ^1.13.2"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
54
src/modules/exec/AnalogBtn/AnalogBtn.cpp
Normal file
54
src/modules/exec/AnalogBtn/AnalogBtn.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
#include "Global.h"
|
||||||
|
#include "classes/IoTItem.h"
|
||||||
|
|
||||||
|
extern IoTGpio IoTgpio;
|
||||||
|
|
||||||
|
|
||||||
|
class AnalogBtn : public IoTItem {
|
||||||
|
private:
|
||||||
|
int _pin, _aValue, _delta;
|
||||||
|
int _oldVal, _newVal;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AnalogBtn(String parameters) : IoTItem(parameters) {
|
||||||
|
_pin = 0;
|
||||||
|
_aValue = 0;
|
||||||
|
_delta = 50;
|
||||||
|
jsonRead(parameters, "pin", _pin);
|
||||||
|
jsonRead(parameters, "aValue", _aValue);
|
||||||
|
jsonRead(parameters, "delta", _delta);
|
||||||
|
_round = 0;
|
||||||
|
setInterval(-100);
|
||||||
|
}
|
||||||
|
|
||||||
|
void doByInterval() {
|
||||||
|
_newVal = IoTgpio.analogRead(_pin);
|
||||||
|
if (_aValue == -1 && _oldVal != _newVal) {
|
||||||
|
_oldVal = _newVal;
|
||||||
|
SerialPrint("i", "AnalogBtn", (String)_newVal);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((_newVal > _aValue - _delta) && (_newVal < _aValue + _delta)) {
|
||||||
|
if (value.valD == 0) {
|
||||||
|
value.valD = 1;
|
||||||
|
regEvent(value.valD, "AnalogBtn");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (value.valD == 1) {
|
||||||
|
value.valD = 0;
|
||||||
|
regEvent(value.valD, "AnalogBtn");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
~AnalogBtn() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
void* getAPI_AnalogBtn(String subtype, String param) {
|
||||||
|
if (subtype == F("AnalogBtn")) {
|
||||||
|
return new AnalogBtn(param);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/modules/exec/AnalogBtn/modinfo.json
Normal file
43
src/modules/exec/AnalogBtn/modinfo.json
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"menuSection": "executive_devices",
|
||||||
|
"configItem": [
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"name": "Аналоговая кнопка",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "AnalogBtn",
|
||||||
|
"id": "abtn",
|
||||||
|
"widget": "toggle",
|
||||||
|
"page": "Кнопки",
|
||||||
|
"descr": "Освещение",
|
||||||
|
"pin": 34,
|
||||||
|
"aValue": -1,
|
||||||
|
"delta": 50
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"about": {
|
||||||
|
"authorName": "Ilya Belyakov",
|
||||||
|
"authorContact": "https://t.me/Biveraxe",
|
||||||
|
"authorGit": "https://github.com/biveraxe",
|
||||||
|
"exampleURL": "https://iotmanager.org/wiki",
|
||||||
|
"specialThanks": "",
|
||||||
|
"moduleName": "AnalogBtn",
|
||||||
|
"moduleVersion": "1.0",
|
||||||
|
"usedRam": {
|
||||||
|
"esp32_4mb": 15,
|
||||||
|
"esp8266_4mb": 15
|
||||||
|
},
|
||||||
|
"title": "Аналоговая кнопка",
|
||||||
|
"moduleDesc": "Позволяет получить состояние кнопки на аналоговом пине.",
|
||||||
|
"propInfo": {
|
||||||
|
"pin": "Аналоговый GPIO номер, к которому подключена кнопка.",
|
||||||
|
"aValue": "Значение кнопки в диапазоне от 0 до 1023 (8266) или от 0 до 4095 (esp32). Если =-1 то включается режим отладки и в консоль отправляются значения нажимаемой кнопки.",
|
||||||
|
"delta": "Погрешность срабатывания кнопки в диапазоне +-delta."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defActive": true,
|
||||||
|
"usedLibs": {
|
||||||
|
"esp32*": [],
|
||||||
|
"esp82*": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,12 +15,19 @@ class IoTServo : public IoTItem {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
IoTServo(String parameters): IoTItem(parameters) {
|
IoTServo(String parameters): IoTItem(parameters) {
|
||||||
int pin, minPulseWidth, maxPulseWidth, neutralPulseWidth;
|
int pin, minPulseWidth, maxPulseWidth, minAngle, maxAngle;
|
||||||
jsonRead(parameters, "pin", pin);
|
jsonRead(parameters, "pin", pin);
|
||||||
jsonRead(parameters, "minPulseWidth", minPulseWidth);
|
jsonRead(parameters, "minPulseWidth", minPulseWidth);
|
||||||
jsonRead(parameters, "maxPulseWidth", maxPulseWidth);
|
jsonRead(parameters, "maxPulseWidth", maxPulseWidth);
|
||||||
jsonRead(parameters, "neutralPulseWidth", neutralPulseWidth);
|
jsonRead(parameters, "minAngle", minAngle);
|
||||||
servObj.attach(pin, minPulseWidth, maxPulseWidth, neutralPulseWidth);
|
jsonRead(parameters, "maxAngle", maxAngle);
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
servObj.attach(pin, Servo::CHANNEL_NOT_ATTACHED, minAngle, maxAngle, minPulseWidth, maxPulseWidth);
|
||||||
|
#endif
|
||||||
|
#ifdef ESP8266
|
||||||
|
servObj.attach(pin, minPulseWidth, maxPulseWidth, value.valD);
|
||||||
|
#endif
|
||||||
|
|
||||||
// jsonRead(parameters, "apin", _apin);
|
// jsonRead(parameters, "apin", _apin);
|
||||||
// if (_apin >= 0) IoTgpio.pinMode(_apin, INPUT);
|
// if (_apin >= 0) IoTgpio.pinMode(_apin, INPUT);
|
||||||
|
|||||||
@@ -13,7 +13,8 @@
|
|||||||
"pin": 12,
|
"pin": 12,
|
||||||
"minPulseWidth": 544,
|
"minPulseWidth": 544,
|
||||||
"maxPulseWidth": 2400,
|
"maxPulseWidth": 2400,
|
||||||
"neutralPulseWidth": 1500,
|
"minAngle": 0,
|
||||||
|
"maxAngle": 180,
|
||||||
"trackingID": ""
|
"trackingID": ""
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -34,7 +35,8 @@
|
|||||||
"pin": "Пин, к которому подключен сервопривод",
|
"pin": "Пин, к которому подключен сервопривод",
|
||||||
"minPulseWidth": "Минимальная длина импульса",
|
"minPulseWidth": "Минимальная длина импульса",
|
||||||
"maxPulseWidth": "Максимальная длина импульса",
|
"maxPulseWidth": "Максимальная длина импульса",
|
||||||
"neutralPulseWidth": "Нейтральная длина импульса",
|
"minAngle": "Минимальное значение угла (имеет значение для ESP32)",
|
||||||
|
"maxAngle": "Максимальное значение угла (имеет значение для ESP32)",
|
||||||
"trackingID": "Идентификатор отслеживания значения другого элемента конфигурации, например, чтение аналога"
|
"trackingID": "Идентификатор отслеживания значения другого элемента конфигурации, например, чтение аналога"
|
||||||
},
|
},
|
||||||
"retInfo": "Содержит текущее значение поворота",
|
"retInfo": "Содержит текущее значение поворота",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
// #include "esp_camera.h"
|
// #include "esp_camera.h"
|
||||||
|
|
||||||
#include <FastBot.h>
|
#include <FastBot.h>
|
||||||
#include <vector>
|
#include <map>
|
||||||
|
|
||||||
// FastBot _myBot;
|
// FastBot _myBot;
|
||||||
FastBot *_myBot = nullptr;
|
FastBot *_myBot = nullptr;
|
||||||
@@ -28,6 +28,17 @@ String _chatID;
|
|||||||
bool _autos;
|
bool _autos;
|
||||||
bool _initSD;
|
bool _initSD;
|
||||||
|
|
||||||
|
struct ButtonMenu
|
||||||
|
{
|
||||||
|
String message = "";
|
||||||
|
String getId = "";
|
||||||
|
String setId = "";
|
||||||
|
String value = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
std::map<String, ButtonMenu *> mapBtnMenu; // <btnName, ID>
|
||||||
|
std::map<String, ButtonMenu *> mapBtnInline; // <btnName, ID>
|
||||||
|
|
||||||
class Telegram_v2 : public IoTItem
|
class Telegram_v2 : public IoTItem
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -43,6 +54,7 @@ public:
|
|||||||
jsonRead(parameters, "receiveMsg", _receiveMsg);
|
jsonRead(parameters, "receiveMsg", _receiveMsg);
|
||||||
jsonRead(parameters, "chatID", _chatID);
|
jsonRead(parameters, "chatID", _chatID);
|
||||||
instanceBot();
|
instanceBot();
|
||||||
|
// _myBot->setTextMode(FB_MARKDOWN);
|
||||||
_myBot->attach(telegramMsgParse);
|
_myBot->attach(telegramMsgParse);
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
@@ -69,9 +81,13 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//=============++====== Обработка команд сценария =============================
|
||||||
|
//=============================================================================
|
||||||
IoTValue execute(String command, std::vector<IoTValue> ¶m)
|
IoTValue execute(String command, std::vector<IoTValue> ¶m)
|
||||||
{
|
{
|
||||||
if (!isNetworkActive()) return {};
|
if (!isNetworkActive())
|
||||||
|
return {};
|
||||||
if (command == "sendMsg")
|
if (command == "sendMsg")
|
||||||
{
|
{
|
||||||
if (param.size())
|
if (param.size())
|
||||||
@@ -108,9 +124,14 @@ public:
|
|||||||
_myBot->sendMessage(strTmp, _chatID);
|
_myBot->sendMessage(strTmp, _chatID);
|
||||||
_myBot->pinMessage(_myBot->lastBotMsg());
|
_myBot->pinMessage(_myBot->lastBotMsg());
|
||||||
|
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ",pin msg: " + strTmp);
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", pin msg: " + strTmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (command == "unpinAllMsg")
|
||||||
|
{
|
||||||
|
_myBot->unpinAll(_chatID);
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", unpin all message");
|
||||||
|
}
|
||||||
else if (command == "editMsg")
|
else if (command == "editMsg")
|
||||||
{
|
{
|
||||||
if (param.size())
|
if (param.size())
|
||||||
@@ -121,7 +142,7 @@ public:
|
|||||||
else
|
else
|
||||||
strTmp = param[0].valS;
|
strTmp = param[0].valS;
|
||||||
_myBot->editMessage(_myBot->lastBotMsg(), strTmp);
|
_myBot->editMessage(_myBot->lastBotMsg(), strTmp);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ",edit msg: " + strTmp);
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", edit msg: " + strTmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (command == "sendFile")
|
else if (command == "sendFile")
|
||||||
@@ -139,10 +160,9 @@ public:
|
|||||||
// selectToMarkerLast(msg.text, "_")
|
// selectToMarkerLast(msg.text, "_")
|
||||||
uint8_t res = _myBot->sendFile(file, (FB_FileType)param[1].valD, selectToMarkerLast(param[0].valS, "/"), _chatID);
|
uint8_t res = _myBot->sendFile(file, (FB_FileType)param[1].valD, selectToMarkerLast(param[0].valS, "/"), _chatID);
|
||||||
file.close();
|
file.close();
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", sendFile: " + param[0].valS + " res: " + String(res));
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", sendFile: " + param[0].valS + " res: " + String(res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (command == "editFile")
|
else if (command == "editFile")
|
||||||
{
|
{
|
||||||
if (param.size() && !param[0].isDecimal)
|
if (param.size() && !param[0].isDecimal)
|
||||||
@@ -158,28 +178,297 @@ public:
|
|||||||
// selectToMarkerLast(msg.text, "_")
|
// selectToMarkerLast(msg.text, "_")
|
||||||
uint8_t res = _myBot->editFile(file, (FB_FileType)param[1].valD, selectToMarkerLast(param[0].valS, "/"), _myBot->lastBotMsg(), _chatID);
|
uint8_t res = _myBot->editFile(file, (FB_FileType)param[1].valD, selectToMarkerLast(param[0].valS, "/"), _myBot->lastBotMsg(), _chatID);
|
||||||
file.close();
|
file.close();
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", editFile: " + param[0].valS + " res: " + String(res));
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", editFile: " + param[0].valS + " res: " + String(res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (command == "btnMenu")
|
||||||
|
{
|
||||||
|
mapBtnMenu[param[0].valS] = new ButtonMenu;
|
||||||
|
if (param.size() == 3) // btnMenu("Name", message, getId);
|
||||||
|
{
|
||||||
|
// if (IoTItems.find(param[2].valS) != IoTItems.end())
|
||||||
|
// {
|
||||||
|
mapBtnMenu[param[0].valS]->message = param[1].valS;
|
||||||
|
mapBtnMenu[param[0].valS]->getId = param[2].valS;
|
||||||
|
// mapBtnMenu[param[0].valS] = btn;
|
||||||
|
SerialPrint("i", F("Telegram"), "add button menu: " + param[0].valS + ", get id: " + param[2].valS);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else if (param.size() == 5) // btnMenu("Name", message, getId, setId, value);
|
||||||
|
{
|
||||||
|
// if (IoTItems.find(param[2].valS) != IoTItems.end())
|
||||||
|
// {
|
||||||
|
mapBtnMenu[param[0].valS]->message = param[1].valS;
|
||||||
|
mapBtnMenu[param[0].valS]->getId = param[2].valS;
|
||||||
|
mapBtnMenu[param[0].valS]->setId = param[3].valS;
|
||||||
|
mapBtnMenu[param[0].valS]->value = param[4].valS;
|
||||||
|
// mapBtnMenu[param[0].valS] = btn;
|
||||||
|
SerialPrint("i", F("Telegram"), "add button menu: " + param[0].valS + ",get id: " + param[2].valS + ",set id: " + param[3].valS + "=" + param[4].valS);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (command == "showMenu")
|
||||||
|
{
|
||||||
|
String out;
|
||||||
|
// перебирвем весь мап и строим меню
|
||||||
|
uint8_t cnt = 0;
|
||||||
|
for (auto it = mapBtnMenu.begin(); it != mapBtnMenu.end(); it++)
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
if (cnt % 2 == 0)
|
||||||
|
{
|
||||||
|
out += " \t " + it->first;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (it == mapBtnMenu.begin())
|
||||||
|
out = it->first;
|
||||||
|
else
|
||||||
|
out += " \n " + it->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_myBot->showMenuText("Menu", out, true);
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", show menu: \n" + out);
|
||||||
|
}
|
||||||
|
else if (command == "btnInline")
|
||||||
|
{
|
||||||
|
mapBtnInline[param[0].valS] = new ButtonMenu;
|
||||||
|
if (param.size() == 3) // btnMenu("Name", message, getId);
|
||||||
|
{
|
||||||
|
// if (IoTItems.find(param[2].valS) != IoTItems.end())
|
||||||
|
// {
|
||||||
|
mapBtnInline[param[0].valS]->message = param[1].valS;
|
||||||
|
mapBtnInline[param[0].valS]->getId = param[2].valS;
|
||||||
|
// mapBtnMenu[param[0].valS] = btn;
|
||||||
|
SerialPrint("i", "Telegram", "add button inline: " + param[0].valS + ", get id: " + param[2].valS);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
else if (param.size() == 5) // btnMenu("Name", message, getId, setId, value);
|
||||||
|
{
|
||||||
|
// if (IoTItems.find(param[2].valS) != IoTItems.end())
|
||||||
|
// {
|
||||||
|
mapBtnInline[param[0].valS]->message = param[1].valS;
|
||||||
|
mapBtnInline[param[0].valS]->getId = param[2].valS;
|
||||||
|
mapBtnInline[param[0].valS]->setId = param[3].valS;
|
||||||
|
mapBtnInline[param[0].valS]->value = param[4].valS;
|
||||||
|
// mapBtnMenu[param[0].valS] = btn;
|
||||||
|
SerialPrint("i", "Telegram", "add button inline: " + param[0].valS + ",get id: " + param[2].valS + ",set id: " + param[3].valS + "=" + param[4].valS);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (command == "showInline")
|
||||||
|
{
|
||||||
|
String out;
|
||||||
|
// перебирвем весь мап и строим меню
|
||||||
|
uint8_t cnt = 0;
|
||||||
|
for (auto it = mapBtnInline.begin(); it != mapBtnInline.end(); it++)
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
if (cnt % 2 == 0)
|
||||||
|
{
|
||||||
|
out += " \t " + it->first;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (it == mapBtnInline.begin())
|
||||||
|
out = it->first;
|
||||||
|
else
|
||||||
|
out += " \n " + it->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_myBot->inlineMenu("inline_menu", out);
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", show inline: \n" + out);
|
||||||
|
}
|
||||||
|
else if (command == "clearInline")
|
||||||
|
{
|
||||||
|
clearMapMenuInline();
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", clear inline menu ");
|
||||||
|
}
|
||||||
|
else if (command == "clearMenu")
|
||||||
|
{
|
||||||
|
clearMapMenu();
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", clear menu ");
|
||||||
|
}
|
||||||
|
else if (command == "closeMenu")
|
||||||
|
{
|
||||||
|
_myBot->closeMenu();
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", closeMenu ");
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
//=================== Обработка сообщений из чата =============================
|
||||||
|
//=============================================================================
|
||||||
void static telegramMsgParse(FB_msg &msg)
|
void static telegramMsgParse(FB_msg &msg)
|
||||||
{
|
{
|
||||||
// FB_msg msg;
|
// FB_msg msg;
|
||||||
SerialPrint("->", F("Telegram"), "chat ID: " + msg.chatID + ", msg: " + msg.text);
|
SerialPrint("i", F("Telegram"), "chat ID: " + msg.chatID + ", msg: " + msg.text);
|
||||||
// _myBot->setChatID(_chatID);
|
// _myBot->setChatID(_chatID);
|
||||||
if (_autos)
|
if (_autos)
|
||||||
{
|
{
|
||||||
_chatID = msg.chatID;
|
_chatID = msg.chatID;
|
||||||
}
|
}
|
||||||
if (msg.text.indexOf("set") != -1)
|
// -------------- Обработка кнопок меню созданного в сценарии --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
if (auto search = mapBtnMenu.find(msg.text); search != mapBtnMenu.end())
|
||||||
|
{
|
||||||
|
String outMsg;
|
||||||
|
outMsg = mapBtnMenu[msg.text]->message;
|
||||||
|
if (mapBtnMenu[msg.text]->getId != "")
|
||||||
|
{
|
||||||
|
IoTItem *item = findIoTItem(mapBtnMenu[msg.text]->getId);
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
outMsg += ": " + item->getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mapBtnMenu[msg.text]->setId != "")
|
||||||
|
{
|
||||||
|
//outMsg += ", " + mapBtnMenu[msg.text]->setId + "=" + mapBtnMenu[msg.text]->value;
|
||||||
|
generateOrder(mapBtnMenu[msg.text]->setId, mapBtnMenu[msg.text]->value);
|
||||||
|
}
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(outMsg));
|
||||||
|
_myBot->sendMessage(outMsg, _chatID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------- Обработка нажатия на пользовательском инлайн меню --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
else if (msg.text.indexOf("inline_menu") != -1)
|
||||||
|
{
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", data: " + String(msg.data));
|
||||||
|
if (auto search = mapBtnInline.find(msg.data); search != mapBtnInline.end())
|
||||||
|
{
|
||||||
|
|
||||||
|
String outMsg;
|
||||||
|
outMsg = mapBtnInline[msg.data]->message;
|
||||||
|
if (mapBtnInline[msg.data]->getId != "")
|
||||||
|
{
|
||||||
|
IoTItem *item = findIoTItem(mapBtnInline[msg.data]->getId);
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
outMsg += ": " + item->getValue();
|
||||||
|
//SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(msg.data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mapBtnInline[msg.data]->setId != "")
|
||||||
|
{
|
||||||
|
//outMsg += ", " + mapBtnInline[msg.data]->setId + "=" + mapBtnInline[msg.data]->value;
|
||||||
|
generateOrder(mapBtnInline[msg.data]->setId, mapBtnInline[msg.data]->value);
|
||||||
|
}
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(outMsg));
|
||||||
|
_myBot->sendMessage(outMsg, _chatID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// -------------- Вызов (повторный вызов) меню созданного в сценарии --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
else if (msg.text.indexOf("menu") != -1)
|
||||||
|
{
|
||||||
|
String out;
|
||||||
|
// перебирвем весь мап и строим меню
|
||||||
|
uint8_t cnt = 0;
|
||||||
|
for (auto it = mapBtnMenu.begin(); it != mapBtnMenu.end(); it++)
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
if (cnt % 2 == 0)
|
||||||
|
{
|
||||||
|
out += " \t " + it->first;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (it == mapBtnMenu.begin())
|
||||||
|
out = it->first;
|
||||||
|
else
|
||||||
|
out += " \n " + it->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_myBot->showMenuText("Menu", out, true);
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", show menu: \n" + out);
|
||||||
|
}
|
||||||
|
// -------------- вывод нижнего меню всех юнитов --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
else if (msg.text.indexOf("allMenu") != -1)
|
||||||
|
{
|
||||||
|
// String list = returnListOfParams();
|
||||||
|
String out;
|
||||||
|
// std::vector<float> vctr;
|
||||||
|
uint8_t cnt = 0;
|
||||||
|
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it)
|
||||||
|
{
|
||||||
|
if ((*it)->iAmLocal)
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
if (cnt % 2 == 0)
|
||||||
|
{
|
||||||
|
out += " \t get_" + (*it)->getID();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (it == IoTItems.begin())
|
||||||
|
out = "get_" + (*it)->getID();
|
||||||
|
else
|
||||||
|
out += " \n get_" + (*it)->getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_myBot->showMenuText("select Id", out, true);
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + "\n" + out);
|
||||||
|
// _myBot->sendMessage(CharPlot<LINE_X2>(&vctr[0], vctr.size(), 5), _chatID);
|
||||||
|
// SerialPrint("<-", F("Telegram"), CharPlot<LINE_X2>(&vctr[0], vctr.size(), 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
// -------------- Обработка нажатия в инлайн меню all (всех юнитов) --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
else if (msg.text.indexOf("all_inline") != -1 && msg.data.indexOf("get") != -1)
|
||||||
|
{
|
||||||
|
String out = deleteBeforeDelimiter(msg.data, "_");
|
||||||
|
IoTItem *item = findIoTItem(out);
|
||||||
|
if (item)
|
||||||
|
{
|
||||||
|
_myBot->sendMessage(item->getID() + ": " + item->getValue(), _chatID);
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// -------------- вывод инлайн меню всех юнитов --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
else if (msg.text.indexOf("all") != -1)
|
||||||
|
{
|
||||||
|
// String list = returnListOfParams();
|
||||||
|
String out;
|
||||||
|
// std::vector<float> vctr;
|
||||||
|
uint8_t cnt = 0;
|
||||||
|
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it)
|
||||||
|
{
|
||||||
|
if ((*it)->iAmLocal)
|
||||||
|
{
|
||||||
|
cnt++;
|
||||||
|
if (cnt % 2 == 0)
|
||||||
|
{
|
||||||
|
out += " \t get_" + (*it)->getID();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (it == IoTItems.begin())
|
||||||
|
out = "get_" + (*it)->getID();
|
||||||
|
else
|
||||||
|
out += " \n get_" + (*it)->getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_myBot->inlineMenu("all_inline", out);
|
||||||
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + "\n" + out);
|
||||||
|
}
|
||||||
|
// -------------- обработка команды /set_ID_VALUE --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
else if (msg.text.indexOf("set") != -1)
|
||||||
{
|
{
|
||||||
msg.text = deleteBeforeDelimiter(msg.text, "_");
|
msg.text = deleteBeforeDelimiter(msg.text, "_");
|
||||||
generateOrder(selectToMarker(msg.text, "_"), selectToMarkerLast(msg.text, "_"));
|
generateOrder(selectToMarker(msg.text, "_"), selectToMarkerLast(msg.text, "_"));
|
||||||
_myBot->replyMessage("order done", msg.messageID, _chatID);
|
_myBot->replyMessage("order done", msg.messageID, _chatID);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(msg.text));
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(msg.text));
|
||||||
}
|
}
|
||||||
|
// -------------- обработка команды /get_ID --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
else if (msg.text.indexOf("get") != -1)
|
else if (msg.text.indexOf("get") != -1)
|
||||||
{
|
{
|
||||||
msg.text = deleteBeforeDelimiter(msg.text, "_");
|
msg.text = deleteBeforeDelimiter(msg.text, "_");
|
||||||
@@ -187,41 +476,15 @@ public:
|
|||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
_myBot->replyMessage(item->getValue(), msg.messageID, _chatID);
|
_myBot->replyMessage(item->getValue(), msg.messageID, _chatID);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(msg.text));
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + String(msg.text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// -------------- обработка запроса пользователя на скачивание файла --------------
|
||||||
else if (msg.text.indexOf("all") != -1)
|
// -------------------------------------------------------------------------
|
||||||
{
|
|
||||||
// String list = returnListOfParams();
|
|
||||||
String out;
|
|
||||||
std::vector<float> vctr;
|
|
||||||
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it)
|
|
||||||
{
|
|
||||||
if ((*it)->iAmLocal)
|
|
||||||
{
|
|
||||||
if (it == IoTItems.begin())
|
|
||||||
{
|
|
||||||
out = "get_" + (*it)->getID();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
out = out + " \n " + "get_" + (*it)->getID();
|
|
||||||
}
|
|
||||||
vctr.push_back(atoff((*it)->getValue().c_str()));
|
|
||||||
// _myBot->sendMessage((*it)->getID() + ": " + (*it)->getValue(), _chatID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_myBot->showMenuText("select Id", out, true);
|
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + "\n" + out);
|
|
||||||
// _myBot->sendMessage(CharPlot<LINE_X2>(&vctr[0], vctr.size(), 5), _chatID);
|
|
||||||
// SerialPrint("<-", F("Telegram"), CharPlot<LINE_X2>(&vctr[0], vctr.size(), 10));
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (msg.text.indexOf("file") != -1 && msg.chatID == _chatID)
|
else if (msg.text.indexOf("file") != -1 && msg.chatID == _chatID)
|
||||||
{
|
{
|
||||||
msg.text = deleteBeforeDelimiter(msg.text, "_");
|
msg.text = deleteBeforeDelimiter(msg.text, "_");
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", get file: " + String(msg.text));
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", get file: " + String(msg.text));
|
||||||
auto file = FileFS.open(selectToMarker(msg.text, "_"), FILE_READ); // /test.png
|
auto file = FileFS.open(selectToMarker(msg.text, "_"), FILE_READ); // /test.png
|
||||||
if (!file)
|
if (!file)
|
||||||
{
|
{
|
||||||
@@ -232,6 +495,8 @@ public:
|
|||||||
_myBot->sendFile(file, (FB_FileType)type, selectToMarker(msg.text, "_"), _chatID);
|
_myBot->sendFile(file, (FB_FileType)type, selectToMarker(msg.text, "_"), _chatID);
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
// -------------- обработка файлов загруженных пользователем --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
else if (msg.isFile)
|
else if (msg.isFile)
|
||||||
{
|
{
|
||||||
if (msg.text.indexOf("download") != -1 && msg.chatID == _chatID)
|
if (msg.text.indexOf("download") != -1 && msg.chatID == _chatID)
|
||||||
@@ -240,32 +505,41 @@ public:
|
|||||||
}
|
}
|
||||||
else if (msg.text.indexOf("nextion") != -1 && msg.chatID == _chatID)
|
else if (msg.text.indexOf("nextion") != -1 && msg.chatID == _chatID)
|
||||||
{
|
{
|
||||||
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it) {
|
for (std::list<IoTItem *>::iterator it = IoTItems.begin(); it != IoTItems.end(); ++it)
|
||||||
if ((*it)->getSubtype() == "NextionUpload") {
|
{
|
||||||
(*it)->uploadNextionTlgrm(msg.fileUrl);
|
if ((*it)->getSubtype() == "NextionUpload" || (*it)->getSubtype() == "Nextion")
|
||||||
|
{
|
||||||
|
(*it)->uploadNextionTlgrm(msg.fileUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// -------------- обработка остальных команд --------------
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
else if (msg.text.indexOf("help") != -1)
|
else if (msg.text.indexOf("help") != -1)
|
||||||
{
|
{
|
||||||
_myBot->sendMessage("ID: " + chipId, _chatID);
|
_myBot->sendMessage("ID: " + chipId, _chatID);
|
||||||
_myBot->sendMessage("chatID: " + _chatID, _chatID);
|
_myBot->sendMessage("chatID: " + _chatID, _chatID);
|
||||||
_myBot->sendMessage(F("Wrong order, use /all to get all values, /get_id to get value, /set_id_value to set value, or /file_name_type or send file msg=download"), _chatID);
|
_myBot->sendMessage("Command: /help - this text \n /all - inline menu get all values \n /allMenu - bottom menu get all values \n /menu - bottom USER menu from scenario \n /get_id - get value by ID \n /set_id_value - set value in ID \n /file_name_type - take file from esp \n /file_type - support file type \n send file and write download - \"download\" file to esp \n send tft file and write \"nextion\" - flash file.tft to Nextion", _chatID);
|
||||||
|
}
|
||||||
|
else if (msg.text.indexOf("file_type") != -1)
|
||||||
|
{
|
||||||
|
_myBot->sendMessage("Support file type download: \n 0-foto \n 1-audio \n 2-doc \n 3-video \n 4-gif \n 5-voice", _chatID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// setValue(msg.text);
|
_myBot->sendMessage("Wrong order, use /help", _chatID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendTelegramMsg(bool often, String msg)
|
void sendTelegramMsg(bool often, String msg)
|
||||||
{
|
{
|
||||||
if (!isNetworkActive()) return;
|
if (!isNetworkActive())
|
||||||
|
return;
|
||||||
if (often)
|
if (often)
|
||||||
{
|
{
|
||||||
_myBot->sendMessage(msg, _chatID);
|
_myBot->sendMessage(msg, _chatID);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + msg);
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -273,23 +547,25 @@ public:
|
|||||||
{
|
{
|
||||||
_prevMsg = msg;
|
_prevMsg = msg;
|
||||||
_myBot->sendMessage(msg, _chatID);
|
_myBot->sendMessage(msg, _chatID);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", msg: " + msg);
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", msg: " + msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendFoto(uint8_t *buf, uint32_t length, const String &name)
|
void sendFoto(uint8_t *buf, uint32_t length, const String &name)
|
||||||
{
|
{
|
||||||
if (!isNetworkActive()) return;
|
if (!isNetworkActive())
|
||||||
|
return;
|
||||||
_myBot->sendFile(buf, length, FB_PHOTO, name, _chatID);
|
_myBot->sendFile(buf, length, FB_PHOTO, name, _chatID);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", send foto from esp-cam");
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", send foto from esp-cam");
|
||||||
}
|
}
|
||||||
|
|
||||||
void editFoto(uint8_t *buf, uint32_t length, const String &name)
|
void editFoto(uint8_t *buf, uint32_t length, const String &name)
|
||||||
{
|
{
|
||||||
if (!isNetworkActive()) return;
|
if (!isNetworkActive())
|
||||||
|
return;
|
||||||
_myBot->editFile(buf, length, FB_PHOTO, name, _myBot->lastBotMsg(), _chatID);
|
_myBot->editFile(buf, length, FB_PHOTO, name, _myBot->lastBotMsg(), _chatID);
|
||||||
SerialPrint("<-", F("Telegram"), "chat ID: " + _chatID + ", edit foto from esp-cam");
|
SerialPrint("i", F("Telegram"), "chat ID: " + _chatID + ", edit foto from esp-cam");
|
||||||
}
|
}
|
||||||
|
|
||||||
int static downloadFile(FB_msg &msg)
|
int static downloadFile(FB_msg &msg)
|
||||||
@@ -325,7 +601,7 @@ public:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SerialPrint("<-", F("Telegram"), "download from: " + _chatID + ", file: " + msg.fileName + " size = " + String(_size) + " byte");
|
SerialPrint("i", F("Telegram"), "download from: " + _chatID + ", file: " + msg.fileName + " size = " + String(_size) + " byte");
|
||||||
_myBot->sendMessage("Download Ok, size = " + String(_size) + " byte", _chatID);
|
_myBot->sendMessage("Download Ok, size = " + String(_size) + " byte", _chatID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,9 +617,31 @@ public:
|
|||||||
{
|
{
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
void clearMapMenu()
|
||||||
|
{
|
||||||
|
for (auto it = mapBtnMenu.begin(); it != mapBtnMenu.end(); it++)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
mapBtnMenu.clear();
|
||||||
|
for (auto it = mapBtnInline.begin(); it != mapBtnInline.end(); it++)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
mapBtnInline.clear();
|
||||||
|
}
|
||||||
|
void clearMapMenuInline()
|
||||||
|
{
|
||||||
|
for (auto it = mapBtnInline.begin(); it != mapBtnInline.end(); it++)
|
||||||
|
{
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
mapBtnInline.clear();
|
||||||
|
}
|
||||||
~Telegram_v2()
|
~Telegram_v2()
|
||||||
{
|
{
|
||||||
|
clearMapMenu();
|
||||||
|
clearMapMenuInline();
|
||||||
tlgrmItem = nullptr;
|
tlgrmItem = nullptr;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
"token": "",
|
"token": "",
|
||||||
"autos": 1,
|
"autos": 1,
|
||||||
"receiveMsg": 0,
|
"receiveMsg": 1,
|
||||||
"chatID": ""
|
"chatID": ""
|
||||||
}],
|
}],
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"authorGit": "https://github.com/Mit4el",
|
"authorGit": "https://github.com/Mit4el",
|
||||||
"specialThanks": "",
|
"specialThanks": "",
|
||||||
"moduleName": "Telegram_v2",
|
"moduleName": "Telegram_v2",
|
||||||
"moduleVersion": "1.0",
|
"moduleVersion": "3.0",
|
||||||
"usedRam": {
|
"usedRam": {
|
||||||
"esp32_4mb": 37,
|
"esp32_4mb": 37,
|
||||||
"esp8266_4mb": 37
|
"esp8266_4mb": 37
|
||||||
@@ -45,14 +45,19 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sendOftenMsg",
|
"name": "sendOftenMsg",
|
||||||
"descr": "Отправить сообщение в любом случае, даж если отправляли такое ранее.",
|
"descr": "Отправить сообщение в любом случае, даже если отправляли такое ранее.",
|
||||||
"params": ["Сообщение, может быть строкой, числом или ИД другого элемента для получения значения"]
|
"params": ["Сообщение, может быть строкой, числом или ИД другого элемента для получения значения"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sendPinMsg",
|
"name": "sendPinMsg",
|
||||||
"descr": "Отправить закрепленное сообщение в любом случае, даж если отправляли такое ранее.",
|
"descr": "Отправить закрепленное сообщение в любом случае, даже если отправляли такое ранее.",
|
||||||
"params": ["Сообщение, может быть строкой, числом или ИД другого элемента для получения значения"]
|
"params": ["Сообщение, может быть строкой, числом или ИД другого элемента для получения значения"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "unpinAllMsg",
|
||||||
|
"descr": "Открепить все сообщения в чате.",
|
||||||
|
"params": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "editMsg",
|
"name": "editMsg",
|
||||||
"descr": "Отредактировать последнее отправленное ботом сообщение.",
|
"descr": "Отредактировать последнее отправленное ботом сообщение.",
|
||||||
@@ -67,7 +72,52 @@
|
|||||||
"name": "editFile",
|
"name": "editFile",
|
||||||
"descr": "Отредактировать последний отправленный файл, с указанием типа файла: 0-фото, 1-аудио, 2-документ, 3-видео, 4-анимация, 5-голос",
|
"descr": "Отредактировать последний отправленный файл, с указанием типа файла: 0-фото, 1-аудио, 2-документ, 3-видео, 4-анимация, 5-голос",
|
||||||
"params": ["Путь к файлу (/test.png)", "Тип файла/информации (число)"]
|
"params": ["Путь к файлу (/test.png)", "Тип файла/информации (число)"]
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
"name": "btnMenu",
|
||||||
|
"descr": "Описание кнопки меню выводит запросит значение ID и выведит сообщение => Произвольное сообщение(message): значение. Пример: btnMenu(Темп.Дома, Текущая температура, IDbme280)",
|
||||||
|
"params": ["Name - название кнопки отображается ботом", "message - Произвольное сообщения присылается в ответ на кнопку", "Id - Вернет значение элемента"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "btnMenu",
|
||||||
|
"descr": "Описание кнопки меню выводит запросит значение getID,установит значение value в setID и выведит сообщение => Произвольное сообщение(message): значение, IDrele=1. ВСЁ УКАЗЫВАТЬ В КАВЫЧКАХ, значение не обязательно! Пример: btnMenu(\"Обогрев\", \"Текущая температура\", \"IDbme280\", \"IDrele\", 1), btnMenu(Свет, Вклбчил свет, \"\", IDrele, 1)",
|
||||||
|
"params": ["Name - название кнопки отображается ботом", "message - Произвольное сообщения присылается в ответ на кнопку", "getId - Вернет значение элемента", "setId - Установит значение элементу", "value - Устанавливаемое значение"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "showMenu",
|
||||||
|
"descr": "Отобразить меню, созданное в сценарии",
|
||||||
|
"params": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "closeMenu",
|
||||||
|
"descr": "Закрыть мменю",
|
||||||
|
"params": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "btnInline",
|
||||||
|
"descr": "Описание кнопки встроенного (inline) меню выводит запросит значение ID и выведит сообщение => Произвольное сообщение(message): значение. Пример: btnMenu(Темп.Дома, Текущая температура, IDbme280)",
|
||||||
|
"params": ["Name - название кнопки отображается ботом", "message - Произвольное сообщения присылается в ответ на кнопку", "Id - Вернет значение элемента"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "btnInline",
|
||||||
|
"descr": "Описание кнопки встроенного (inline) меню выводит запросит значение getID,установит значение value в setID и выведит сообщение => Произвольное сообщение(message): значение, IDrele=1. ВСЁ УКАЗЫВАТЬ В КАВЫЧКАХ, значение не обязательно! Пример: btnMenu(\"Обогрев\", \"Текущая температура\", \"IDbme280\", \"IDrele\", 1), btnMenu(Свет, Вклбчил свет, \"\", IDrele, 1)",
|
||||||
|
"params": ["Name - название кнопки отображается ботом", "message - Произвольное сообщения присылается в ответ на кнопку", "getId - Вернет значение элемента", "setId - Установит значение элементу", "value - Устанавливаемое значение"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "showInline",
|
||||||
|
"descr": "Отобразить встроенное (inline) меню, созданное в сценарии",
|
||||||
|
"params": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clearInline",
|
||||||
|
"descr": "Очистить встроенное (inline) меню, вызвать перед для язменения, перед созданием новых кнопок",
|
||||||
|
"params": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "clearMenu",
|
||||||
|
"descr": "Очистить меню, вызвать перед для язменения, перед созданием новых кнопок",
|
||||||
|
"params": []
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -125,17 +125,9 @@
|
|||||||
"reset": "Поставьте этот параметр равным 1 и pzem будет сброшен к нулю. Смотрите в логе результат: [i] Pzem reset done"
|
"reset": "Поставьте этот параметр равным 1 и pzem будет сброшен к нулю. Смотрите в логе результат: [i] Pzem reset done"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"defActive": true,
|
"defActive": false,
|
||||||
"usedLibs": {
|
"usedLibs": {
|
||||||
"esp32_4mb": [],
|
"esp32*": [],
|
||||||
"esp32_4mb3f": [],
|
"esp82*": []
|
||||||
"esp32cam_4mb": [],
|
|
||||||
"esp8266_4mb": [],
|
|
||||||
"esp8266_1mb": [],
|
|
||||||
"esp8266_1mb_ota": [],
|
|
||||||
"esp8285_1mb": [],
|
|
||||||
"esp8285_1mb_ota": [],
|
|
||||||
"esp8266_2mb": [],
|
|
||||||
"esp8266_2mb_ota": []
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,12 +6,14 @@
|
|||||||
#define R_LEN 7
|
#define R_LEN 7
|
||||||
#define C_LEN 8
|
#define C_LEN 8
|
||||||
|
|
||||||
byte cmd_s8[8] = {0xFE, 0x04, 0x00, 0x03, 0x00, 0x01, 0xD5, 0xC5};
|
|
||||||
//byte abc_s8[8] = {0xFE, 0x03, 0x00, 0x1F, 0x00, 0x01, 0xA1, 0xC3};
|
|
||||||
|
|
||||||
|
|
||||||
class S8co : public IoTItem {
|
class S8co : public IoTItem {
|
||||||
private:
|
private:
|
||||||
|
byte cmd_s8[8] = {0xFE, 0x04, 0x00, 0x03, 0x00, 0x01, 0xD5, 0xC5};
|
||||||
|
//byte abc_s8[8] = {0xFE, 0x03, 0x00, 0x1F, 0x00, 0x01, 0xA1, 0xC3};
|
||||||
|
|
||||||
SoftwareSerial* s8Serial;
|
SoftwareSerial* s8Serial;
|
||||||
|
|
||||||
unsigned int _s8_co2;
|
unsigned int _s8_co2;
|
||||||
@@ -24,6 +26,11 @@ class S8co : public IoTItem {
|
|||||||
byte _response_s8[7] = {0, 0, 0, 0, 0, 0, 0};
|
byte _response_s8[7] = {0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
void s8Request(byte cmd[]) {
|
void s8Request(byte cmd[]) {
|
||||||
|
if (!s8Serial) {
|
||||||
|
SerialPrint("E", "Sensor S8_uart", "Serial not found!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while(!s8Serial->available()) {
|
while(!s8Serial->available()) {
|
||||||
s8Serial->write(cmd, C_LEN);
|
s8Serial->write(cmd, C_LEN);
|
||||||
delay(50);
|
delay(50);
|
||||||
@@ -45,7 +52,7 @@ class S8co : public IoTItem {
|
|||||||
_response_s8[i] = s8Serial->read();
|
_response_s8[i] = s8Serial->read();
|
||||||
}
|
}
|
||||||
|
|
||||||
s8Serial->end();
|
//s8Serial->end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void co2_measure() {
|
void co2_measure() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
"menuSection": "sensors",
|
"menuSection": "sensors",
|
||||||
"configItem": [
|
"configItem": [
|
||||||
{
|
{
|
||||||
|
"global": 0,
|
||||||
"name": "(S8) Cенсор качества воздуха",
|
"name": "(S8) Cенсор качества воздуха",
|
||||||
"num": 3,
|
"num": 3,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
|
|||||||
@@ -31,6 +31,18 @@ private:
|
|||||||
return mktime(&t);
|
return mktime(&t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool nowInTimePeriod(String startTime, String endTime) {
|
||||||
|
int h1 = selectToMarker(startTime, ":").toInt();
|
||||||
|
int min1 = selectToMarkerLast(startTime, ":").toInt();
|
||||||
|
int h2 = selectToMarker(endTime, ":").toInt();
|
||||||
|
int min2 = selectToMarkerLast(endTime, ":").toInt();
|
||||||
|
|
||||||
|
int nowMinutes = _time_local.hour * 60 + _time_local.minute;
|
||||||
|
|
||||||
|
return nowMinutes >= h1 * 60 + min1 && nowMinutes <= h2 * 60 + min2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IoTMath(String parameters) : IoTItem(parameters) {}
|
IoTMath(String parameters) : IoTItem(parameters) {}
|
||||||
|
|
||||||
@@ -42,7 +54,7 @@ public:
|
|||||||
//SerialPrint("i", F("IoTMath"), F("Mapping value done."));
|
//SerialPrint("i", F("IoTMath"), F("Mapping value done."));
|
||||||
return valTmp;
|
return valTmp;
|
||||||
} else if(command == "convertTime" && param.size() == 5) {
|
} else if(command == "convertTime" && param.size() == 5) {
|
||||||
time_t unixTime = convertTime(param[0].valD, param[1].valD, param[2].valD, param[3].valD, param[4].valD);
|
uint32_t unixTime = convertTime(param[0].valD, param[1].valD, param[2].valD, param[3].valD, param[4].valD);
|
||||||
|
|
||||||
if (unixTime == -1) {
|
if (unixTime == -1) {
|
||||||
SerialPrint("E", F("IoTMath"), F("Failed to convert time."));
|
SerialPrint("E", F("IoTMath"), F("Failed to convert time."));
|
||||||
@@ -51,8 +63,12 @@ public:
|
|||||||
|
|
||||||
IoTValue valTmp;
|
IoTValue valTmp;
|
||||||
valTmp.isDecimal = true;
|
valTmp.isDecimal = true;
|
||||||
valTmp.valD = unixTime;
|
valTmp.valD = static_cast< float > (unixTime);
|
||||||
//SerialPrint("i", F("IoTMath"), F("Time conversion done."));
|
return valTmp;
|
||||||
|
} else if(command == "nowInTimePeriod" && param.size() == 2) {
|
||||||
|
IoTValue valTmp;
|
||||||
|
valTmp.isDecimal = true;
|
||||||
|
valTmp.valD = nowInTimePeriod(param[0].valS, param[1].valS);
|
||||||
return valTmp;
|
return valTmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
258
src/modules/virtual/Math/TimerRelay.json
Normal file
258
src/modules/virtual/Math/TimerRelay.json
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
{
|
||||||
|
"mark": "iotm",
|
||||||
|
"config": [
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "ButtonOut",
|
||||||
|
"needSave": "1",
|
||||||
|
"id": "rel1",
|
||||||
|
"widget": "toggle",
|
||||||
|
"page": "Свет 1",
|
||||||
|
"descr": " Реле 1",
|
||||||
|
"int": 0,
|
||||||
|
"inv": "1",
|
||||||
|
"pin": "32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "ButtonOut",
|
||||||
|
"needSave": "1",
|
||||||
|
"id": "rel2",
|
||||||
|
"widget": "toggle",
|
||||||
|
"page": "Свет 2",
|
||||||
|
"descr": " Реле 2",
|
||||||
|
"int": 0,
|
||||||
|
"inv": "1",
|
||||||
|
"pin": "33"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "RTC",
|
||||||
|
"id": "rtc",
|
||||||
|
"widget": "anydataDef",
|
||||||
|
"page": "Система",
|
||||||
|
"descr": "Время",
|
||||||
|
"chipCode": "3",
|
||||||
|
"timeFormat": "d-m-Y H:i:s",
|
||||||
|
"RST": -1,
|
||||||
|
"CLK": -1,
|
||||||
|
"DAT": -1,
|
||||||
|
"ticker": 0,
|
||||||
|
"int": 5,
|
||||||
|
"btn-setUTime": "0",
|
||||||
|
"btn-setSysTime": "nil"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "AnalogBtn",
|
||||||
|
"id": "btn1",
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Свет 1",
|
||||||
|
"descr": "Кнопка 1",
|
||||||
|
"pin": "34",
|
||||||
|
"aValue": 0,
|
||||||
|
"delta": 50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "AnalogBtn",
|
||||||
|
"id": "btn2",
|
||||||
|
"widget": "nil",
|
||||||
|
"page": "Свет 2",
|
||||||
|
"descr": "Кнопка 2",
|
||||||
|
"pin": "34",
|
||||||
|
"aValue": "1910",
|
||||||
|
"delta": 50
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "IoTMath",
|
||||||
|
"id": "math",
|
||||||
|
"widget": "anydataValue",
|
||||||
|
"page": "Математика",
|
||||||
|
"descr": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "start11",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 1",
|
||||||
|
"descr": " Старт 1",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "stop11",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 1",
|
||||||
|
"descr": " Стоп 1",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "start12",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 1",
|
||||||
|
"descr": "Старт 2",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "stop12",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 1",
|
||||||
|
"descr": "Стоп 2",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "start21",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 2",
|
||||||
|
"descr": " Старт 1",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "stop21",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 2",
|
||||||
|
"descr": " Стоп 1",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "start22",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 2",
|
||||||
|
"descr": "Старт 2",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Variable",
|
||||||
|
"id": "stop22",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "inputTm",
|
||||||
|
"page": "Свет 2",
|
||||||
|
"descr": "Стоп 2",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0.0",
|
||||||
|
"map": "1024,1024,1,100",
|
||||||
|
"plus": 0,
|
||||||
|
"multiply": 1,
|
||||||
|
"round": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Writing",
|
||||||
|
"subtype": "Cron",
|
||||||
|
"id": "timer",
|
||||||
|
"widget": "anydataRed",
|
||||||
|
"page": "Система",
|
||||||
|
"descr": "Будильник",
|
||||||
|
"int": 1,
|
||||||
|
"val": "0 * * * * *",
|
||||||
|
"formatNextAlarm": "%H:%M:%S",
|
||||||
|
"needSave": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "VButton",
|
||||||
|
"id": "rel1on",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "toggle",
|
||||||
|
"page": "Свет 1",
|
||||||
|
"descr": " Работать",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"global": 0,
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "VButton",
|
||||||
|
"id": "rel2on",
|
||||||
|
"needSave": "1",
|
||||||
|
"widget": "toggle",
|
||||||
|
"page": "Свет 2",
|
||||||
|
"descr": " Работать",
|
||||||
|
"int": "0",
|
||||||
|
"val": "0"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
scenario=>if btn1>0 then rel1 = 1- rel1
|
||||||
|
if btn2>0 then rel2 = 1- rel2
|
||||||
|
|
||||||
|
if timer == 0 | start11 | stop11 | start12 | stop12 | start21 | stop21 | start22 | stop22 then {
|
||||||
|
if rel1on then
|
||||||
|
if math.nowInTimePeriod(start11, stop11) | math.nowInTimePeriod(start12, stop12) then rel1=1 else rel1=0
|
||||||
|
|
||||||
|
if rel2on then
|
||||||
|
if math.nowInTimePeriod(start21, stop21) | math.nowInTimePeriod(start22, stop22) then rel2=1 else rel2=0
|
||||||
|
}
|
||||||
@@ -38,10 +38,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "convertTime",
|
"name": "convertTime",
|
||||||
"descr": "Перевести время из формата d-m-Y H:i:s например, 13-08-2023 16:24:00 в юникс-время ",
|
"descr": "Перевести время из формата d-m-Y H:i:s например, 13-08-2023 16:24:00 в юникс-время",
|
||||||
"params": [
|
"params": [
|
||||||
"tm.convertTime(13, 08, 2023, 16, 24); - передаем пять целых чисел. секунды подставятся в ноль"
|
"tm.convertTime(13, 08, 2023, 16, 24); - передаем пять целых чисел. секунды подставятся в ноль"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "nowInTimePeriod",
|
||||||
|
"descr": "Проверяет входит ли текущее время в указанный период. Возвращает 1 если входит, 0 если нет.",
|
||||||
|
"params": [
|
||||||
|
"Начало периода в формате HH:MM",
|
||||||
|
"Конец периода в формате HH:MM"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user