Skip to content

Commit

Permalink
Black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
rianadon authored and ollo69 committed Feb 11, 2023
1 parent 140e774 commit ba1d3e9
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions custom_components/smartthinq_sensors/device_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,22 @@ def error_state(self):
@property
def start_time(self):
"""Return the time and date the wash began or will begin in ISO format."""
if self._api.state:
if self._api.state.is_on:
state = self._api.state
start = datetime.now() + timedelta(
hours=state.reservetime_hour - state.initialtime_hour + state.remaintime_hour,
minutes=state.reservetime_min - state.initialtime_min + state.remaintime_min
)
return start.isoformat()
return ""
if not (self._api.state and self._api.state.is_on):
return ""
state = self._api.state
hrs = state.reservetime_hour - state.initialtime_hour + state.remaintime_hour
mins = state.reservetime_min - state.initialtime_min + state.remaintime_min
return (datetime.now() + timedelta(hours=hrs, minutes=mins)).isoformat()

@property
def end_time(self):
"""Return the time and date the wash will end in ISO format."""
if self._api.state:
if self._api.state.is_on:
state = self._api.state
start = datetime.now() + timedelta(
hours=state.reservetime_hour + state.remaintime_hour,
minutes=state.reservetime_min + state.remaintime_min
)
return start.isoformat()
return ""
if not (self._api.state and self._api.state.is_on):
return ""
state = self._api.state
hrs = state.reservetime_hour + state.remaintime_hour
mins = state.reservetime_min + state.remaintime_min
return (datetime.now() + timedelta(hours=hrs, minutes=mins)).isoformat()

@property
def initial_time(self):
Expand Down

0 comments on commit ba1d3e9

Please sign in to comment.