Skip to content

Commit

Permalink
Version 1.7.2 Final
Browse files Browse the repository at this point in the history
Further refactoring of code
  • Loading branch information
alaudet committed Jun 7, 2023
1 parent febfd73 commit c0a7b83
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Raspi-Sump Version 1.7.2rc1
Raspi-Sump Version 1.7.2
13 changes: 9 additions & 4 deletions bin/rsump.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@

config = configparser.RawConfigParser()
user = os.getlogin()
config.read('/home/' + user + '/raspi-sump/raspisump.conf')
reading_interval = config.getint('pit', 'reading_interval')
config.read("/home/" + user + "/raspi-sump/raspisump.conf")
reading_interval = config.getint("pit", "reading_interval")

if reading_interval == 0:
try:
reading.water_depth()
except RuntimeError:
print("ERROR -- Cannot Access gpio pins. Make sure user is part of the gpio group.")
log.log_event("error_log", "GPIO ERROR -- Cannot Access gpio pins. Make sure user is part of the gpio group.")
print(
"ERROR -- Cannot Access gpio pins. Make sure user is part of the gpio group."
)
log.log_event(
"error_log",
"GPIO ERROR -- Cannot Access gpio pins. Make sure user is part of the gpio group.",
)
else:
while True:
reading.water_depth()
Expand Down
7 changes: 3 additions & 4 deletions bin/rsumpchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@

user = os.getlogin()


def main():
"""Initiate todaychart.py module to graph sump pit activity."""
csv_file = "/home/" + user + "/raspi-sump/csv/waterlevel-{}.csv".format(
time.strftime("%Y%m%d")
)
filename = "/home/" + user + "/raspi-sump/charts/today.png"
csv_file = f"/home/{user}/raspi-sump/csv/waterlevel-{time.strftime('%Y%m%d')}.csv"
filename = f"/home/{user}/raspi-sump/charts/today.png"
todaychart.graph(csv_file, filename)


Expand Down
7 changes: 4 additions & 3 deletions bin/rsumpmonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@


def main():
'''run checkpid.py module to restart Raspi-Sump if the rsump.py process is
stopped or has spawned multiple processes.'''
process = '/usr/local/bin/rsump.py'
"""run checkpid.py module to restart Raspi-Sump if the rsump.py process is
stopped or has spawned multiple processes."""
process = "/usr/local/bin/rsump.py"
checkpid.check_pid(process)


if __name__ == "__main__":
main()
14 changes: 8 additions & 6 deletions bin/rsumpwebchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@

user = os.getlogin()


def main():
'''Pass variables to webchart.py'''
year = time.strftime('%Y')
month = time.strftime('%m')
today = time.strftime('%Y%m%d')
homedir = '/home/' + user + "/raspi-sump/"
"""Pass variables to webchart.py"""
year = time.strftime("%Y")
month = time.strftime("%m")
today = time.strftime("%Y%m%d")
homedir = "/home/" + user + "/raspi-sump/"
webchart.create_folders(year, month, homedir)
webchart.create_chart(homedir)
webchart.copy_chart(year, month, today, homedir)

if __name__ == '__main__':

if __name__ == "__main__":
main()
7 changes: 7 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
Raspi-Sump Changelog
====================
Version 1.7.2
Note: No new functionality in this release. Simply a refactoring of code and
a change to way code is tested. Optional Upgrade.
- Refactored code to use fstrings instead of .format for strings
- Migrated to Unittests from Nose
- Other refactoring for tests

Version 1.7.1
- Fixed bug in date autoformatters on todaychart.py. Should have proper date settings now (HH:MM:SS)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup
import os

version = "1.7.2rc1"
version = "1.7.2"
user = os.getlogin()

homedir = "/home/" + user + "/raspi-sump/"
Expand Down

0 comments on commit c0a7b83

Please sign in to comment.