mirror of
https://github.com/esphome/esphome.git
synced 2025-04-24 01:20:48 +02:00
Fix assumed_state switch webserver (#4259)
This commit is contained in:
parent
59d6b3afa0
commit
568e65a6ab
1 changed files with 3 additions and 0 deletions
|
@ -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) {
|
||||
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);
|
||||
if (start_config == DETAIL_ALL) {
|
||||
root["assumed_state"] = obj->assumed_state();
|
||||
}
|
||||
});
|
||||
}
|
||||
void WebServer::handle_switch_request(AsyncWebServerRequest *request, const UrlMatch &match) {
|
||||
|
|
Loading…
Add table
Reference in a new issue