Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Fix #8 Not updating #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions custom_components/contact_energy/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,11 @@ def update(self):
"""Begin usage update."""
_LOGGER.debug("Beginning usage update")

# Check to see if our API Token is valid
if self._api._api_token:
_LOGGER.debug("We appear to be logged in (lets not verify it for now)")
else:
_LOGGER.info("Havent logged in yet, lets login now...")
if self._api.login() is False:
_LOGGER.error(
"Failed to get past login (usage will not be updated) - check the username and password are valid"
)
return False
if self._api.login() is False:
_LOGGER.error(
"Failed to get past login (usage will not be updated) - check the username and password are valid"
)
return False

# Get todays date
today = datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
Expand Down