Skip to content

Commit

Permalink
Fix Backend State Sensor returning null
Browse files Browse the repository at this point in the history
  • Loading branch information
Dielee committed Nov 21, 2023
1 parent 126cc37 commit 2e95e71
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v1.8.18
### 🐛 Bug Fixes:

- Fix Backend State Sensor returning `null`

## v1.8.17
### 🚀 Features:

Expand Down
2 changes: 1 addition & 1 deletion src/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "Volvo2Mqtt"
description: "Volvo AAOS MQTT bridge"
version: "1.8.17"
version: "1.8.18"
slug: "volvo2mqtt"
init: false
url: "https://github.com/Dielee/volvo2mqtt"
Expand Down
2 changes: 1 addition & 1 deletion src/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from config import settings

VERSION = "v1.8.17"
VERSION = "v1.8.18"

OAUTH_URL = "https://volvoid.eu.volvocars.com/as/token.oauth2"
VEHICLES_URL = "https://api.volvocars.com/connected-vehicle/v2/vehicles"
Expand Down
11 changes: 9 additions & 2 deletions src/volvo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit 2e95e71

Please sign in to comment.