Skip to content

Commit

Permalink
Convert GivEnergy timestamps to Localtime
Browse files Browse the repository at this point in the history
GivEnergy data uses UTC. Check for stale data was comparing UTC timestamp with local time (BST) and reporting an error. This change avoids the error reports for stale data.
  • Loading branch information
salewis38 authored Apr 1, 2024
1 parent 8e895e7 commit c125e6b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions palm_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,12 @@ def get_latest_data(self):
while i < 5:
self.sys_status[i] = self.sys_status[0]
i += 1

self.read_time_mins = t_to_mins(self.sys_status[0]['time'][11:])
# Check for BST and convert to local time
if time.strftime("%z", time.localtime()) == "+0100":
self.read_time_mins = (self.read_time_mins + 60) % 1440

self.line_voltage = float(self.sys_status[0]['grid']['voltage'])
self.grid_power = -1 * int(self.sys_status[0]['grid']['power']) # -ve = export
self.pv_power = int(self.sys_status[0]['solar']['power'])
Expand Down

0 comments on commit c125e6b

Please sign in to comment.