diff --git a/data_svelte_lite/items.json b/data_svelte_lite/items.json index ff7977f3..e943d7b0 100644 --- a/data_svelte_lite/items.json +++ b/data_svelte_lite/items.json @@ -117,7 +117,21 @@ }, { "global": 0, - "name": "8. Виртуальная кнопка", + "name": "8. Цветной текст", + "type": "Reading", + "subtype": "VariableColor", + "id": "color", + "needSave": 0, + "widget": "anydataDef", + "page": "Вывод", + "descr": "Цветной текст", + "val": "...", + "round": 0, + "num": 8 + }, + { + "global": 0, + "name": "9. Виртуальная кнопка", "type": "Reading", "subtype": "VButton", "id": "vbtn", @@ -127,14 +141,77 @@ "descr": "Кнопка", "int": "0", "val": "0", - "num": 8 + "num": 9 + }, + { + "global": 0, + "name": "10. Погода", + "type": "Reading", + "subtype": "Weather", + "id": "Weather", + "needSave": 0, + "widget": "anydataDef", + "page": "Погода", + "descr": "", + "int": 3, + "location": "Moscow", + "param": "temp_C", + "round": 0, + "val": "...", + "num": 10 }, { "header": "Сенсоры" }, { "global": 0, - "name": "9. DS18B20 Температура", + "name": "11. Аналоговый сенсор", + "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": 11 + }, + { + "global": 0, + "name": "12. BMP280 Температура", + "type": "Reading", + "subtype": "Bmp280t", + "id": "tmp3", + "widget": "anydataTmp", + "page": "Сенсоры", + "descr": "280 Температура", + "int": 15, + "addr": "0x77", + "round": 1, + "num": 12 + }, + { + "global": 0, + "name": "13. BMP280 Давление", + "type": "Reading", + "subtype": "Bmp280p", + "id": "Press3", + "widget": "anydataMm", + "page": "Сенсоры", + "descr": "280 Давление", + "int": 15, + "addr": "0x77", + "round": 1, + "num": 13 + }, + { + "global": 0, + "name": "14. DS18B20 Температура", "type": "Reading", "subtype": "Ds18b20", "id": "dstmp", @@ -146,12 +223,107 @@ "index": 0, "addr": "", "round": 1, - "num": 9 + "num": 14 }, { "global": 0, - "name": "10. HC-SR04 Ультразвуковой дальномер", - "num": 10, + "name": "15. Сканер DS2401 меток", + "type": "Reading", + "subtype": "DS2401", + "id": "rds", + "int": 100, + "intRepeat": 6, + "pin": 12, + "num": 15 + }, + { + "global": 0, + "name": "16. Сканер кнопок 433 MHz", + "num": 16, + "type": "Reading", + "subtype": "RCswitch", + "id": "rsw", + "int": 100, + "intRepeat": 6, + "pinRx": 12, + "pinTx": 12 + }, + { + "global": 0, + "name": "17. Часы реального времени", + "type": "Reading", + "subtype": "RTC", + "id": "rtc", + "widget": "anydataDef", + "page": "Таймеры", + "descr": "Время RTC", + "chipCode": 1, + "timeFormat": "d-m-Y H:i:s", + "RST": -1, + "CLK": -1, + "DAT": -1, + "ticker": 0, + "int": 5, + "btn-setUTime": "0", + "btn-setSysTime": "nil", + "num": 17 + }, + { + "global": 0, + "name": "18. Sht20 Температура", + "type": "Reading", + "subtype": "Sht20t", + "id": "tmp2", + "widget": "anydataTmp", + "page": "Сенсоры", + "descr": "Температура", + "int": 15, + "round": 1, + "num": 18 + }, + { + "global": 0, + "name": "19. Sht20 Влажность", + "type": "Reading", + "subtype": "Sht20h", + "id": "Hum2", + "widget": "anydataHum", + "page": "Сенсоры", + "descr": "Влажность", + "int": 15, + "round": 1, + "num": 19 + }, + { + "global": 0, + "name": "20. Sht30 Температура", + "type": "Reading", + "subtype": "Sht30t", + "id": "tmp30", + "widget": "anydataTmp", + "page": "Сенсоры", + "descr": "SHT30 Температура", + "int": 15, + "round": 1, + "num": 20 + }, + { + "global": 0, + "name": "21. Sht30 Влажность", + "type": "Reading", + "subtype": "Sht30h", + "id": "Hum30", + "widget": "anydataHum", + "page": "Сенсоры", + "descr": "SHT30 Влажность", + "int": 15, + "round": 1, + "num": 21 + }, + { + "global": 0, + "name": "22. HC-SR04 Ультразвуковой дальномер", + "num": 22, "type": "Reading", "subtype": "Sonar", "id": "sonar", @@ -167,7 +339,7 @@ }, { "global": 0, - "name": "11. Кнопка подключенная к пину", + "name": "23. Кнопка подключенная к пину", "type": "Writing", "subtype": "ButtonIn", "id": "btn", @@ -181,11 +353,12 @@ "pinMode": "INPUT", "debounceDelay": 50, "fixState": 0, - "num": 11 + "inv": 0, + "num": 23 }, { "global": 0, - "name": "12. Управление пином", + "name": "24. Управление пином", "type": "Writing", "subtype": "ButtonOut", "needSave": 0, @@ -196,11 +369,11 @@ "int": 0, "inv": 0, "pin": 2, - "num": 12 + "num": 24 }, { "global": 0, - "name": "13. Расширитель портов Mcp23017", + "name": "25. Расширитель портов Mcp23017", "type": "Reading", "subtype": "Mcp23017", "id": "Mcp", @@ -210,11 +383,11 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 13 + "num": 25 }, { "global": 0, - "name": "14. Сенсорная кнопка", + "name": "26. Сенсорная кнопка", "type": "Writing", "subtype": "Multitouch", "id": "impulse", @@ -228,11 +401,11 @@ "pinMode": "INPUT", "debounceDelay": 50, "PWMDelay": 500, - "num": 14 + "num": 26 }, { "global": 0, - "name": "15. Расширитель портов Pcf8574", + "name": "27. Расширитель портов Pcf8574", "type": "Reading", "subtype": "Pcf8574", "id": "Pcf", @@ -242,11 +415,11 @@ "int": "0", "addr": "0x20", "index": 1, - "num": 15 + "num": 27 }, { "global": 0, - "name": "16. PWM ESP8266", + "name": "28. PWM ESP8266", "type": "Writing", "subtype": "Pwm8266", "id": "pwm", @@ -258,11 +431,11 @@ "freq": 5000, "val": 0, "apin": -1, - "num": 16 + "num": 28 }, { "global": 0, - "name": "17. Телеграм-Лайт", + "name": "29. Телеграм-Лайт", "type": "Writing", "subtype": "TelegramLT", "id": "tg", @@ -271,14 +444,30 @@ "descr": "", "token": "", "chatID": "", - "num": 17 + "num": 29 }, { "header": "Экраны" }, { "global": 0, - "name": "18. LCD экран 2004", + "name": "30. LCD Dwin экран", + "type": "Reading", + "subtype": "DwinI", + "id": "dwin", + "widget": "", + "page": "", + "descr": "", + "int": 15, + "TX": 17, + "RX": 16, + "line": 2, + "speed": 115200, + "num": 30 + }, + { + "global": 0, + "name": "31. LCD экран 2004", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -290,10 +479,10 @@ "size": "20,4", "coord": "0,0", "id2show": "id датчика", - "num": 18 + "num": 31 }, { - "name": "19. LCD экран 1602", + "name": "32. LCD экран 1602", "type": "Reading", "subtype": "Lcd2004", "id": "Lcd", @@ -305,6 +494,6 @@ "size": "16,2", "coord": "0,0", "id2show": "id датчика", - "num": 19 + "num": 32 } ] \ No newline at end of file diff --git a/myProfile.json b/myProfile.json index 4edd08a0..b643f2d5 100644 --- a/myProfile.json +++ b/myProfile.json @@ -80,6 +80,10 @@ "path": "src/modules/sensors/AnalogAdc", "active": true }, + { + "path": "src/modules/sensors/BH_1750", + "active": false + }, { "path": "src/modules/sensors/Ble", "active": false @@ -100,6 +104,10 @@ "path": "src/modules/sensors/Ds18b20", "active": true }, + { + "path": "src/modules/sensors/DS2401", + "active": false + }, { "path": "src/modules/sensors/Emon", "active": false @@ -252,6 +260,10 @@ } ], "Экраны": [ + { + "path": "src/modules/display/DwinI", + "active": false + }, { "path": "src/modules/display/Lcd2004", "active": true diff --git a/src/modules/display/DwinI/DwinI.cpp b/src/modules/display/DwinI/DwinI.cpp new file mode 100644 index 00000000..0e43b29c --- /dev/null +++ b/src/modules/display/DwinI/DwinI.cpp @@ -0,0 +1,56 @@ +#include "Global.h" +#include "classes/IoTItem.h" + +#ifdef ESP8266 +#include +#else +#include +#endif + +class DwinI : public IoTItem { + private: +#ifdef ESP8266 + SoftwareSerial* _myUART; +#else + HardwareSerial* _myUART; +#endif + + public: + DwinI(String parameters) : IoTItem(parameters) { + int _tx, _rx, _speed, _line; + jsonRead(parameters, "RX", _rx); + jsonRead(parameters, "TX", _tx); + jsonRead(parameters, "speed", _speed); + jsonRead(parameters, "line", _line); + +#ifdef ESP8266 + _myUART = new SoftwareSerial(_rx, _tx); + _myUART->begin(_speed); +#endif +#ifdef ESP32 + _myUART = new HardwareSerial(_line); + _myUART->begin(_speed, SERIAL_8N1, _rx, _tx); +#endif + } + + void doByInterval() { + Serial.println("ddddddddddddd"); + } + + IoTValue execute(String command, std::vector ¶m) { // будет возможным использовать, когда сценарии запустятся + + return {}; + } + + ~DwinI(){ + + }; +}; + +void *getAPI_DwinI(String subtype, String param) { + if (subtype == F("DwinI")) { + return new DwinI(param); + } else { + return nullptr; + } +} diff --git a/src/modules/display/DwinI/modinfo.json b/src/modules/display/DwinI/modinfo.json new file mode 100644 index 00000000..116fda53 --- /dev/null +++ b/src/modules/display/DwinI/modinfo.json @@ -0,0 +1,61 @@ +{ + "menuSection": "Экраны", + + "configItem": [{ + "global": 0, + "name": "LCD Dwin экран", + "type": "Reading", + "subtype": "DwinI", + "id": "dwin", + "widget": "", + "page": "", + "descr": "", + + "int": 15, + "TX": 17, + "RX": 16, + "line": 2, + "speed": 115200 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "specialThanks": "", + "moduleName": "DwinI", + "moduleVersion": "1.0", + "usedRam": { + "esp32_4mb": 15, + "esp8266_4mb": 15 + }, + "moduleDesc": "Позволяет выводить на графические экраны фирмы Dwin информацию от элементов конфигурации в автоматическом режиме.", + "propInfo": { + "int": "" + }, + "funcInfo": [ + { + "name": "rrrr", + "descr": "rrrr", + "params": [] + } + ] + }, + + "defActive": false, + + "usedLibs": { + "esp32_4mb": [ + ], + "esp8266_4mb": [ + ], + "esp8266_1mb": [ + ], + "esp8266_1mb_ota": [ + ], + "esp8285_1mb": [ + ], + "esp8285_1mb_ota": [ + ] + } +} \ No newline at end of file diff --git a/src/modules/sensors/BH_1750/Bh1750.cpp b/src/modules/sensors/BH_1750/Bh1750.cpp new file mode 100644 index 00000000..d8a171d3 --- /dev/null +++ b/src/modules/sensors/BH_1750/Bh1750.cpp @@ -0,0 +1,32 @@ +#include "Global.h" +#include "classes/IoTItem.h" + +#include "BH1750.h" + + +class Bh1750 : public IoTItem { + BH1750 _lightMeter; + + public: + Bh1750(String parameters): IoTItem(parameters){ + _lightMeter.begin(); + } + + void doByInterval() { + value.valD = _lightMeter.readLightLevel(); + if (value.valD < 70000) + regEvent(value.valD, "BH1750"); + else + SerialPrint("E", "Sensor BH1750", "Error"); + } + + ~Bh1750() {}; +}; + +void* getAPI_Bh1750(String subtype, String param) { + if (subtype == F("Bh1750")) { + return new Bh1750(param); + } else { + return nullptr; + } +} \ No newline at end of file diff --git a/src/modules/sensors/BH_1750/modinfo.json b/src/modules/sensors/BH_1750/modinfo.json new file mode 100644 index 00000000..832e4c5c --- /dev/null +++ b/src/modules/sensors/BH_1750/modinfo.json @@ -0,0 +1,44 @@ +{ + "menuSection": "Сенсоры", + + "configItem": [{ + "global": 0, + "name": "Cенсор освещенность Bh1750", + "type": "Reading", + "subtype": "Bh1750", + "id": "Bh1750", + "widget": "anydata", + "page": "Сенсоры", + "descr": "Освещённость", + "round": 1, + "int": 15 + }], + + "about": { + "authorName": "Ilya Belyakov", + "authorContact": "https://t.me/Biveraxe", + "authorGit": "https://github.com/biveraxe", + "exampleURL": "https://iotmanager.org/wiki", + "specialThanks": "", + "moduleName": "Bh1750", + "moduleVersion": "1.0", + "usedRam": { + "esp32_4mb": 15, + "esp8266_4mb": 15 + }, + "title": "Cенсор освещённости", + "moduleDesc": "Позволяет получить текущее значение освещённости в LUX.", + "propInfo": { + "int": "Количество секунд между опросами датчика." + } + }, + "defActive": false, + "usedLibs": { + "esp32_4mb": [ + "BH1750" + ], + "esp8266_4mb": [ + "BH1750" + ] + } +} \ No newline at end of file