Added on/off MQTT command for anbling/disabling usermod.

This commit is contained in:
Blaz Kristan 2021-05-16 10:34:39 +02:00
parent 5ad0fdf39c
commit cc10ee0134
2 changed files with 9 additions and 2 deletions

View File

@ -350,6 +350,12 @@ class Animated_Staircase : public Usermod {
} else if (action == "down") {
topSensorWrite = true;
return true;
} else if (action == "on") {
enable(true);
return true;
} else if (action == "off") {
enable(false);
return true;
}
}
return false;
@ -499,10 +505,10 @@ class Animated_Staircase : public Usermod {
JsonArray usermodEnabled = staircase.createNestedArray(F("Staircase")); // name
String btn = F("<button class=\"btn infobtn\" onclick=\"requestJson({staircase:{enabled:");
if (enabled) {
btn += F("false}});loadInfo();\">");
btn += F("false}},false,false);loadInfo();\">");
btn += F("enabled");
} else {
btn += F("true}});loadInfo();\">");
btn += F("true}},false,false);loadInfo();\">");
btn += F("disabled");
}
btn += F("</button>");

View File

@ -119,6 +119,7 @@ curl -X POST -H "Content-Type: application/json" \
```
**MQTT**
You can publish a message with either `up` or `down` on topic `/swipe` to trigger animation.
You can also use `on` or `off` for enabling or disabling usermod.
Have fun with this usermod.<br/>
www.rolfje.com