Help creating usermod

WLED version 0.15.0
I’m trying to create my own usermod, I have two questions:

  1. 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("\">&#xe08f;</i></button>");
      infoArr.add(uiDomString);
  1. 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.

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.

Thank you very much! I found the variable “offMode” that I needed.
Now I think I can do what I have in mind.

Is it possible to add such a regulator to JsonInfo?
1

yes, see audoreactive usermod