Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Commit

Permalink
simplified return type of time functsion
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKuehnel committed Jan 14, 2018
1 parent ac72c46 commit c02949a
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions miflora/miflora_poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
MI_MOISTURE = "moisture"
MI_CONDUCTIVITY = "conductivity"
MI_BATTERY = "battery"
_MI_DEVICE_TIME = "device_time"
_MI_WALL_TIME = "wall_time"

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -239,8 +237,8 @@ def fetch_history(self):
raise
_LOGGER.info("Progress: %d of %d", i+1, history_length)

_time = self._fetch_device_time()
time_diff = _time[_MI_WALL_TIME] - _time[_MI_DEVICE_TIME]
(device_time, wall_time) = self._fetch_device_time()
time_diff = wall_time - device_time
for entry in data:
entry.compute_wall_time(time_diff)

Expand Down Expand Up @@ -273,10 +271,7 @@ def _fetch_device_time(self):
device_time = int.from_bytes(response, BYTEORDER)
_LOGGER.info('device time: %s local time: %s', device_time, wall_time)

return {
_MI_DEVICE_TIME: device_time,
_MI_WALL_TIME: wall_time
}
return device_time, wall_time


class HistoryEntry(object):
Expand Down

0 comments on commit c02949a

Please sign in to comment.