web_server: Add a position property for cover entities that have the supports position trait (#6269)

This commit is contained in:
Daniel Baulig 2024-02-21 17:33:28 -08:00 committed by Jesse Hills
parent 62d59cffcc
commit db5205931b
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A

View file

@ -785,6 +785,8 @@ std::string WebServer::cover_json(cover::Cover *obj, JsonDetail start_config) {
obj->position, start_config);
root["current_operation"] = cover::cover_operation_to_str(obj->current_operation);
if (obj->get_traits().get_supports_position())
root["position"] = obj->position;
if (obj->get_traits().get_supports_tilt())
root["tilt"] = obj->tilt;
});