utilisation d'un id specifique + simplification

This commit is contained in:
Julien Cabillot 2017-06-02 16:00:06 +02:00 committed by Cabillot Julien
parent ccde131cc1
commit 10a85057c7
2 changed files with 9 additions and 8 deletions

View File

@ -114,7 +114,7 @@ void testConnectMQTT()
{ {
while (!client.connected()) { while (!client.connected()) {
Debug.print("Connexion au serveur MQTT... "); Debug.print("Connexion au serveur MQTT... ");
if (client.connect("ESP8266Client", MQTT_USER, MQTT_PASS)) { if (client.connect(MQTT_CLIENT, MQTT_USER, MQTT_PASS)) {
Debug.print("OK\nSend Current State"); Debug.print("OK\nSend Current State");
mqttSendState(); mqttSendState();

View File

@ -2,10 +2,11 @@
// OTA // OTA
#define OTA_PASSWORD "XXX" #define OTA_PASSWORD "XXX"
// Ce nom est réutillisé par la suite pour le RemoteDebug + MQTT
#define OTA_CLIENT "sonoff_living" #define OTA_CLIENT "sonoff_living"
// DebugRemote // DebugRemote
#define REMDEB_CLIENT "sonoff_living" #define REMDEB_CLIENT OTA_CLIENT
RemoteDebug Debug; RemoteDebug Debug;
// WIFI // WIFI
@ -14,9 +15,9 @@ RemoteDebug Debug;
WiFiClient espClient; WiFiClient espClient;
#define BUTTON 0 #define BUTTON_PIN 0
#define RELAY 12 #define RELAY_PIN 12
#define LED 13 #define LED_PIN 13
// MQTT // MQTT
#define MQTT_SERVER "XXX" #define MQTT_SERVER "XXX"
@ -24,9 +25,9 @@ WiFiClient espClient;
#define MQTT_USER "XXX" #define MQTT_USER "XXX"
#define MQTT_PASS "XXX" #define MQTT_PASS "XXX"
#define MQTT_CLIENT "sonoff_living" #define MQTT_CLIENT OTA_CLIENT
#define MQTT_COMMAND "sonoff_living/switch" #define MQTT_COMMAND MQTT_CLIENT"/switch"
#define MQTT_STATE "sonoff_living/status" #define MQTT_STATE MQTT_CLIENT"/status"
char message_buff[100]; char message_buff[100];
PubSubClient client(espClient); PubSubClient client(espClient);