From 7d9129d3fd36d5b329fc33c7d51d4a37cf18af55 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <67171972+IoTManagerProject@users.noreply.github.com> Date: Wed, 7 Dec 2022 18:20:41 +0100 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B0=D0=BD=D0=B0=D0=BB=D0=BE=D0=B3=D0=B0?= =?UTF-8?q?=20=D0=B2=201=20mb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_svelte/items.json | 399 +++------------------ myProfile.json | 4 +- platformio.ini | 10 +- src/modules/API.cpp | 26 +- src/modules/sensors/AnalogAdc/modinfo.json | 50 +-- 5 files changed, 94 insertions(+), 395 deletions(-) diff --git a/data_svelte/items.json b/data_svelte/items.json index 78b0e596..8ba13366 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -23,49 +23,7 @@ }, { "global": 0, - "name": "2. График", - "type": "Writing", - "subtype": "Loging", - "id": "log", - "widget": "chart2", - "page": "Графики", - "descr": "Температура", - "num": 2, - "int": 5, - "logid": "t", - "points": 300 - }, - { - "global": 0, - "name": "3. График по событию", - "type": "Writing", - "subtype": "Loging", - "id": "log", - "widget": "chart2", - "page": "Графики", - "descr": "Температура", - "int": 0, - "num": 3, - "points": 300 - }, - { - "global": 0, - "name": "4. График дневного расхода", - "type": "Writing", - "subtype": "LogingDaily", - "id": "log", - "widget": "chart3", - "page": "Графики", - "descr": "Температура", - "num": 4, - "int": 1, - "logid": "t", - "points": 365, - "column": 0 - }, - { - "global": 0, - "name": "5. Таймер", + "name": "2. Таймер", "type": "Writing", "subtype": "Timer", "id": "timer", @@ -77,11 +35,11 @@ "ticker": 1, "repeat": 1, "needSave": 0, - "num": 5 + "num": 2 }, { "global": 0, - "name": "6. Окно ввода числа (переменная)", + "name": "3. Окно ввода числа (переменная)", "type": "Reading", "subtype": "Variable", "id": "value", @@ -95,11 +53,11 @@ "plus": 0, "multiply": 1, "round": 0, - "num": 6 + "num": 3 }, { "global": 0, - "name": "7. Окно ввода времени", + "name": "4. Окно ввода времени", "type": "Reading", "subtype": "Variable", "id": "time", @@ -109,11 +67,11 @@ "descr": "Введите время", "int": "0", "val": "02:00", - "num": 7 + "num": 4 }, { "global": 0, - "name": "8. Окно ввода даты", + "name": "5. Окно ввода даты", "type": "Reading", "subtype": "Variable", "id": "time", @@ -123,11 +81,11 @@ "descr": "Введите дату", "int": "0", "val": "24.05.2022", - "num": 8 + "num": 5 }, { "global": 0, - "name": "9. Окно ввода текста", + "name": "6. Окно ввода текста", "type": "Reading", "subtype": "Variable", "id": "txt", @@ -137,11 +95,11 @@ "descr": "Введите текст", "int": "0", "val": "текст", - "num": 9 + "num": 6 }, { "global": 0, - "name": "10. Вывод значения", + "name": "7. Вывод значения", "type": "Reading", "subtype": "Variable", "id": "vout", @@ -155,11 +113,11 @@ "plus": 0, "multiply": 1, "round": 0, - "num": 10 + "num": 7 }, { "global": 0, - "name": "11. Виртуальная кнопка", + "name": "8. Виртуальная кнопка", "type": "Reading", "subtype": "VButton", "id": "vbtn", @@ -169,75 +127,14 @@ "descr": "Кнопка", "int": "0", "val": "0", - "num": 11 + "num": 8 }, { "header": "Сенсоры" }, - { - "name": "12. Acs712 Ток", - "type": "Reading", - "subtype": "Acs712", - "id": "amp", - "widget": "anydataAmp", - "page": "Сенсоры", - "descr": "Ток", - "round": 3, - "pin": 39, - "int": 5, - "num": 12 - }, { "global": 0, - "name": "13. AHTXX Температура", - "type": "Reading", - "subtype": "AhtXXt", - "id": "Temp20", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "AHTXX Температура", - "int": 15, - "addr": "0x38", - "shtType": 1, - "round": 1, - "num": 13 - }, - { - "global": 0, - "name": "14. AHTXX Влажность", - "type": "Reading", - "subtype": "AhtXXh", - "id": "Hum20", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "AHTXX Влажность", - "int": 15, - "addr": "0x38", - "shtType": 1, - "round": 1, - "num": 14 - }, - { - "global": 0, - "name": "15. Аналоговый сенсор", - "type": "Reading", - "subtype": "AnalogAdc", - "id": "t", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Температура", - "map": "1,1024,1,100", - "plus": 0, - "multiply": 1, - "round": 1, - "pin": 0, - "int": 15, - "avgSteps": 1, - "num": 15 - }, - { - "global": 0, - "name": "16. BME280 Температура", + "name": "9. BME280 Температура", "type": "Reading", "subtype": "Bme280t", "id": "tmp3", @@ -247,11 +144,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 16 + "num": 9 }, { "global": 0, - "name": "17. BME280 Давление", + "name": "10. BME280 Давление", "type": "Reading", "subtype": "Bme280p", "id": "Press3", @@ -261,11 +158,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 17 + "num": 10 }, { "global": 0, - "name": "18. BME280 Влажность", + "name": "11. BME280 Влажность", "type": "Reading", "subtype": "Bme280h", "id": "Hum3", @@ -275,11 +172,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 18 + "num": 11 }, { "global": 0, - "name": "19. BMP280 Температура", + "name": "12. BMP280 Температура", "type": "Reading", "subtype": "Bmp280t", "id": "tmp3", @@ -289,11 +186,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 19 + "num": 12 }, { "global": 0, - "name": "20. BMP280 Давление", + "name": "13. BMP280 Давление", "type": "Reading", "subtype": "Bmp280p", "id": "Press3", @@ -303,39 +200,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 20 + "num": 13 }, { "global": 0, - "name": "21. DHT11 Температура", - "type": "Reading", - "subtype": "Dht1122t", - "id": "tmp3", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Температура", - "int": 15, - "pin": 0, - "senstype": "dht11", - "num": 21 - }, - { - "global": 0, - "name": "22. DHT11 Влажность", - "type": "Reading", - "subtype": "Dht1122h", - "id": "Hum3", - "widget": "anydataHum", - "page": "Сенсоры", - "descr": "Влажность", - "int": 15, - "pin": 0, - "senstype": "dht11", - "num": 22 - }, - { - "global": 0, - "name": "23. DS18B20 Температура", + "name": "14. DS18B20 Температура", "type": "Reading", "subtype": "Ds18b20", "id": "dstmp", @@ -347,95 +216,11 @@ "index": 0, "addr": "", "round": 1, - "num": 23 + "num": 14 }, { "global": 0, - "name": "24. PZEM 004t Напряжение", - "type": "Reading", - "subtype": "Pzem004v", - "id": "v", - "widget": "anydataVlt", - "page": "PZEM", - "descr": "Напряжение", - "int": 15, - "addr": "0xF8", - "round": 1, - "num": 24 - }, - { - "global": 0, - "name": "25. PZEM 004t Сила тока", - "type": "Reading", - "subtype": "Pzem004a", - "id": "a", - "widget": "anydataAmp", - "page": "PZEM", - "descr": "Сила тока", - "int": 15, - "addr": "0xF8", - "round": 1, - "num": 25 - }, - { - "global": 0, - "name": "26. PZEM 004t Мощность", - "type": "Reading", - "subtype": "Pzem004w", - "id": "w", - "widget": "anydataWt", - "page": "PZEM", - "descr": "Мощность", - "int": 15, - "addr": "0xF8", - "round": 1, - "num": 26 - }, - { - "global": 0, - "name": "27. PZEM 004t Энергия", - "type": "Reading", - "subtype": "Pzem004wh", - "id": "wh", - "widget": "anydataWth", - "page": "PZEM", - "descr": "Энергия", - "int": 15, - "addr": "0xF8", - "round": 1, - "num": 27 - }, - { - "global": 0, - "name": "28. PZEM 004t Частота", - "type": "Reading", - "subtype": "Pzem004hz", - "id": "hz", - "widget": "anydataHtz", - "page": "PZEM", - "descr": "Частота", - "int": 15, - "addr": "0xF8", - "round": 1, - "num": 28 - }, - { - "global": 0, - "name": "29. PZEM 004t Косинус", - "type": "Reading", - "subtype": "Pzem004pf", - "id": "pf", - "widget": "anydata", - "page": "PZEM", - "descr": "Косинус F", - "int": 15, - "addr": "0xF8", - "round": 1, - "num": 29 - }, - { - "global": 0, - "name": "30. Sht20 Температура", + "name": "15. Sht20 Температура", "type": "Reading", "subtype": "Sht20t", "id": "tmp2", @@ -444,11 +229,11 @@ "descr": "Температура", "int": 15, "round": 1, - "num": 30 + "num": 15 }, { "global": 0, - "name": "31. Sht20 Влажность", + "name": "16. Sht20 Влажность", "type": "Reading", "subtype": "Sht20h", "id": "Hum2", @@ -457,11 +242,11 @@ "descr": "Влажность", "int": 15, "round": 1, - "num": 31 + "num": 16 }, { "global": 0, - "name": "32. Sht30 Температура", + "name": "17. Sht30 Температура", "type": "Reading", "subtype": "Sht30t", "id": "tmp30", @@ -470,11 +255,11 @@ "descr": "SHT30 Температура", "int": 15, "round": 1, - "num": 32 + "num": 17 }, { "global": 0, - "name": "33. Sht30 Влажность", + "name": "18. Sht30 Влажность", "type": "Reading", "subtype": "Sht30h", "id": "Hum30", @@ -483,12 +268,12 @@ "descr": "SHT30 Влажность", "int": 15, "round": 1, - "num": 33 + "num": 18 }, { "global": 0, - "name": "34. HC-SR04 Ультразвуковой дальномер", - "num": 34, + "name": "19. HC-SR04 Ультразвуковой дальномер", + "num": 19, "type": "Reading", "subtype": "Sonar", "id": "sonar", @@ -499,27 +284,12 @@ "pinEcho": 4, "int": 5 }, - { - "name": "35. UART", - "type": "Reading", - "subtype": "UART", - "page": "", - "descr": "", - "widget": "nil", - "id": "u", - "tx": 12, - "rx": 13, - "line": 2, - "speed": 9600, - "eventFormat": 0, - "num": 35 - }, { "header": "Исполнительные устройства" }, { "global": 0, - "name": "36. Кнопка подключенная к пину", + "name": "20. Кнопка подключенная к пину", "type": "Writing", "subtype": "ButtonIn", "id": "btn", @@ -533,11 +303,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "fixState": 0, - "num": 36 + "num": 20 }, { "global": 0, - "name": "37. Управление пином", + "name": "21. Управление пином", "type": "Writing", "subtype": "ButtonOut", "needSave": 0, @@ -548,26 +318,11 @@ "int": 0, "inv": 0, "pin": 2, - "num": 37 + "num": 21 }, { "global": 0, - "name": "38. Сервопривод", - "type": "Writing", - "subtype": "IoTServo", - "id": "servo", - "widget": "range", - "page": "servo", - "descr": "угол", - "int": 1, - "pin": 12, - "apin": -1, - "amap": "0, 4096, 0, 180", - "num": 38 - }, - { - "global": 0, - "name": "39. Расширитель портов Mcp23017", + "name": "22. Расширитель портов Mcp23017", "type": "Reading", "subtype": "Mcp23017", "id": "Mcp", @@ -577,25 +332,11 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 39 + "num": 22 }, { "global": 0, - "name": "40. MP3 плеер", - "type": "Reading", - "subtype": "Mp3", - "id": "mp3", - "widget": "", - "page": "", - "descr": "", - "int": 1, - "pins": "14,12", - "volume": 20, - "num": 40 - }, - { - "global": 0, - "name": "41. Сенсорная кнопка", + "name": "23. Сенсорная кнопка", "type": "Writing", "subtype": "Multitouch", "id": "impulse", @@ -609,37 +350,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "PWMDelay": 500, - "num": 41 + "num": 23 }, { "global": 0, - "name": "42. MySensorsGate", - "type": "Reading", - "subtype": "MySensorsGate", - "id": "gt", - "widget": "nil", - "page": "", - "descr": "", - "num": 42 - }, - { - "global": 0, - "name": "43. MySensorsNode", - "type": "Reading", - "subtype": "MySensorsNode", - "id": "n", - "widget": "anydataTmp", - "page": "MySensors", - "descr": "Температура", - "orange": 60, - "red": 120, - "offline": 180, - "round": 1, - "num": 43 - }, - { - "global": 0, - "name": "44. Расширитель портов Pcf8574", + "name": "24. Расширитель портов Pcf8574", "type": "Reading", "subtype": "Pcf8574", "id": "Pcf", @@ -649,29 +364,27 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 44 + "num": 24 }, { "global": 0, - "name": "45. PWM ESP32", + "name": "25. PWM ESP8266", "type": "Writing", - "subtype": "Pwm32", + "subtype": "Pwm8266", "id": "pwm", "widget": "range", "page": "Кнопки", "descr": "PWM", "int": 0, - "pin": 2, + "pin": 15, "freq": 5000, - "ledChannel": 2, - "PWM_resolution": 10, "val": 0, "apin": -1, - "num": 45 + "num": 25 }, { "global": 0, - "name": "46. Телеграм-Лайт", + "name": "26. Телеграм-Лайт", "type": "Writing", "subtype": "TelegramLT", "id": "tg", @@ -680,14 +393,14 @@ "descr": "", "token": "", "chatID": "", - "num": 46 + "num": 26 }, { "header": "Экраны" }, { "global": 0, - "name": "47. LCD экран 2004", + "name": "27. LCD экран 2004", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -699,10 +412,10 @@ "size": "20,4", "coord": "0,0", "id2show": "id датчика", - "num": 47 + "num": 27 }, { - "name": "48. LCD экран 1602", + "name": "28. LCD экран 1602", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -714,6 +427,6 @@ "size": "16,2", "coord": "0,0", "id2show": "id датчика", - "num": 48 + "num": 28 } ] \ No newline at end of file diff --git a/myProfile.json b/myProfile.json index 571c36dc..25539882 100644 --- a/myProfile.json +++ b/myProfile.json @@ -24,7 +24,7 @@ }, "projectProp": { "platformio": { - "default_envs": "esp32_4mb", + "default_envs": "esp8266_1mb", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota" } }, @@ -196,7 +196,7 @@ }, { "path": "src/modules/exec/MySensors", - "active": true + "active": false }, { "path": "src/modules/exec/Pcf8574", diff --git a/platformio.ini b/platformio.ini index e5806c94..fa1d285e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,5 +1,5 @@ [platformio] -default_envs = esp32_4mb +default_envs = esp8266_1mb data_dir = data_svelte [common_env_data] @@ -158,7 +158,11 @@ build_src_filter = [env:esp8266_1mb_fromitems] lib_deps = + adafruit/Adafruit BMP280 Library + adafruit/Adafruit BMP280 Library milesburton/DallasTemperature@^3.9.1 + robtillaart/SHT2x@^0.1.1 + WEMOS SHT3x@1.0.0 adafruit/Adafruit MCP23017 Arduino Library@^2.1.0 adafruit/Adafruit BusIO @ ^1.13.2 adafruit/Adafruit BusIO @ ^1.13.2 @@ -168,7 +172,11 @@ build_src_filter = + + + + + + + + + + + + + + + diff --git a/src/modules/API.cpp b/src/modules/API.cpp index e088171b..57c8beb3 100644 --- a/src/modules/API.cpp +++ b/src/modules/API.cpp @@ -1,64 +1,42 @@ #include "ESPConfiguration.h" void* getAPI_Cron(String subtype, String params); -void* getAPI_Loging(String subtype, String params); -void* getAPI_LogingDaily(String subtype, String params); void* getAPI_Timer(String subtype, String params); void* getAPI_Variable(String subtype, String params); void* getAPI_VButton(String subtype, String params); -void* getAPI_Acs712(String subtype, String params); -void* getAPI_AhtXX(String subtype, String params); -void* getAPI_AnalogAdc(String subtype, String params); void* getAPI_Bme280(String subtype, String params); void* getAPI_Bmp280(String subtype, String params); -void* getAPI_Dht1122(String subtype, String params); void* getAPI_Ds18b20(String subtype, String params); -void* getAPI_Pzem004(String subtype, String params); void* getAPI_Sht20(String subtype, String params); void* getAPI_Sht30(String subtype, String params); void* getAPI_Sonar(String subtype, String params); -void* getAPI_UART(String subtype, String params); void* getAPI_ButtonIn(String subtype, String params); void* getAPI_ButtonOut(String subtype, String params); -void* getAPI_IoTServo(String subtype, String params); void* getAPI_Mcp23017(String subtype, String params); -void* getAPI_Mp3(String subtype, String params); void* getAPI_Multitouch(String subtype, String params); -void* getAPI_MySensorsGate(String subtype, String params); void* getAPI_Pcf8574(String subtype, String params); -void* getAPI_Pwm32(String subtype, String params); +void* getAPI_Pwm8266(String subtype, String params); void* getAPI_TelegramLT(String subtype, String params); void* getAPI_Lcd2004(String subtype, String params); void* getAPI(String subtype, String params) { void* tmpAPI; if ((tmpAPI = getAPI_Cron(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_Timer(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Variable(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_VButton(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_Acs712(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_AhtXX(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_AnalogAdc(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Bme280(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Bmp280(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_Pzem004(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_Sonar(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_UART(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_IoTServo(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_Mp3(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Multitouch(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_MySensorsGate(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Pcf8574(subtype, params)) != nullptr) return tmpAPI; -if ((tmpAPI = getAPI_Pwm32(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_Lcd2004(subtype, params)) != nullptr) return tmpAPI; return nullptr; diff --git a/src/modules/sensors/AnalogAdc/modinfo.json b/src/modules/sensors/AnalogAdc/modinfo.json index 31b99f0a..be0dea1f 100644 --- a/src/modules/sensors/AnalogAdc/modinfo.json +++ b/src/modules/sensors/AnalogAdc/modinfo.json @@ -1,24 +1,24 @@ -{ +{ "menuSection": "Сенсоры", - - "configItem": [{ - "global": 0, - "name": "Аналоговый сенсор", - "type": "Reading", - "subtype": "AnalogAdc", - "id": "t", - "widget": "anydataTmp", - "page": "Сенсоры", - "descr": "Температура", - "map": "1,1024,1,100", - "plus": 0, - "multiply": 1, - "round": 1, - "pin": 0, - "int": 15, - "avgSteps": 1 - }], - + "configItem": [ + { + "global": 0, + "name": "Аналоговый сенсор", + "type": "Reading", + "subtype": "AnalogAdc", + "id": "t", + "widget": "anydataTmp", + "page": "Сенсоры", + "descr": "Температура", + "map": "1,1024,1,100", + "plus": 0, + "multiply": 1, + "round": 1, + "pin": 0, + "int": 15, + "avgSteps": 1 + } + ], "about": { "authorName": "Ilya Belyakov", "authorContact": "https://t.me/Biveraxe", @@ -39,13 +39,13 @@ "int": "Количество секунд между опросами датчика." } }, - - - "defActive": true, - "usedLibs": { "esp32_4mb": [], - "esp8266_4mb": [] + "esp8266_4mb": [], + "esp8266_1mb": [], + "esp8266_1mb_ota": [], + "esp8285_1mb": [], + "esp8285_1mb_ota": [] } } \ No newline at end of file