mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 22:22:16 +03:00
add IRremote
This commit is contained in:
@@ -40,7 +40,7 @@ boolean isDigitDotCommaStr(const String& str);
|
||||
|
||||
String prettyBytes(size_t size);
|
||||
|
||||
String uint64ToString(uint64_t input, uint8_t base = 10);
|
||||
String uint64ToStringIoTM(uint64_t input, uint8_t base = 10);
|
||||
|
||||
void cleanString(String& str);
|
||||
|
||||
|
||||
106
myProfile.json
106
myProfile.json
@@ -135,15 +135,15 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/Cron",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/DiscoveryHA",
|
||||
"active": true
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/DiscoveryHomeD",
|
||||
"active": true
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/GoogleSheet",
|
||||
@@ -155,19 +155,19 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/LogingDaily",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/Math",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/owmWeather",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/Ping",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/virtual/Timer",
|
||||
@@ -193,11 +193,11 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/A02Distance",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Acs712",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Ads1115",
|
||||
@@ -205,11 +205,11 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/AhtXX",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/AnalogAdc",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/BH_1750",
|
||||
@@ -217,7 +217,7 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/BL0937",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Ble",
|
||||
@@ -233,19 +233,19 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Bme280",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Bmp280",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Dht1122",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Ds18b20",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/DS2401",
|
||||
@@ -289,7 +289,7 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Impulse",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Ina219",
|
||||
@@ -317,7 +317,7 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/MQgas",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Ntc",
|
||||
@@ -329,7 +329,7 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Pzem004t_v2",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/RCswitch",
|
||||
@@ -337,11 +337,11 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/RTC",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/S8",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Scd40",
|
||||
@@ -357,25 +357,25 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Sht20",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Sht30",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/Sonar",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/sensors/UART",
|
||||
"active": false
|
||||
"active": true
|
||||
}
|
||||
],
|
||||
"executive_devices": [
|
||||
{
|
||||
"path": "src/modules/exec/AnalogBtn",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/BrokerMQTT",
|
||||
@@ -383,24 +383,24 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/ButtonIn",
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/ButtonOut",
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Buzzer",
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/EctoControlAdapter",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Enconder",
|
||||
"path": "src/modules/exec/ButtonOut",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Buzzer",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/EctoControlAdapter",
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Enconder",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/EspCam",
|
||||
"active": false
|
||||
@@ -415,6 +415,10 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/IoTServo",
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/IRremote",
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
@@ -423,15 +427,15 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Mcp23017",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Mp3",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Multitouch",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/MySensors",
|
||||
@@ -439,15 +443,15 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Pcf8574",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Pwm32",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Pwm8266",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/SDcard",
|
||||
@@ -471,11 +475,11 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/TelegramLT",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Telegram_v2",
|
||||
"active": true
|
||||
"active": false
|
||||
},
|
||||
{
|
||||
"path": "src/modules/exec/Thermostat",
|
||||
@@ -489,11 +493,11 @@
|
||||
"screens": [
|
||||
{
|
||||
"path": "src/modules/display/DwinI",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/display/Lcd2004",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/display/Nextion",
|
||||
@@ -509,11 +513,11 @@
|
||||
},
|
||||
{
|
||||
"path": "src/modules/display/Oled64",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/display/Smi2_m",
|
||||
"active": false
|
||||
"active": true
|
||||
},
|
||||
{
|
||||
"path": "src/modules/display/TM16XX",
|
||||
|
||||
@@ -722,16 +722,69 @@ build_src_filter =
|
||||
|
||||
[env:esp32_4mb3f_fromitems]
|
||||
lib_deps =
|
||||
gyverlibs/FastBot
|
||||
https://github.com/enjoyneering/AHTxx.git
|
||||
adafruit/Adafruit BME280 Library
|
||||
adafruit/Adafruit BMP280 Library
|
||||
beegee-tokyo/DHT sensor library for ESPx
|
||||
https://github.com/milesburton/Arduino-Temperature-Control-Library
|
||||
robtillaart/SHT2x@^0.1.1
|
||||
WEMOS SHT3x@1.0.0
|
||||
plerup/EspSoftwareSerial
|
||||
gyverlibs/EncButton @ ^2.0
|
||||
https://github.com/RoboticsBrno/ServoESP32#v1.0.3
|
||||
adafruit/Adafruit MCP23017 Arduino Library@^2.1.0
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
dfrobot/DFRobotDFPlayerMini @ ^1.0.5
|
||||
adafruit/Adafruit BusIO @ ^1.13.2
|
||||
plerup/EspSoftwareSerial
|
||||
https://github.com/robotclass/RobotClass_LiquidCrystal_I2C
|
||||
marcoschwartz/LiquidCrystal_I2C@^1.1.4
|
||||
https://github.com/stblassitude/Adafruit_SSD1306_Wemos_OLED
|
||||
https://github.com/adafruit/Adafruit-GFX-Library
|
||||
build_src_filter =
|
||||
+<modules/virtual/DiscoveryHA>
|
||||
+<modules/virtual/DiscoveryHomeD>
|
||||
+<modules/virtual/Cron>
|
||||
+<modules/virtual/Loging>
|
||||
+<modules/virtual/LogingDaily>
|
||||
+<modules/virtual/Math>
|
||||
+<modules/virtual/owmWeather>
|
||||
+<modules/virtual/Ping>
|
||||
+<modules/virtual/Timer>
|
||||
+<modules/virtual/Variable>
|
||||
+<modules/virtual/VButton>
|
||||
+<modules/exec/EctoControlAdapter>
|
||||
+<modules/exec/Telegram_v2>
|
||||
+<modules/sensors/A02Distance>
|
||||
+<modules/sensors/Acs712>
|
||||
+<modules/sensors/AhtXX>
|
||||
+<modules/sensors/AnalogAdc>
|
||||
+<modules/sensors/BL0937>
|
||||
+<modules/sensors/Bme280>
|
||||
+<modules/sensors/Bmp280>
|
||||
+<modules/sensors/Dht1122>
|
||||
+<modules/sensors/Ds18b20>
|
||||
+<modules/sensors/Impulse>
|
||||
+<modules/sensors/MQgas>
|
||||
+<modules/sensors/Pzem004t_v2>
|
||||
+<modules/sensors/RTC>
|
||||
+<modules/sensors/S8>
|
||||
+<modules/sensors/Sht20>
|
||||
+<modules/sensors/Sht30>
|
||||
+<modules/sensors/Sonar>
|
||||
+<modules/sensors/UART>
|
||||
+<modules/exec/AnalogBtn>
|
||||
+<modules/exec/ButtonIn>
|
||||
+<modules/exec/ButtonOut>
|
||||
+<modules/exec/Buzzer>
|
||||
+<modules/exec/Enconder>
|
||||
+<modules/exec/IoTServo>
|
||||
+<modules/exec/Mcp23017>
|
||||
+<modules/exec/Mp3>
|
||||
+<modules/exec/Multitouch>
|
||||
+<modules/exec/Pcf8574>
|
||||
+<modules/exec/Pwm32>
|
||||
+<modules/exec/TelegramLT>
|
||||
+<modules/display/DwinI>
|
||||
+<modules/display/Lcd2004>
|
||||
+<modules/display/Oled64>
|
||||
+<modules/display/Smi2_m>
|
||||
|
||||
[env:esp32cam_4mb_fromitems]
|
||||
lib_deps =
|
||||
|
||||
215
src/modules/exec/IRremote/IRremote.cpp
Normal file
215
src/modules/exec/IRremote/IRremote.cpp
Normal file
@@ -0,0 +1,215 @@
|
||||
#include "Global.h"
|
||||
#include "classes/IoTItem.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <IRremoteESP8266.h>
|
||||
#include <IRac.h>
|
||||
#include <IRutils.h>
|
||||
|
||||
IRac* ac;
|
||||
|
||||
const uint16_t kIrLed = 4; // The ESP GPIO pin to use that controls the IR LED.
|
||||
|
||||
class IRremote : public IoTItem {
|
||||
private:
|
||||
|
||||
String _set_id; // заданная температура
|
||||
|
||||
//float pv_last = 0; // предыдущая температура
|
||||
|
||||
//float sp, pv, pv2;
|
||||
//String interim;
|
||||
int enable = 1;
|
||||
float _tmp;
|
||||
|
||||
int _prot; // протокол
|
||||
int _pinTx; // Выход модуля передатчика
|
||||
|
||||
public:
|
||||
IRremote(String parameters): IoTItem(parameters) {
|
||||
jsonRead(parameters, "pinTx", _pinTx); //передатчик
|
||||
jsonRead(parameters, "prot", _prot); // используемый протокол
|
||||
jsonRead(parameters, "set_id", _set_id); // id установленной температуры
|
||||
|
||||
|
||||
|
||||
|
||||
if (_pinTx >= 0) {
|
||||
IoTgpio.pinMode(_pinTx, OUTPUT);
|
||||
IoTgpio.digitalWrite(_pinTx, false); }
|
||||
|
||||
// Set up what we want to send.
|
||||
// See state_t, opmode_t, fanspeed_t, swingv_t, & swingh_t in IRsend.h for
|
||||
// all the various options.
|
||||
|
||||
ac = new IRac(kIrLed);
|
||||
ac->next.protocol = (decode_type_t)_prot;
|
||||
ac->next.model = 1; // Некоторые кондиционеры имеют разные модели. Попробуйте только первое.
|
||||
ac->next.mode = stdAc::opmode_t::kCool; // Сначала запустите в прохладном режиме.
|
||||
ac->next.celsius = true; // Используйте градусы Цельсия в качестве единиц измерения температуры. Ложь = Фаренгейт
|
||||
ac->next.degrees = 20; // 20 degrees.
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kMedium; // Запустите вентилятор на средней скорости.
|
||||
ac->next.swingv = stdAc::swingv_t::kOff; // Не поворачивайте вентилятор вверх или вниз.
|
||||
ac->next.swingh = stdAc::swingh_t::kOff; // Не поворачивайте вентилятор влево или вправо.
|
||||
ac->next.light = false; // Выключите все светодиоды/световые приборы/дисплеи, которые сможем.
|
||||
ac->next.beep = false; // Если есть возможность, выключите все звуковые сигналы кондиционера.
|
||||
ac->next.econo = false; // Turn off any economy modes if we can.
|
||||
ac->next.filter = false; // Turn off any Ion/Mold/Health filters if we can.
|
||||
ac->next.turbo = false; // Don't use any turbo/powerful/etc modes.
|
||||
ac->next.quiet = false; // Don't use any quiet/silent/etc modes.
|
||||
ac->next.sleep = -1; // Don't set any sleep time or modes.
|
||||
ac->next.clean = false; // Turn off any Cleaning options if we can.
|
||||
ac->next.clock = -1; // Don't set any current time if we can avoid it.
|
||||
ac->next.power = false; // Initially start with the unit off.
|
||||
|
||||
Serial.println("Try to turn on & off every supported A/C type ...");
|
||||
}
|
||||
|
||||
|
||||
void doByInterval() {
|
||||
|
||||
|
||||
|
||||
// pv_last = pv;
|
||||
}
|
||||
|
||||
IoTValue execute(String command, std::vector<IoTValue> ¶m) {
|
||||
|
||||
if (command == "on") {
|
||||
|
||||
ac->next.power = true; // Типа команда включить
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC on ");
|
||||
}
|
||||
|
||||
if (command == "off") {
|
||||
|
||||
ac->next.power = false;
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC off ");
|
||||
}
|
||||
|
||||
if (command == "cool") {
|
||||
|
||||
ac->next.mode = stdAc::opmode_t::kCool;
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC cool ");
|
||||
}
|
||||
|
||||
if (command == "heat") {
|
||||
|
||||
ac->next.mode = stdAc::opmode_t::kHeat;
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC heat ");
|
||||
}
|
||||
|
||||
if (command == "dry") {
|
||||
|
||||
ac->next.mode = stdAc::opmode_t::kDry;
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC dry ");
|
||||
}
|
||||
if (command == "auto") {
|
||||
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kAuto;
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC speed1 ");
|
||||
}
|
||||
if (command == "speedmin") {
|
||||
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kMin;
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC speed min ");
|
||||
}
|
||||
if (command == "speedlow") {
|
||||
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kLow;
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC speed low ");
|
||||
}
|
||||
if (command == "speedmed") {
|
||||
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kMedium; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC speed medium ");
|
||||
}
|
||||
if (command == "speedhigh") {
|
||||
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kHigh; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC speed high");
|
||||
}
|
||||
if (command == "speedmax") {
|
||||
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kMax; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC speed max");
|
||||
}
|
||||
|
||||
if (command == "speedmh") {
|
||||
|
||||
ac->next.fanspeed = stdAc::fanspeed_t::kMediumHigh; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC speed mh");
|
||||
}
|
||||
|
||||
//setTemp acc.setTemp(val)
|
||||
|
||||
if (command == "setTemp") {
|
||||
|
||||
// заданная температура
|
||||
IoTItem *tmp = findIoTItem(_set_id);
|
||||
if (tmp)
|
||||
{
|
||||
//interim = tmp->getValue();
|
||||
_tmp = ::atof(tmp->getValue().c_str());
|
||||
ac->next.degrees = _tmp; // set Temp 17 C - 30 C.
|
||||
ac->sendAc(); // Send the message.
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC set temp -> " + String(_tmp) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// если не заполнены настройки кондиционера
|
||||
setValue("ошибка настройки кондиционера");
|
||||
}
|
||||
|
||||
//ac->next.degrees = _tmp; // set Temp 17 C - 30 C.
|
||||
//ac->sendAc(); // Send the message.
|
||||
|
||||
|
||||
}
|
||||
//ac->next.swingv = stdAc::swingv_t::kOff;
|
||||
|
||||
if (command == "swing") {
|
||||
|
||||
ac->next.swingv = stdAc::swingv_t::kMiddle;; // Надо выбрать под конкретный кондиционер из 6-ти вариантов
|
||||
ac->sendAc(); // Send the message.
|
||||
|
||||
SerialPrint("i", F("IRremote"), "Ballu AC swing middle");
|
||||
}
|
||||
|
||||
return {}; // команда поддерживает возвращаемое значения. Т.е. по итогу выполнения команды или общения с внешней системой, можно вернуть значение в сценарий для дальнейшей обработки
|
||||
}
|
||||
|
||||
~IRremote() {};
|
||||
};
|
||||
|
||||
void* getAPI_IRremote(String subtype, String param) {
|
||||
if (subtype == F("IRremote")) {
|
||||
return new IRremote(param);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
94
src/modules/exec/IRremote/modinfo.json
Normal file
94
src/modules/exec/IRremote/modinfo.json
Normal file
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"menuSection": "executive_devices",
|
||||
|
||||
"configItem": [{
|
||||
|
||||
"global": 0,
|
||||
"name": "Управление кондиционером",
|
||||
"type": "Reading",
|
||||
"subtype": "IRremote",
|
||||
"id": "ir",
|
||||
"pinTx": 4,
|
||||
"set_id": "",
|
||||
"int": 1,
|
||||
"prot": 15
|
||||
}],
|
||||
|
||||
"about": {
|
||||
"authorName": "Serghei Crasnicov",
|
||||
"authorContact": "https://t.me/Serghei63",
|
||||
"authorGit": "https://github.com/Serghei63",
|
||||
"specialThanks": "Mikhail Bubnov https://t.me/Mit4bmw , Олег Астахов https://t.me/Threedreality , Valentin Khandriga @Valiuhaaa",
|
||||
"moduleName": "IRremote",
|
||||
"moduleVersion": "2.0",
|
||||
"usedRam": {
|
||||
"esp32_4mb": 15,
|
||||
"esp8266_4mb": 15
|
||||
},
|
||||
"title": "Эмулятор IR пульта",
|
||||
"moduleDesc": "Позволяет управлять кондиционером и другой техникой по IR каналу",
|
||||
"propInfo": {
|
||||
"pinTx": "GPIO номер, к которому подключен инфракрасный приемник.",
|
||||
"prot": " Цифровой код протокола . UNKNOWN = -1, UNUSED = 0, COOLIX - 15, SAMSUNG_AC - 46 ....",
|
||||
"set_id": "id установленной температуры"
|
||||
},
|
||||
"funcInfo": [
|
||||
{
|
||||
"name": "on",
|
||||
"descr": "Включить конциционер",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "off",
|
||||
"descr": "Выключить конциционер",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "cool",
|
||||
"descr": "Режим охлаждения",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "heat",
|
||||
"descr": "Режим нагрева",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "dry",
|
||||
"descr": "Режим осушения",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "speed1",
|
||||
"descr": "Медленная скорость вентилятора",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "speed2",
|
||||
"descr": "Средняя скорость вентилятора",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "speed3",
|
||||
"descr": "Максимальная скорость вентилятора",
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "setTemp",
|
||||
"descr": "Установленная температура",
|
||||
"params": []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
"defActive": false,
|
||||
|
||||
"usedLibs": {
|
||||
"esp32*": [
|
||||
"https://github.com/crankyoldgit/IRremoteESP8266"
|
||||
],
|
||||
"esp82*": [
|
||||
"https://github.com/crankyoldgit/IRremoteESP8266"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -19,21 +19,21 @@ class Telegram : public IoTItem {
|
||||
msg = deleteBeforeDelimiter(msg, "_");
|
||||
generateOrder(selectToMarker(msg, "_"), selectToMarkerLast(msg, "_"));
|
||||
_myBot.sendMessage(_chatID, "order done");
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + String(msg));
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + String(msg));
|
||||
} else if (msg.indexOf("get") != -1) {
|
||||
msg = deleteBeforeDelimiter(msg, "_");
|
||||
IoTItem* item = findIoTItem(msg);
|
||||
if (item) {
|
||||
_myBot.sendMessage(_chatID, item->getValue());
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + String(msg));
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + String(msg));
|
||||
}
|
||||
} else if (msg.indexOf("all") != -1) {
|
||||
String list = returnListOfParams();
|
||||
_myBot.sendMessage(_chatID, list);
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + "\n" + list);
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + "\n" + list);
|
||||
} else if (msg.indexOf("help") != -1) {
|
||||
_myBot.sendMessage(_chatID, "ID: " + chipId);
|
||||
_myBot.sendMessage(_chatID, "chatID: " + uint64ToString(_chatID));
|
||||
_myBot.sendMessage(_chatID, "chatID: " + uint64ToStringIoTM(_chatID));
|
||||
_myBot.sendMessage(_chatID, F("Wrong order, use /all to get all values, /get_id to get value, or /set_id_value to set value"));
|
||||
} else {
|
||||
setValue(msg);
|
||||
@@ -70,7 +70,7 @@ class Telegram : public IoTItem {
|
||||
if (_receiveMsg) {
|
||||
TBMessage msg;
|
||||
if (_myBot.getNewMessage(msg)) {
|
||||
SerialPrint("->", F("Telegram"), "chat ID: " + uint64ToString(msg.sender.id) + ", msg: " + msg.text);
|
||||
SerialPrint("->", F("Telegram"), "chat ID: " + uint64ToStringIoTM(msg.sender.id) + ", msg: " + msg.text);
|
||||
if (_autos) {
|
||||
_chatID = msg.sender.id;
|
||||
}
|
||||
@@ -100,12 +100,12 @@ class Telegram : public IoTItem {
|
||||
void sendTelegramMsg(bool often, String msg) {
|
||||
if (often) {
|
||||
_myBot.sendMessage(_chatID, msg);
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + msg);
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + msg);
|
||||
} else {
|
||||
if (_prevMsg != msg) {
|
||||
_prevMsg = msg;
|
||||
_myBot.sendMessage(_chatID, msg);
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToString(_chatID) + ", msg: " + msg);
|
||||
SerialPrint("<-", F("Telegram"), "chat ID: " + uint64ToStringIoTM(_chatID) + ", msg: " + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,14 @@ void scanI2C() {
|
||||
|
||||
if (error == 0){
|
||||
message += "I2C device found at address 0x";
|
||||
message += uint64ToString(address, 16);
|
||||
message += uint64ToStringIoTM(address, 16);
|
||||
message += " !";
|
||||
|
||||
nDevices++;
|
||||
}
|
||||
else if (error==4) {
|
||||
message += "Unknow error at address 0x";
|
||||
message += uint64ToString(address, 16);
|
||||
message += uint64ToStringIoTM(address, 16);
|
||||
}
|
||||
}
|
||||
if (nDevices == 0)
|
||||
|
||||
@@ -183,7 +183,7 @@ String prettyBytes(size_t size) {
|
||||
return String(size / 1024.0 / 1024.0 / 1024.0) + "GB";
|
||||
}
|
||||
|
||||
String uint64ToString(uint64_t input, uint8_t base) {
|
||||
String uint64ToStringIoTM(uint64_t input, uint8_t base) {
|
||||
String result = "";
|
||||
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user