From 11fdd5ee004c3d553cef39a4cc94613abd5ec0b8 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <67171972+IoTManagerProject@users.noreply.github.com> Date: Wed, 7 Dec 2022 22:30:38 +0100 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D1=8F=D0=B5=D0=BC=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data_svelte/items.json | 367 ++++++++++++++++++++---- myProfile.json | 2 +- platformio.ini | 14 +- src/modules/API.cpp | 20 ++ src/modules/sensors/Bme280/modinfo.json | 12 +- 5 files changed, 352 insertions(+), 63 deletions(-) diff --git a/data_svelte/items.json b/data_svelte/items.json index 8ba13366..4a94fc4d 100644 --- a/data_svelte/items.json +++ b/data_svelte/items.json @@ -23,7 +23,49 @@ }, { "global": 0, - "name": "2. Таймер", + "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. Таймер", "type": "Writing", "subtype": "Timer", "id": "timer", @@ -35,11 +77,11 @@ "ticker": 1, "repeat": 1, "needSave": 0, - "num": 2 + "num": 5 }, { "global": 0, - "name": "3. Окно ввода числа (переменная)", + "name": "6. Окно ввода числа (переменная)", "type": "Reading", "subtype": "Variable", "id": "value", @@ -53,11 +95,11 @@ "plus": 0, "multiply": 1, "round": 0, - "num": 3 + "num": 6 }, { "global": 0, - "name": "4. Окно ввода времени", + "name": "7. Окно ввода времени", "type": "Reading", "subtype": "Variable", "id": "time", @@ -67,11 +109,11 @@ "descr": "Введите время", "int": "0", "val": "02:00", - "num": 4 + "num": 7 }, { "global": 0, - "name": "5. Окно ввода даты", + "name": "8. Окно ввода даты", "type": "Reading", "subtype": "Variable", "id": "time", @@ -81,11 +123,11 @@ "descr": "Введите дату", "int": "0", "val": "24.05.2022", - "num": 5 + "num": 8 }, { "global": 0, - "name": "6. Окно ввода текста", + "name": "9. Окно ввода текста", "type": "Reading", "subtype": "Variable", "id": "txt", @@ -95,11 +137,11 @@ "descr": "Введите текст", "int": "0", "val": "текст", - "num": 6 + "num": 9 }, { "global": 0, - "name": "7. Вывод значения", + "name": "10. Вывод значения", "type": "Reading", "subtype": "Variable", "id": "vout", @@ -113,11 +155,11 @@ "plus": 0, "multiply": 1, "round": 0, - "num": 7 + "num": 10 }, { "global": 0, - "name": "8. Виртуальная кнопка", + "name": "11. Виртуальная кнопка", "type": "Reading", "subtype": "VButton", "id": "vbtn", @@ -127,14 +169,75 @@ "descr": "Кнопка", "int": "0", "val": "0", - "num": 8 + "num": 11 }, { "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": "9. BME280 Температура", + "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 Температура", "type": "Reading", "subtype": "Bme280t", "id": "tmp3", @@ -144,11 +247,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 9 + "num": 16 }, { "global": 0, - "name": "10. BME280 Давление", + "name": "17. BME280 Давление", "type": "Reading", "subtype": "Bme280p", "id": "Press3", @@ -158,11 +261,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 10 + "num": 17 }, { "global": 0, - "name": "11. BME280 Влажность", + "name": "18. BME280 Влажность", "type": "Reading", "subtype": "Bme280h", "id": "Hum3", @@ -172,11 +275,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 11 + "num": 18 }, { "global": 0, - "name": "12. BMP280 Температура", + "name": "19. BMP280 Температура", "type": "Reading", "subtype": "Bmp280t", "id": "tmp3", @@ -186,11 +289,11 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 12 + "num": 19 }, { "global": 0, - "name": "13. BMP280 Давление", + "name": "20. BMP280 Давление", "type": "Reading", "subtype": "Bmp280p", "id": "Press3", @@ -200,11 +303,39 @@ "int": 15, "addr": "0x77", "round": 1, - "num": 13 + "num": 20 }, { "global": 0, - "name": "14. DS18B20 Температура", + "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 Температура", "type": "Reading", "subtype": "Ds18b20", "id": "dstmp", @@ -216,11 +347,95 @@ "index": 0, "addr": "", "round": 1, - "num": 14 + "num": 23 }, { "global": 0, - "name": "15. Sht20 Температура", + "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 Температура", "type": "Reading", "subtype": "Sht20t", "id": "tmp2", @@ -229,11 +444,11 @@ "descr": "Температура", "int": 15, "round": 1, - "num": 15 + "num": 30 }, { "global": 0, - "name": "16. Sht20 Влажность", + "name": "31. Sht20 Влажность", "type": "Reading", "subtype": "Sht20h", "id": "Hum2", @@ -242,11 +457,11 @@ "descr": "Влажность", "int": 15, "round": 1, - "num": 16 + "num": 31 }, { "global": 0, - "name": "17. Sht30 Температура", + "name": "32. Sht30 Температура", "type": "Reading", "subtype": "Sht30t", "id": "tmp30", @@ -255,11 +470,11 @@ "descr": "SHT30 Температура", "int": 15, "round": 1, - "num": 17 + "num": 32 }, { "global": 0, - "name": "18. Sht30 Влажность", + "name": "33. Sht30 Влажность", "type": "Reading", "subtype": "Sht30h", "id": "Hum30", @@ -268,12 +483,12 @@ "descr": "SHT30 Влажность", "int": 15, "round": 1, - "num": 18 + "num": 33 }, { "global": 0, - "name": "19. HC-SR04 Ультразвуковой дальномер", - "num": 19, + "name": "34. HC-SR04 Ультразвуковой дальномер", + "num": 34, "type": "Reading", "subtype": "Sonar", "id": "sonar", @@ -284,12 +499,27 @@ "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": "20. Кнопка подключенная к пину", + "name": "36. Кнопка подключенная к пину", "type": "Writing", "subtype": "ButtonIn", "id": "btn", @@ -303,11 +533,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "fixState": 0, - "num": 20 + "num": 36 }, { "global": 0, - "name": "21. Управление пином", + "name": "37. Управление пином", "type": "Writing", "subtype": "ButtonOut", "needSave": 0, @@ -318,11 +548,26 @@ "int": 0, "inv": 0, "pin": 2, - "num": 21 + "num": 37 }, { "global": 0, - "name": "22. Расширитель портов Mcp23017", + "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", "type": "Reading", "subtype": "Mcp23017", "id": "Mcp", @@ -332,11 +577,25 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 22 + "num": 39 }, { "global": 0, - "name": "23. Сенсорная кнопка", + "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. Сенсорная кнопка", "type": "Writing", "subtype": "Multitouch", "id": "impulse", @@ -350,11 +609,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "PWMDelay": 500, - "num": 23 + "num": 41 }, { "global": 0, - "name": "24. Расширитель портов Pcf8574", + "name": "42. Расширитель портов Pcf8574", "type": "Reading", "subtype": "Pcf8574", "id": "Pcf", @@ -364,11 +623,11 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 24 + "num": 42 }, { "global": 0, - "name": "25. PWM ESP8266", + "name": "43. PWM ESP8266", "type": "Writing", "subtype": "Pwm8266", "id": "pwm", @@ -380,11 +639,11 @@ "freq": 5000, "val": 0, "apin": -1, - "num": 25 + "num": 43 }, { "global": 0, - "name": "26. Телеграм-Лайт", + "name": "44. Телеграм-Лайт", "type": "Writing", "subtype": "TelegramLT", "id": "tg", @@ -393,14 +652,14 @@ "descr": "", "token": "", "chatID": "", - "num": 26 + "num": 44 }, { "header": "Экраны" }, { "global": 0, - "name": "27. LCD экран 2004", + "name": "45. LCD экран 2004", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -412,10 +671,10 @@ "size": "20,4", "coord": "0,0", "id2show": "id датчика", - "num": 27 + "num": 45 }, { - "name": "28. LCD экран 1602", + "name": "46. LCD экран 1602", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -427,6 +686,6 @@ "size": "16,2", "coord": "0,0", "id2show": "id датчика", - "num": 28 + "num": 46 } ] \ No newline at end of file diff --git a/myProfile.json b/myProfile.json index 25539882..a7c149a4 100644 --- a/myProfile.json +++ b/myProfile.json @@ -24,7 +24,7 @@ }, "projectProp": { "platformio": { - "default_envs": "esp8266_1mb", + "default_envs": "esp8266_4mb", "comments_default_envs": "choose from: esp8266_4mb or esp32_4mb or esp8266_1mb or esp8266_1mb_ota or esp8285_1mb or esp8285_1mb_ota" } }, diff --git a/platformio.ini b/platformio.ini index fa1d285e..117bb9e5 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,5 +1,5 @@ [platformio] -default_envs = esp8266_1mb +default_envs = esp8266_4mb data_dir = data_svelte [common_env_data] @@ -158,7 +158,7 @@ build_src_filter = [env:esp8266_1mb_fromitems] lib_deps = - adafruit/Adafruit BMP280 Library + adafruit/Adafruit BME280 Library adafruit/Adafruit BMP280 Library milesburton/DallasTemperature@^3.9.1 robtillaart/SHT2x@^0.1.1 @@ -172,6 +172,7 @@ build_src_filter = + + + + + + + + @@ -212,7 +213,11 @@ build_src_filter = [env:esp8285_1mb_fromitems] lib_deps = + adafruit/Adafruit BME280 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 @@ -222,7 +227,12 @@ build_src_filter = + + + + + + + + + + + + + + + + + diff --git a/src/modules/API.cpp b/src/modules/API.cpp index 57c8beb3..12df2c22 100644 --- a/src/modules/API.cpp +++ b/src/modules/API.cpp @@ -1,18 +1,28 @@ #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_Pcf8574(String subtype, String params); void* getAPI_Pwm8266(String subtype, String params); @@ -22,18 +32,28 @@ 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_Pcf8574(subtype, params)) != nullptr) return tmpAPI; if ((tmpAPI = getAPI_Pwm8266(subtype, params)) != nullptr) return tmpAPI; diff --git a/src/modules/sensors/Bme280/modinfo.json b/src/modules/sensors/Bme280/modinfo.json index 6f24771c..ca6dd652 100644 --- a/src/modules/sensors/Bme280/modinfo.json +++ b/src/modules/sensors/Bme280/modinfo.json @@ -67,22 +67,22 @@ "defActive": true, "usedLibs": { "esp32_4mb": [ - "adafruit/Adafruit BMP280 Library" + "adafruit/Adafruit BME280 Library" ], "esp8266_4mb": [ - "adafruit/Adafruit BMP280 Library" + "adafruit/Adafruit BME280 Library" ], "esp8266_1mb": [ - "adafruit/Adafruit BMP280 Library" + "adafruit/Adafruit BME280 Library" ], "esp8266_1mb_ota": [ - "adafruit/Adafruit BMP280 Library" + "adafruit/Adafruit BME280 Library" ], "esp8285_1mb": [ - "adafruit/Adafruit BMP280 Library" + "adafruit/Adafruit BME280 Library" ], "esp8285_1mb_ota": [ - "adafruit/Adafruit BMP280 Library" + "adafruit/Adafruit BME280 Library" ] } } \ No newline at end of file