Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setup for tank_utility component #29902

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 5 additions & 7 deletions homeassistant/components/tank_utility/sensor.py
Expand Up @@ -4,7 +4,7 @@
import logging

import requests
import tank_utility
from tank_utility import auth, device as tank_monitor
import voluptuous as vol

from homeassistant.components.sensor import PLATFORM_SCHEMA
Expand Down Expand Up @@ -47,7 +47,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
devices = config.get(CONF_DEVICES)

try:
token = tank_utility.auth.get_token(email, password)
token = auth.get_token(email, password)
except requests.exceptions.HTTPError as http_error:
if (
http_error.response.status_code
Expand Down Expand Up @@ -111,7 +111,7 @@ def get_data(self):

data = {}
try:
data = tank_utility.device.get_device_data(self._token, self.device)
data = tank_monitor.get_device_data(self._token, self.device)
except requests.exceptions.HTTPError as http_error:
if (
http_error.response.status_code
Expand All @@ -120,10 +120,8 @@ def get_data(self):
== requests.codes.bad_request # pylint: disable=no-member
):
_LOGGER.info("Getting new token")
self._token = tank_utility.auth.get_token(
self._email, self._password, force=True
)
data = tank_utility.device.get_device_data(self._token, self.device)
self._token = auth.get_token(self._email, self._password, force=True)
data = tank_monitor.get_device_data(self._token, self.device)
else:
raise http_error
data.update(data.pop("device", {}))
Expand Down