Change IP MQTT
This commit is contained in:
@@ -9,12 +9,11 @@
|
|||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[env:esp32dev]
|
[env:esp32dev]
|
||||||
platform = espressif32
|
platform = espressif32@6.11.0
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps =
|
lib_deps =
|
||||||
robtillaart/RunningMedian @ ^0.3.3
|
robtillaart/RunningMedian @ ^0.3.3
|
||||||
lewapek/Nova Fitness Sds dust sensors library @ ^1.5.1
|
lewapek/Nova Fitness Sds dust sensors library @ ^1.5.1
|
||||||
ottowinter/AsyncMqttClient-esphome @ ^0.8.6
|
ottowinter/AsyncMqttClient-esphome @ ^0.8.6
|
||||||
climateguard/ClimateGuard RadSens @ ^1.1.3
|
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|||||||
@@ -26,11 +26,6 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#include <AsyncMqttClient.h>
|
#include <AsyncMqttClient.h>
|
||||||
|
|
||||||
#include "CG_RadSens.h"
|
|
||||||
|
|
||||||
CG_RadSens radSens(RS_DEFAULT_I2C_ADDRESS); /*Constructor of the class ClimateGuard_RadSens1v2,
|
|
||||||
sets the address parameter of I2C sensor.
|
|
||||||
Default address: 0x66.*/
|
|
||||||
|
|
||||||
typedef struct message {
|
typedef struct message {
|
||||||
float temperature;
|
float temperature;
|
||||||
@@ -102,9 +97,6 @@ void setup() {
|
|||||||
WiFi.mode(WIFI_MODE_APSTA);
|
WiFi.mode(WIFI_MODE_APSTA);
|
||||||
connectToWifi();
|
connectToWifi();
|
||||||
|
|
||||||
radSens.init();
|
|
||||||
radSens.setSensitivity(105);
|
|
||||||
|
|
||||||
oldmov = 0;
|
oldmov = 0;
|
||||||
lamp = false;
|
lamp = false;
|
||||||
cRun = millis();
|
cRun = millis();
|
||||||
|
|||||||
@@ -22,4 +22,4 @@ lib_deps =
|
|||||||
ottowinter/ESPAsyncWebServer-esphome @ ^3.0.0
|
ottowinter/ESPAsyncWebServer-esphome @ ^3.0.0
|
||||||
lewapek/Nova Fitness Sds dust sensors library @ ^1.5.1
|
lewapek/Nova Fitness Sds dust sensors library @ ^1.5.1
|
||||||
ottowinter/AsyncMqttClient-esphome @ ^0.8.6
|
ottowinter/AsyncMqttClient-esphome @ ^0.8.6
|
||||||
https://github.com/climateguard/RadSens.git
|
jandelgado/JLed @ ^4.15.0
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include <ESPAsyncWebServer.h>
|
#include <ESPAsyncWebServer.h>
|
||||||
#include <WebSerial.h>
|
#include <WebSerial.h>
|
||||||
#include <ESP8266WiFiMulti.h>
|
#include <ESP8266WiFiMulti.h>
|
||||||
#include "CG_RadSens.h"
|
#include <jled.h>
|
||||||
|
|
||||||
#define WIFI_SSID "wf-home"
|
#define WIFI_SSID "wf-home"
|
||||||
#define WIFI_PASSWORD "0ndthnrf"
|
#define WIFI_PASSWORD "0ndthnrf"
|
||||||
@@ -63,12 +63,14 @@ unsigned long stled;
|
|||||||
ESP8266WiFiMulti wifiMulti;
|
ESP8266WiFiMulti wifiMulti;
|
||||||
AsyncWebServer server(80);
|
AsyncWebServer server(80);
|
||||||
|
|
||||||
CG_RadSens radSens(RS_DEFAULT_I2C_ADDRESS);
|
|
||||||
bool rsOk;
|
bool rsOk;
|
||||||
float dynval; // Переменная для динамического значения интенсивности
|
float dynval; // Переменная для динамического значения интенсивности
|
||||||
float statval; // Переменная для статического значения интенсивности
|
float statval; // Переменная для статического значения интенсивности
|
||||||
uint32_t impval; // Переменная для кол-ва импульсов
|
uint32_t impval; // Переменная для кол-ва импульсов
|
||||||
|
|
||||||
|
auto bLed = JLed(LED_MQ);
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
@@ -115,7 +117,7 @@ void setup()
|
|||||||
|
|
||||||
|
|
||||||
pinMode(LED_WF, OUTPUT);
|
pinMode(LED_WF, OUTPUT);
|
||||||
pinMode(LED_MQ, OUTPUT);
|
//pinMode(LED_MQ, OUTPUT);
|
||||||
pinMode(LED_WRK, OUTPUT);
|
pinMode(LED_WRK, OUTPUT);
|
||||||
pinMode(LAMP_OUT, OUTPUT);
|
pinMode(LAMP_OUT, OUTPUT);
|
||||||
//pinMode(3, FUNCTION_3);
|
//pinMode(3, FUNCTION_3);
|
||||||
@@ -124,7 +126,7 @@ void setup()
|
|||||||
pinMode(PIN_MOVE, INPUT);
|
pinMode(PIN_MOVE, INPUT);
|
||||||
|
|
||||||
digitalWrite(LED_WF, LOW);
|
digitalWrite(LED_WF, LOW);
|
||||||
digitalWrite(LED_MQ, HIGH);
|
//digitalWrite(LED_MQ, HIGH);
|
||||||
digitalWrite(LED_WRK, LOW);
|
digitalWrite(LED_WRK, LOW);
|
||||||
|
|
||||||
EEPROM.begin(20);
|
EEPROM.begin(20);
|
||||||
@@ -155,13 +157,13 @@ void setup()
|
|||||||
server.begin();
|
server.begin();
|
||||||
//Wire.begin();
|
//Wire.begin();
|
||||||
//rsOk = radSens.init();
|
//rsOk = radSens.init();
|
||||||
radSens.setSensitivity(105);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
char v[6];
|
char v[6];
|
||||||
ArduinoOTA.handle();
|
ArduinoOTA.handle();
|
||||||
|
bLed.Update();
|
||||||
static unsigned long cRunADC = millis();
|
static unsigned long cRunADC = millis();
|
||||||
|
|
||||||
if(digitalRead(PIN_MOVE) > 0){
|
if(digitalRead(PIN_MOVE) > 0){
|
||||||
@@ -312,7 +314,8 @@ void onMqttConnect(bool sessionPresent) {
|
|||||||
mqttClient.subscribe(TOPIC"lightlev", 1);
|
mqttClient.subscribe(TOPIC"lightlev", 1);
|
||||||
|
|
||||||
//analogWrite(LED_MQ, 1023);
|
//analogWrite(LED_MQ, 1023);
|
||||||
digitalWrite(LED_MQ, LOW);
|
bLed.Breathe(2000).DelayAfter(1000).Forever();
|
||||||
|
//digitalWrite(LED_MQ, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
||||||
@@ -322,7 +325,8 @@ void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
|
|||||||
mqttReconnectTimer.once(2, connectToMqtt);
|
mqttReconnectTimer.once(2, connectToMqtt);
|
||||||
}
|
}
|
||||||
//analogWrite(LED_MQ, 0);
|
//analogWrite(LED_MQ, 0);
|
||||||
digitalWrite(LED_MQ, HIGH);
|
bLed.Off();
|
||||||
|
//digitalWrite(LED_MQ, HIGH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onMqttSubscribe(uint16_t packetId, uint8_t qos) {
|
void onMqttSubscribe(uint16_t packetId, uint8_t qos) {
|
||||||
|
|||||||
Reference in New Issue
Block a user