MyHomeThings
Published © GPL3+

Instant Pushsafer notification from ESP32

This sample code demonstrates the use of ESP32 and Pushsafer. You may need to be notified immediately of the status of the device.

BeginnerProtip1 hour2,217
Instant Pushsafer notification from ESP32

Things used in this project

Hardware components

ESP32 NodeMCU
×1
ESP 8266 NodeMCU-12E
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Esp32-Pushsafer-Example

Code

Esp32-Pushsafer-Example

Arduino
/**************************************/
//  https://myhomethings.eu           //
//  ESP32 Module                      //
//  Pushsafer Test                    //
/**************************************/

#include <WiFi.h>
#include <WiFiClient.h>
#include <Pushsafer.h>

#define PushsaferKey "Private Key"   // Private Key: http://pushsafer.com

char ssid[] = "Wifi_SSID";
char password[] = "SuperSecretWifiPassword";

WiFiClient client;
Pushsafer pushsafer(PushsaferKey, client);

void setup() 
{
  WiFi.mode(WIFI_STA);
  delay(100);
  WiFi.begin(ssid, password);
  
  while (WiFi.status() != WL_CONNECTED) 
  {
    delay(500);
  }
  // This can also go into the loop subject to some condition:
  struct PushSaferInput input;
  input.message = "Test message from ESP32";
  input.title = "Hi!";
  input.sound = "6";
  input.vibration = "1";
  input.icon = "1";
  input.iconcolor = "#00FF00";
  input.priority = "1";
  input.device = "xxxxx";      // Device ID:  http://pushsafer.com
  pushsafer.sendEvent(input);
}

void loop() 
{

}

Credits

MyHomeThings
11 projects • 8 followers

Comments