Hi,
As for now i have this assembled, it's quite coarse, but it gets the job done (at least the RemoteXY part)
#include <Pushsafer.h>
#define REMOTEXY_MODE__ESP8266WIFI_LIB_CLOUD
#include <ESP8266WiFi.h>
#include <ArduinoJson.h>
#include <RemoteXY.h>
#include <WiFiClient.h>
#include <Pushsafer.h>
#define PushsaferKey "The Key"
char ssid [] = "My SSID";
char password [] = "My pass";
WiFiClient client;
Pushsafer pushsafer(PushsaferKey, client);
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "My SSID"
#define REMOTEXY_WIFI_PASSWORD "My pass"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "My Token"
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,3,0,0,0,52,0,10,177,1,
130,2,1,1,61,98,26,2,0,8,
20,22,11,2,26,31,31,79,78,0,
79,70,70,0,2,0,34,20,22,11,
2,26,31,31,79,78,0,79,70,70,
0,3,131,6,38,51,19,2,26 };
// this structure defines all the variables and events of your control interface
struct {
// input variables
uint8_t switch_1; // =1 if switch ON and =0 if OFF
uint8_t switch_2; // =1 if switch ON and =0 if OFF
uint8_t select_1; // =0 if select position A, =1 if position B, =2 if position C, ...
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#define PIN_SWITCH_1 D6
#define PIN_SWITCH_2 D7
void setup()
{
RemoteXY_Init ();
pinMode (PIN_SWITCH_1, OUTPUT);
pinMode (PIN_SWITCH_2, OUTPUT);
pushsafer.debug = true;
// Take a look at the Pushsafer.com API at
// https://www.pushsafer.com/en/pushapi
struct PushSaferInput input;
input.message = "Water overflow";
input.title = "Warning";
input.sound = "8";
input.vibration = "2";
input.icon = "2";
input.iconcolor = "#FFCCCC";
input.priority = "1";
input.device = "28458";
input.url = "https://www.pushsafer.com";
input.urlTitle = "Open Pushsafer.com";
input.picture = "";
input.picture2 = "";
input.picture3 = "";
input.time2live = "";
input.retry = "";
input.expire = "";
input.answer = "";
Serial.println(pushsafer.sendEvent(input));
Serial.println("Sent");
}
void loop()
{
RemoteXY_Handler ();
digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1==0)?LOW:HIGH);
digitalWrite(PIN_SWITCH_2, (RemoteXY.switch_2==0)?LOW:HIGH);
if (digitalRead(D7) == HIGH) // if pin 7 enjoyed a high level voltage
RemoteXY.select_1 = 0;
else // else
RemoteXY.select_1 = 2;
if (digitalRead(D6) == HIGH) // if pin 6 enjoyed a high level voltage
RemoteXY.select_1 = 1;
else // else
RemoteXY.select_1 = 2;
}
Sorry if there's something really faulty or obviously wrong in the code, feels like being a Car guy messing with a Plane
Edit: I'm working with a WeMos D1 Mini based on ESP8266