Good day
I am still learning and discovering everyday, but I have come across something that I have not been able to get working.
In short, I want to get an alarm from a freezer should the setpoint for the the alarm (set in Blynk IoT) is reached, fridge stops working for instance.
But I want to use a button in App to disable the notification from time to time when the freezer is not in use.
Also I am using DS18B20 probe witch ESP32 reads a value of -127 when probe is disconnected or failed. I want to get an alarm on probe malfunction also to be disabled by the same button in app if needed.
It has taken many hours, many examples and different approaches but not working…
What am I missing here???
• ESP32 DevKit V1 + Wifi
•Android
• Blynk server region South Africa
• Blynk Library version 1.3.2
#define BLYNK_TEMPLATE_ID "*******"
#define BLYNK_TEMPLATE_NAME "********"
#define BLYNK_FIRMWARE_VERSION "0.1.0"
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
#define APP_DEBUG
#include "BlynkEdgent.h"
BlynkTimer timer;
#include "OneWire.h"
#include "DallasTemperature.h"
#define ONE_WIRE_BUS 14
OneWire oneWire (ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float temp;
float alarm_setpoint;
bool logEventEnabled = false;
void probe_1()
{
sensors.requestTemperatures();
temp = sensors.getTempCByIndex(0);
Serial.println(temp);
delay(50);
Blynk.virtualWrite(V11, temp);
if (temp == DEVICE_DISCONNECTED_C)
{
if(logEventEnabled)
{
Blynk.logEvent("probe");
Serial.print("Probe failed");
}
return;
}
}
void setup()
{
Serial.begin(115200);
delay(100);
BlynkEdgent.begin();
pinMode(14, INPUT);
sensors.begin();
timer.setInterval(5000L, probe_1);
}
void loop() {
BlynkEdgent.run();
timer.run();
}
BLYNK_WRITE(V21) //Alarm Setpoint from app
{
int alarm_setpoint = param.asFloat();
}
BLYNK_WRITE(V41) //Used to Enable or Disable sending of LogEvents
{
int logEventEnabled = param.asInt();
}