Nodemcu esp8266 DHT11 temperature push message

Hello ,
I have the a nodemcu with a dht11 sensor, and is working well with sketch below.
It is possible to get a push notification from eventor? There is an option “send notification” but it say to add push widget to project. In PushNotification widget is only digitalRead option and i have virtual .

Can some1 help me with some advices?

> #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
> #include <SPI.h>
> #include <ESP8266WiFi.h>
> #include <BlynkSimpleEsp8266.h>
> #include <SimpleTimer.h>
> #include <DHT.h>

> // You should get Auth Token in the Blynk App.
> // Go to the Project Settings (nut icon).
> char auth[] = "xxxxxxxxxxx";

> // Your WiFi credentials.
> // Set password to "" for open networks.
> char ssid[] = "xxxx";
> char pass[] = "xxxxx";

> #define DHTPIN 2          // What digital pin we're connected to

> // Uncomment whatever type you're using!
> #define DHTTYPE DHT11     // DHT 11
> //#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
> //#define DHTTYPE DHT21   // DHT 21, AM2301

> DHT dht(DHTPIN, DHTTYPE);
> SimpleTimer timer;

> // This function sends Arduino's up time every second to Virtual Pin (5).
> // In the app, Widget's reading frequency should be set to PUSH. This means
> // that you define how often to send data to Blynk App.
> void sendSensor()
> {
>   float h = dht.readHumidity();
>   float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

>   if (isnan(h) || isnan(t)) {
>     Serial.println("Failed to read from DHT sensor!");
>     return;
>   }
>   // You can send any value at any time.
>   // Please don't send more that 10 values per second.
>   Blynk.virtualWrite(V5, h);
>   Blynk.virtualWrite(V6, t);
> }

> void setup()
> {
>   Serial.begin(9600); // See the connection status in Serial Monitor
>   Blynk.begin(auth, ssid, pass);

>  dht.begin();

>   // Setup a function to be called every second
>   timer.setInterval(1000L, sendSensor);
> }

> void loop()
> {
>   Blynk.run(); // Initiates Blynk
>   timer.run(); // Initiates SimpleTimer
> }

I don’t know what Eventor can do but you might be thinking about the wrong PushNotification. It is not the frequency set against a Value Display for example but a dedicated widget (certainly for Android).

It is called “Notification” and doesn’t have any digital or virtual aspect to it. The parameters you can set in the widget are:

OFF or ON to notify when hardware goes offline
Normal or High priority

I thin maybe this widget was previously called Push, hence your screenshot. Once you have this widget you can then add code for push messages.

1 Like

Hello Costas ,
Ty for answer im interested if is a solution for getting a message on my phone when the temp. is get up over a value.
I can do it, i think with the sketch from below and instead the button , to put relay . From eventor i can set a digital out (turn ON pin) and maybe works.
Simple push notification example
*
* App project setup:
* Push widget
*
* Connect a button to pin 2 and GND…
* Pressing this button will also push a message! :wink:
*
**************************************************************/

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

void notifyOnButtonPress()
{
  // Invert state, since button is "Active LOW"
  int isButtonPressed = !digitalRead(2);
  if (isButtonPressed) {
    Serial.println("Button is pressed.");

    Blynk.notify("Yaaay... button is pressed!");
  }
}

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth);

  while (Blynk.connect() == false) {
    // Wait until connected
  }

  // Setup notification button on pin 2
  pinMode(2, INPUT_PULLUP);
  // Attach pin 2 interrupt to our handler
  attachInterrupt(digitalPinToInterrupt(2), notifyOnButtonPress, CHANGE);
}

void loop()
{
  Blynk.run();
}

But i asked if it can be done from “send notification” option.

So far I have done very little with Eventor as much of my code was written before the widget became available and our parameters / variables are changes with sliders and menu etc.

I will try to check out push messages with Eventor during the day.

@Utza looks like each “Event” takes just one action but you can set up additional events for the same trigger.

Event 1: If temp >= x send LOW to turn OFF device
Event 2: If temp < x send HIGH to turn ON device
Event 3: If temp >= x send notification device is OFF
Event 4: If temp < x send notification device is ON

15s restriction on notifications doesn’t apply in Eventor.

Working ok here.

Thats great , you included push notification sketch (from widget) into your sketch ? Or you just added notification button and eventor from app like in pic.? To me still not work…

I just did what you have in your screenshot. PUSH messages are not available for iOS and sometimes they can be delayed for Android. Ensure you have priority set to HIGH, not NORMAL in the Notification widget.

It works !!! After i made a new project and reupload the sketch work.

https://www.youtube.com/watch?v=do32r_Qc5Mw

2 Likes