Skip to content
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
18 changes: 6 additions & 12 deletions SungrowClient/SungrowClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,9 @@ def scrape(self):
if self.inverter_config.get('use_local_time',False):
self.latest_scrape["timestamp"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
logging.debug(f'Using Local Computer Time: {self.latest_scrape.get("timestamp")}')
del self.latest_scrape["year"]
del self.latest_scrape["month"]
del self.latest_scrape["day"]
del self.latest_scrape["hour"]
del self.latest_scrape["minute"]
del self.latest_scrape["second"]
for key in ['year', 'month', 'day', 'hour', 'minute', 'second']:
if key in self.latest_scrape:
del self.latest_scrape[key]
else:
try:
self.latest_scrape["timestamp"] = "%s-%s-%s %s:%02d:%02d" % (
Expand All @@ -402,12 +399,9 @@ def scrape(self):
except Exception:
self.latest_scrape["timestamp"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
logging.warning(f'Failed to get Timestamp from Inverter, using Local Time: {self.latest_scrape.get("timestamp")}')
del self.latest_scrape["year"]
del self.latest_scrape["month"]
del self.latest_scrape["day"]
del self.latest_scrape["hour"]
del self.latest_scrape["minute"]
del self.latest_scrape["second"]
for key in ['year', 'month', 'day', 'hour', 'minute', 'second']:
if key in self.latest_scrape:
del self.latest_scrape[key]
pass

# If alarm state exists then convert to timestamp, otherwise remove it
Expand Down