From 25f9800f775e1c908ab0f5cda26b881c57639ce2 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Sun, 10 Oct 2021 17:58:43 -0400 Subject: [PATCH] moonraker: don't send status updates for empty objects Signed-off-by: Eric Callahan --- moonraker/moonraker.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/moonraker/moonraker.py b/moonraker/moonraker.py index 9604169..44c62f5 100755 --- a/moonraker/moonraker.py +++ b/moonraker/moonraker.py @@ -463,12 +463,11 @@ class Server: conn_status: Dict[str, Any] = {} for name, fields in sub.items(): if name in status: - val: Dict[str, Any] = status[name] - if fields is None: - conn_status[name] = dict(val) - else: - conn_status[name] = { - k: v for k, v in val.items() if k in fields} + val: Dict[str, Any] = dict(status[name]) + if fields is not None: + val = {k: v for k, v in val.items() if k in fields} + if val: + conn_status[name] = val conn.send_status(conn_status, eventtime) async def make_request(self, web_request: WebRequest) -> Any: