Added a TimeEffect to show a countdown to a time given via MQTT.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2019-12-21 14:21:31 +01:00
parent 994f4894dd
commit e2a56d7c29
8 changed files with 67 additions and 0 deletions

View File

@ -50,6 +50,10 @@ void mqtt_callback(char* original_topic, byte* pl, unsigned int length) {
LOGln("Set weather_temperatures[%d] to value %d", id, val);
}
return;
} else if (topic.equals(MQTT_TOPIC_TIMER)) {
timer = payload.toInt();
LOGln("Set timer to %lu.", timer);
return;
}
topic.remove(0, strlen(MQTT_TOPIC)); // Strip MQTT_TOPIC from the beginning
@ -102,6 +106,7 @@ boolean mqtt_connect() {
mqtt_client.publish(MQTT_TOPIC "status", buffer, true);
mqtt_client.subscribe(MQTT_TOPIC "+");
mqtt_client.subscribe(MQTT_TOPIC_WEATHER "#");
mqtt_client.subscribe(MQTT_TOPIC_TIMER);
}
return mqtt_client.connected();
}