Settings can now be changed:

* Via HTTP POST request to /settings, providing key=<key_to_change> and value=<new_value>.
  * Via MQTT at <MQTT_TOPIC>/settings.<key>.
This commit is contained in:
2019-10-04 12:11:05 +02:00
parent 0f1d4abe04
commit ef57c5ea2e
2 changed files with 21 additions and 2 deletions

View File

@ -71,10 +71,15 @@ void mqtt_callback(char* original_topic, byte* pl, unsigned int length) {
tests::run();
return;
}
long value = payload.toInt();
LOGln("MQTT * Payload as number: %d", value);
if (topic.compareTo("brightness")==0) {
if (topic.startsWith("settings.")) {
topic.remove(0, 9);
change_setting(topic.c_str(), value);
return;
} else if (topic.compareTo("brightness")==0) {
if (value > 0 && value <= 255) {
LOGln("MQTT * Changing brightness...");
FastLED.setBrightness(value);