partial msd events

This commit is contained in:
Maxim Devaev
2024-11-02 10:39:15 +02:00
parent 936cc21c40
commit deba110cdf
6 changed files with 317 additions and 247 deletions

View File

@@ -63,7 +63,11 @@ class MsdApi:
@exposed_http("GET", "/msd")
async def __state_handler(self, _: Request) -> Response:
return make_json_response(await self.__msd.get_state())
state = await self.__msd.get_state()
if state["storage"] and state["storage"]["parts"]:
state["storage"]["size"] = state["storage"]["parts"][""]["size"] # Legacy API
state["storage"]["free"] = state["storage"]["parts"][""]["free"] # Legacy API
return make_json_response(state)
@exposed_http("POST", "/msd/set_params")
async def __set_params_handler(self, req: Request) -> Response: