From acab1aa0582afe6369976f78b177332b696b22f0 Mon Sep 17 00:00:00 2001 From: Nis Wechselberg Date: Sun, 20 May 2018 14:29:01 +0200 Subject: [PATCH] MQTT-DS5: Added dedicated power control topic --- ESP8266-MQTT-Teufel-DS5/ESP8266-MQTT-Teufel-DS5.ino | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ESP8266-MQTT-Teufel-DS5/ESP8266-MQTT-Teufel-DS5.ino b/ESP8266-MQTT-Teufel-DS5/ESP8266-MQTT-Teufel-DS5.ino index 8a6cfe9..544a220 100644 --- a/ESP8266-MQTT-Teufel-DS5/ESP8266-MQTT-Teufel-DS5.ino +++ b/ESP8266-MQTT-Teufel-DS5/ESP8266-MQTT-Teufel-DS5.ino @@ -211,6 +211,10 @@ void incoming_mqtt(char* topic, byte* payload, unsigned int length) { } } + if (strcmp(topic, mqtt_topic_power) == 0) { + code = codes[0]; + } + free(msgCopy); // Check if we found a code to send @@ -236,6 +240,7 @@ void reconnect() { // subscribe to incoming topics client.subscribe(mqtt_topic_command); client.subscribe(mqtt_topic_volume); + client.subscribe(mqtt_topic_power); if (DEBUGTOSERIAL) { Serial.println("Subscriptions done"); }