Skip to content

Commit

Permalink
Merge pull request #141 from jertel/jertel/p312
Browse files Browse the repository at this point in the history
upgrade to Python 3.12 and remove deprecated utcnow()
  • Loading branch information
jertel authored Dec 29, 2023
2 parents d733319 + ea9f9f0 commit f1bd374
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@
## Other changes
- TBD

# 1.6.1

## Breaking changes

- None

## New features

- None

## Other changes

- Upgrade to Python 3.12.1, replace deprecated datetime invocations - [#141](https://github.com/jertel/vuegraf/pull/141) - #jertel
- Fixed extractDataPoints to recurse correctly for nested devices - [#140](https://github.com/jertel/vuegraf/pull/140) - #cdolghier

# 1.6.0

## Breaking changes
Expand Down
6 changes: 3 additions & 3 deletions src/vuegraf/vuegraf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# flush=True helps when running in a container without a tty attached
# (alternatively, "python -u" or PYTHONUNBUFFERED will help here)
def log(level, msg):
now = datetime.datetime.utcnow()
now = datetime.datetime.now(datetime.UTC)
print('{} | {} | {}'.format(now, level.ljust(5), msg), flush=True)

def info(msg):
Expand Down Expand Up @@ -191,7 +191,7 @@ def extractDataPoints(device, usageDataPoints, pointType=None, historyStartTime=
usageDataPoints.append(createDataPoint(account, chanName, watts, timestamp, 'Day'))
index += 1

startupTime = datetime.datetime.utcnow()
startupTime = datetime.datetime.now(datetime.UTC)
try:
#argparse includes default -h / --help as command line input
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -306,7 +306,7 @@ def extractDataPoints(device, usageDataPoints, pointType=None, historyStartTime=
pastDay = pastDay.replace(hour=23, minute=59, second=59, microsecond=0)

while running:
now = datetime.datetime.utcnow()
now = datetime.datetime.now(datetime.UTC)
curDay = datetime.datetime.now()
stopTime = now - datetime.timedelta(seconds=lagSecs)
collectDetails = detailedDataEnabled and detailedIntervalSecs > 0 and (stopTime - detailedStartTime).total_seconds() >= detailedIntervalSecs
Expand Down

0 comments on commit f1bd374

Please sign in to comment.