Skip to content

Commit

Permalink
Better error logging and bumnp pyeloverblik to version 0.1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasPed committed Jan 6, 2021
1 parent 5d76abc commit 5cee5c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions custom_components/eloverblik/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

from .const import DOMAIN

import requests

_LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -98,6 +100,14 @@ def update(self):
self._data = data
else:
_LOGGER.warn(f"Error from eloverblik: {data.status} - {data.detailed_status}")
except requests.exceptions.HTTPError as he:
message = None
if he.response.status_code == 401:
message = f"Unauthorized error while accessing eloverblik.dk. Wrong or expired refresh token?"
else:
message = f"Exception: {e}"

_LOGGER.warn(message)
except:
e = sys.exc_info()[0]
_LOGGER.warn(f"Exception: {e}")
Expand Down
2 changes: 1 addition & 1 deletion custom_components/eloverblik/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/eloverblik",
"requirements": [
"pyeloverblik==0.1.0"
"pyeloverblik==0.1.1"
],
"ssdp": [],
"zeroconf": [],
Expand Down

0 comments on commit 5cee5c3

Please sign in to comment.