mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-30 03:49:13 +03:00
Добавляем sht30
This commit is contained in:
@@ -361,8 +361,32 @@
|
|||||||
"num": 26
|
"num": 26
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "27. Сонар HC-SR04",
|
"name": "27. Cенсор температуры Sht30",
|
||||||
"num": 27,
|
"type": "Reading",
|
||||||
|
"subtype": "Sht30t",
|
||||||
|
"id": "tmp30",
|
||||||
|
"widget": "anydataTmp",
|
||||||
|
"page": "Сенсоры",
|
||||||
|
"descr": "SHT30 Температура",
|
||||||
|
"int": 15,
|
||||||
|
"round": 1,
|
||||||
|
"num": 27
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "28. Cенсор влажности Sht30",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Sht30h",
|
||||||
|
"id": "Hum30",
|
||||||
|
"widget": "anydataHum",
|
||||||
|
"page": "Сенсоры",
|
||||||
|
"descr": "SHT30 Влажность",
|
||||||
|
"int": 15,
|
||||||
|
"round": 1,
|
||||||
|
"num": 28
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "29. Сонар HC-SR04",
|
||||||
|
"num": 29,
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Sonar",
|
"subtype": "Sonar",
|
||||||
"id": "sonar",
|
"id": "sonar",
|
||||||
@@ -377,7 +401,7 @@
|
|||||||
"header": "Расширения"
|
"header": "Расширения"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "28. Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)",
|
"name": "30. Поддержка DS1302(1), DS1307(2), DS3231(3), RX8025(4)",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "IarduinoRTC",
|
"subtype": "IarduinoRTC",
|
||||||
"id": "RTC",
|
"id": "RTC",
|
||||||
@@ -391,10 +415,10 @@
|
|||||||
"dat": 4,
|
"dat": 4,
|
||||||
"defFormat": "d-m-Y",
|
"defFormat": "d-m-Y",
|
||||||
"ticker": 0,
|
"ticker": 0,
|
||||||
"num": 28
|
"num": 30
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "29. Расширитель портов Mcp23017",
|
"name": "31. Расширитель портов Mcp23017",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Mcp23017",
|
"subtype": "Mcp23017",
|
||||||
"id": "Mcp",
|
"id": "Mcp",
|
||||||
@@ -404,10 +428,10 @@
|
|||||||
"int": "0",
|
"int": "0",
|
||||||
"addr": "0x20",
|
"addr": "0x20",
|
||||||
"index": 1,
|
"index": 1,
|
||||||
"num": 29
|
"num": 31
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "30. Доп. функции системы",
|
"name": "32. Доп. функции системы",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "SysExt",
|
"subtype": "SysExt",
|
||||||
"id": "SysExt",
|
"id": "SysExt",
|
||||||
@@ -415,10 +439,10 @@
|
|||||||
"page": "",
|
"page": "",
|
||||||
"descr": "",
|
"descr": "",
|
||||||
"int": 15,
|
"int": 15,
|
||||||
"num": 30
|
"num": 32
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "31. Переменная",
|
"name": "33. Переменная",
|
||||||
"type": "Reading",
|
"type": "Reading",
|
||||||
"subtype": "Variable",
|
"subtype": "Variable",
|
||||||
"id": "var",
|
"id": "var",
|
||||||
@@ -427,6 +451,6 @@
|
|||||||
"descr": "",
|
"descr": "",
|
||||||
"int": "0",
|
"int": "0",
|
||||||
"val": "0",
|
"val": "0",
|
||||||
"num": 31
|
"num": 33
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -103,6 +103,7 @@ lib_deps =
|
|||||||
adafruit/MAX6675 library
|
adafruit/MAX6675 library
|
||||||
rc-switch @ ^2.6.4
|
rc-switch @ ^2.6.4
|
||||||
robtillaart/SHT2x@^0.1.1
|
robtillaart/SHT2x@^0.1.1
|
||||||
|
WEMOS SHT3x@1.0.0
|
||||||
adafruit/Adafruit MCP23017 Arduino Library@^2.0.2
|
adafruit/Adafruit MCP23017 Arduino Library@^2.0.2
|
||||||
adafruit/Adafruit BusIO @ ^1.13.0
|
adafruit/Adafruit BusIO @ ^1.13.0
|
||||||
build_src_filter =
|
build_src_filter =
|
||||||
@@ -123,6 +124,7 @@ build_src_filter =
|
|||||||
+<modules\sensors\Max6675>
|
+<modules\sensors\Max6675>
|
||||||
+<modules\sensors\RCswitch>
|
+<modules\sensors\RCswitch>
|
||||||
+<modules\sensors\Sht20>
|
+<modules\sensors\Sht20>
|
||||||
|
+<modules\sensors\Sht30>
|
||||||
+<modules\sensors\Sonar>
|
+<modules\sensors\Sonar>
|
||||||
+<modules\system\IarduinoRTC>
|
+<modules\system\IarduinoRTC>
|
||||||
+<modules\system\Mcp23017>
|
+<modules\system\Mcp23017>
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ void* getAPI_Hdc1080(String subtype, String params);
|
|||||||
void* getAPI_Max6675(String subtype, String params);
|
void* getAPI_Max6675(String subtype, String params);
|
||||||
void* getAPI_RCswitch(String subtype, String params);
|
void* getAPI_RCswitch(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_Sonar(String subtype, String params);
|
void* getAPI_Sonar(String subtype, String params);
|
||||||
void* getAPI_IarduinoRTC(String subtype, String params);
|
void* getAPI_IarduinoRTC(String subtype, String params);
|
||||||
void* getAPI_Mcp23017(String subtype, String params);
|
void* getAPI_Mcp23017(String subtype, String params);
|
||||||
@@ -42,6 +43,7 @@ if ((tmpAPI = getAPI_Hdc1080(subtype, params)) != nullptr) return tmpAPI;
|
|||||||
if ((tmpAPI = getAPI_Max6675(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Max6675(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_RCswitch(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_RCswitch(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_Sonar(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Sonar(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_IarduinoRTC(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_IarduinoRTC(subtype, params)) != nullptr) return tmpAPI;
|
||||||
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
if ((tmpAPI = getAPI_Mcp23017(subtype, params)) != nullptr) return tmpAPI;
|
||||||
|
|||||||
61
src/modules/sensors/Sht30/Sht30.cpp
Normal file
61
src/modules/sensors/Sht30/Sht30.cpp
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/******************************************************************
|
||||||
|
Simple library for the WEMOS SHT30 Shield.
|
||||||
|
|
||||||
|
https://github.com/wemos/WEMOS_SHT3x_Arduino_Library
|
||||||
|
|
||||||
|
adapted for version 4 @Serghei63
|
||||||
|
******************************************************************/
|
||||||
|
|
||||||
|
#include "Global.h"
|
||||||
|
#include "classes/IoTItem.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include "Wire.h"
|
||||||
|
#include <WEMOS_SHT3X.h>
|
||||||
|
|
||||||
|
SHT3X sht30(0x45);
|
||||||
|
|
||||||
|
class Sht30t : public IoTItem {
|
||||||
|
public:
|
||||||
|
Sht30t(String parameters): IoTItem(parameters) { }
|
||||||
|
|
||||||
|
void doByInterval() {
|
||||||
|
if(sht30.get()==0){
|
||||||
|
value.valD = sht30.cTemp;
|
||||||
|
|
||||||
|
SerialPrint("E", "Sensor Sht30t", "OK");
|
||||||
|
|
||||||
|
if (value.valD < -46.85F) regEvent(value.valD, "Sht30t"); // TODO: найти способ понимания ошибки получения данных
|
||||||
|
else SerialPrint("E", "Sensor Sht30t", "Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~Sht30t() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
class Sht30h : public IoTItem {
|
||||||
|
public:
|
||||||
|
Sht30h(String parameters): IoTItem(parameters) { }
|
||||||
|
|
||||||
|
void doByInterval() {
|
||||||
|
if(sht30.get()==0){
|
||||||
|
value.valD = sht30.humidity;
|
||||||
|
|
||||||
|
SerialPrint("E", "Sensor Sht30h", "OK");
|
||||||
|
if (value.valD != -6) regEvent(value.valD, "Sht30h"); // TODO: найти способ понимания ошибки получения данных
|
||||||
|
else SerialPrint("E", "Sensor Sht30h", "Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~Sht30h() {};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void* getAPI_Sht30(String subtype, String param) {
|
||||||
|
if (subtype == F("Sht30t")){
|
||||||
|
return new Sht30t(param);
|
||||||
|
}
|
||||||
|
if (subtype == F("Sht30h")) {
|
||||||
|
return new Sht30h(param);
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/modules/sensors/Sht30/modinfo.json
Normal file
50
src/modules/sensors/Sht30/modinfo.json
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
"menuSection": "Сенсоры",
|
||||||
|
|
||||||
|
"configItem": [{
|
||||||
|
"name": "Cенсор температуры Sht30",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Sht30t",
|
||||||
|
"id": "tmp30",
|
||||||
|
"widget": "anydataTmp",
|
||||||
|
"page": "Сенсоры",
|
||||||
|
"descr": "SHT30 Температура",
|
||||||
|
"int": 15,
|
||||||
|
"round": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Cенсор влажности Sht30",
|
||||||
|
"type": "Reading",
|
||||||
|
"subtype": "Sht30h",
|
||||||
|
"id": "Hum30",
|
||||||
|
"widget": "anydataHum",
|
||||||
|
"page": "Сенсоры",
|
||||||
|
"descr": "SHT30 Влажность",
|
||||||
|
"int": 15,
|
||||||
|
"round": 1
|
||||||
|
}],
|
||||||
|
|
||||||
|
"about": {
|
||||||
|
"authorName": "Serghei Crasnicov",
|
||||||
|
"authorContact": "https://t.me/Serghei63",
|
||||||
|
"authorGit": "https://github.com/Serghei63",
|
||||||
|
"specialThanks": "",
|
||||||
|
"moduleName": "Sht30",
|
||||||
|
"moduleVersion": "1.0",
|
||||||
|
"moduleDesc": "Позволяет получить температуру и влажность с датчика Sht30.",
|
||||||
|
"propInfo": {
|
||||||
|
"int": "Количество секунд между опросами датчика."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"defActive": true,
|
||||||
|
|
||||||
|
"devices": {
|
||||||
|
"esp32_4mb": [
|
||||||
|
"WEMOS SHT3x@1.0.0"
|
||||||
|
],
|
||||||
|
"esp8266_4mb": [
|
||||||
|
"WEMOS SHT3x@1.0.0"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user