LisovR
June 21, 2025, 4:42am
1
WLED version 0.15.0
I’m trying to create my own usermod, I have two questions:
Why doesn’t the button in Info work for me, it doesn’t switch the variable.
JsonArray infoArr = user.createNestedArray(FPSTR(_name));
String uiDomString = F("<button class=\"btn btn-xs\" onclick=\"requestJson({'");
uiDomString += FPSTR(_name);
uiDomString += F("':{'");
uiDomString += FPSTR(_tstBtn);
uiDomString += F("':");
uiDomString += tstBtn ? "false" : "true";
uiDomString += F("}});\"><i class=\"icons ");
uiDomString += tstBtn ? "on" : "off";
uiDomString += F("\"></i></button>");
infoArr.add(uiDomString);
I want to use the meaning of the POWER button. I read the entire wled.h file and did not find anything or did not understand which global variable corresponds to this button.
Help me figure it out!!!
for the button, look at
your json string seems wrong.
power button does various things, depending on settings. look at deep-sleep usermod where I used it.
LisovR
June 22, 2025, 12:08am
3
Thank you! I figured out the first question. I didn’t write anything in JsonState. This is the key point.
I’ll start studying the second question.
LisovR
June 22, 2025, 1:08am
4
Thank you very much! I found the variable “offMode” that I needed.
Now I think I can do what I have in mind.
LisovR
June 23, 2025, 7:03pm
5
Is it possible to add such a regulator to JsonInfo?
yes, see audoreactive usermod
LisovR
June 24, 2025, 9:41am
7
No, I used wemos d1 mini until today. Today I will buy ESP32 and will figure out audoreactive usermod.
LisovR
August 22, 2025, 7:13pm
9
Can you tell me if I can write IR Remote in JSON to change the variable in usermod?
LisovR
August 22, 2025, 10:58pm
10
figured it out
“cmd”: {Usermod:{variable:false}}
LisovR
August 23, 2025, 3:59pm
11
I can’t make the variable switch like {“on”:“t”}