mirror of
https://github.com/esphome/esphome.git
synced 2025-02-07 13:40:59 +00:00
Fix assumed_state switch webserver (#4259)
This commit is contained in:
parent
59d6b3afa0
commit
568e65a6ab
@ -428,6 +428,9 @@ void WebServer::on_switch_update(switch_::Switch *obj, bool state) {
|
|||||||
std::string WebServer::switch_json(switch_::Switch *obj, bool value, JsonDetail start_config) {
|
std::string WebServer::switch_json(switch_::Switch *obj, bool value, JsonDetail start_config) {
|
||||||
return json::build_json([obj, value, start_config](JsonObject root) {
|
return json::build_json([obj, value, start_config](JsonObject root) {
|
||||||
set_json_icon_state_value(root, obj, "switch-" + obj->get_object_id(), value ? "ON" : "OFF", value, start_config);
|
set_json_icon_state_value(root, obj, "switch-" + obj->get_object_id(), value ? "ON" : "OFF", value, start_config);
|
||||||
|
if (start_config == DETAIL_ALL) {
|
||||||
|
root["assumed_state"] = obj->assumed_state();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
void WebServer::handle_switch_request(AsyncWebServerRequest *request, const UrlMatch &match) {
|
void WebServer::handle_switch_request(AsyncWebServerRequest *request, const UrlMatch &match) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user