Merge branch 'master' into http-server

This commit is contained in:
iranl
2024-09-28 21:52:00 +02:00
committed by GitHub
2 changed files with 21 additions and 10 deletions

View File

@@ -930,7 +930,7 @@ void NukiNetwork::publishHASSConfig(char* deviceType, const char* baseTopic, cha
json["name"] = nullptr; json["name"] = nullptr;
json["unique_id"] = String(uidString) + "_lock"; json["unique_id"] = String(uidString) + "_lock";
json["cmd_t"] = String("~") + String(mqtt_topic_lock_action); json["cmd_t"] = String("~") + String(mqtt_topic_lock_action);
json["avty"]["t"] = availabilityTopic; json["avty"][0]["t"] = availabilityTopic;
json["pl_lock"] = lockAction; json["pl_lock"] = lockAction;
json["pl_unlk"] = unlockAction; json["pl_unlk"] = unlockAction;
@@ -939,7 +939,7 @@ void NukiNetwork::publishHASSConfig(char* deviceType, const char* baseTopic, cha
if((int)aclPrefs[2]) json["pl_open"] = openAction; if((int)aclPrefs[2]) json["pl_open"] = openAction;
json["stat_t"] = String("~") + mqtt_topic_lock_ha_state; json["stat_t"] = String("~") + mqtt_topic_lock_ha_state;
json["stat_jammed"] = "jammed"; json["stat_jam"] = "jammed";
json["stat_locked"] = "locked"; json["stat_locked"] = "locked";
json["stat_locking"] = "locking"; json["stat_locking"] = "locking";
json["stat_unlocked"] = "unlocked"; json["stat_unlocked"] = "unlocked";

View File

@@ -3190,9 +3190,15 @@ esp_err_t WebCfgServer::buildGpioConfigHtml(PsychicRequest *request)
{ {
String pinStr = String(pin); String pinStr = String(pin);
String pinDesc = "Gpio " + pinStr; String pinDesc = "Gpio " + pinStr;
printDropDown(&response, pinStr.c_str(), pinDesc.c_str(), "", options, "gpioselect"); printDropDown(pinStr.c_str(), pinDesc.c_str(), "", options, "gpioselect");
if(std::find(disabledPins.begin(), disabledPins.end(), pin) != disabledPins.end()) gpiopreselects.concat("gpio[" + pinStr + "] = '21';"); if(std::find(disabledPins.begin(), disabledPins.end(), pin) != disabledPins.end())
else gpiopreselects.concat("gpio[" + pinStr + "] = '" + getPreselectionForGpio(pin) + "';"); {
gpiopreselects.concat("gpio[" + pinStr + "] = '21';");
}
else
{
gpiopreselects.concat("gpio[" + pinStr + "] = '" + getPreselectionForGpio(pin) + "';");
}
} }
response.print("</table>"); response.print("</table>");
@@ -4094,11 +4100,16 @@ void WebCfgServer::printDropDown(PsychicStreamResponse *response, const char *to
response->print("<tr><td>"); response->print("<tr><td>");
response->print(description); response->print(description);
response->print("</td><td>"); response->print("</td><td>");
if(className.length() > 0)
if(className.length() > 0) response->print("<select class=\"" + className + "\" name=\""); {
else response->print("<select name=\""); _response.concat("<select class=\"" + className + "\" name=\"");
response->print(token); }
response->print("\">"); else
{
_response.concat("<select name=\"");
}
_response.concat(token);
_response.concat("\">");
for(const auto& option : options) for(const auto& option : options)
{ {