mirror of
https://github.com/Dielee/volvo2mqtt.git
synced 2026-08-13 03:09:52 +02:00
Fix Backend State Sensor returning null
This commit is contained in:
+9
-2
@@ -328,9 +328,16 @@ def get_backend_status():
|
||||
response = session.get(API_BACKEND_STATUS, timeout=15)
|
||||
try:
|
||||
data = response.json()
|
||||
backend_status = data["message"] if util.keys_exists(data, "message") else "No warnings"
|
||||
if util.keys_exists(data, "message"):
|
||||
if data["message"]:
|
||||
backend_status = data["message"]
|
||||
else:
|
||||
backend_status = "NO_WARNING"
|
||||
else:
|
||||
backend_status = "NO_WARNING"
|
||||
|
||||
except JSONDecodeError as e:
|
||||
backend_status = "No warnings"
|
||||
backend_status = "NO_WARNING"
|
||||
return backend_status
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user