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:
@ -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);
|
||||
|
Reference in New Issue
Block a user