import
This commit is contained in:
parent
69ce43d408
commit
5e861b10ef
44
arduino/sonoffliving/sonoffliving.example.h
Normal file
44
arduino/sonoffliving/sonoffliving.example.h
Normal file
@ -0,0 +1,44 @@
|
||||
#define BUTTON 0 // (Don't Change for Original Sonoff, Sonoff SV, Sonoff Touch, Sonoff S20 Socket)
|
||||
#define RELAY 12 // (Don't Change for Original Sonoff, Sonoff SV, Sonoff Touch, Sonoff S20 Socket)
|
||||
#define LED 13 // (Don't Change for Original Sonoff, Sonoff SV, Sonoff Touch, Sonoff S20 Socket)
|
||||
|
||||
#define MQTT_CLIENT "sonoff_living" // mqtt client_id (Must be unique for each Sonoff)
|
||||
#define MQTT_SERVER "XXX" // mqtt server
|
||||
#define MQTT_PORT 1883 // mqtt port
|
||||
#define MQTT_TOPIC "sonoff/living" // mqtt topic (Must be unique for each Sonoff)
|
||||
#define MQTT_USER "XXX" // mqtt user
|
||||
#define MQTT_PASS "XXX" // mqtt password
|
||||
|
||||
#define WIFI_SSID "XXX" // wifi ssid
|
||||
#define WIFI_PASS "XXX" // wifi password
|
||||
|
||||
#define VERSION "\n\n---------------- Sonoff Powerpoint v1.01pOTA -----------------"
|
||||
|
||||
bool rememberRelayState = true; // If 'true' remembers the state of the relay before power loss.
|
||||
bool OTAupdate = false; // (Do not Change)
|
||||
bool sendStatus = false; // (Do not Change)
|
||||
bool requestRestart = false; // (Do not Change)
|
||||
|
||||
int kUpdFreq = 1; // Update frequency in Mintes to check for mqtt connection
|
||||
int kRetries = 10; // WiFi retry count. Increase if not connecting to router.
|
||||
int lastRelayState; // (Do not Change)
|
||||
|
||||
unsigned long TTasks; // (Do not Change)
|
||||
unsigned long count = 0; // (Do not Change)
|
||||
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
|
||||
WiFiClient wifiClient;
|
||||
PubSubClient mqttClient(wifiClient, MQTT_SERVER, MQTT_PORT);
|
||||
Ticker btn_timer;
|
||||
|
||||
void callback(const MQTT::Publish& pub);
|
||||
void setup();
|
||||
void loop();
|
||||
void blinkLED(int pin, int duration, int n);
|
||||
void button();
|
||||
void checkConnection();
|
||||
void checkStatus();
|
||||
void timedTasks();
|
||||
Loading…
x
Reference in New Issue
Block a user