Skip to content

Commit

Permalink
Added example of daily reads
Browse files Browse the repository at this point in the history
  • Loading branch information
Inaruslynx committed Jan 20, 2021
1 parent ab9a7a6 commit 6286461
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Basic Example.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,28 @@ def main():
pathlogin = "/log-in.json"
pathcert = "/code.cert"
pathkey = "/code.key"
# Never use today
startDate = datetime.datetime(2021, 1, 18)
endDate = datetime.datetime(2021, 1, 19)
# data = {}
with open(pathlogin) as f:
data = json.load(f)
# Note order of pathcert and pathkey and if not testing, leave off Test=True
example = SmtApi(data['user'], data['pass'],
(pathcert, pathkey), data['esiid'], Test=True)
# Methods will mostly work with just startDate and endDate, but it is possible to add more paramaters
powerData = example.min_interval_reads(startDate, endDate)
days = powerData.keys()
for day in days:
# days are a str and power usage will be a list of floats
dates = powerData.keys()
for day in dates:
print("day:", day)
print("power usage every 15 minutes:", powerData[day])
# Next example is of daily reads
dailyPowerData = example.daily_reads(startDate,endDate)
dailyDates = dailyPowerData.keys()
for day in dailyDates:
print('day:', day)
print('power used this day:', dailyPowerData[day])


if __name__ == "__main__":
Expand Down

0 comments on commit 6286461

Please sign in to comment.