mirror of
https://github.com/esphome/esphome.git
synced 2026-08-24 15:16:20 +00:00
[web_server] Add assumed_state to cover JSON detail (#16800)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
co-authored by
Jesse Hills
parent
67e0058e72
commit
91cbcab25e
@@ -1115,6 +1115,7 @@ json::SerializationBuffer<> WebServer::cover_json_(cover::Cover *obj, JsonDetail
|
||||
if (obj->get_traits().get_supports_tilt())
|
||||
root[ESPHOME_F("tilt")] = obj->tilt;
|
||||
if (start_config == DETAIL_ALL) {
|
||||
root[ESPHOME_F("assumed_state")] = obj->get_traits().get_is_assumed_state();
|
||||
this->add_sorting_info_(root, obj);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,17 @@ wifi:
|
||||
|
||||
binary_sensor:
|
||||
cover:
|
||||
- platform: template
|
||||
name: "Template Cover Assumed"
|
||||
# assumed_state must be reflected in the web_server JSON (detail=all)
|
||||
assumed_state: true
|
||||
lambda: 'return COVER_OPEN;'
|
||||
open_action:
|
||||
- logger.log: open_action
|
||||
close_action:
|
||||
- logger.log: close_action
|
||||
stop_action:
|
||||
- logger.log: stop_action
|
||||
fan:
|
||||
light:
|
||||
sensor:
|
||||
|
||||
Reference in New Issue
Block a user