Skip to content

Commit

Permalink
Cleanup. Added wifi and temp icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Yates authored and Jason Yates committed May 21, 2018
1 parent 12ffdf7 commit 4709e2a
Show file tree
Hide file tree
Showing 82 changed files with 6,706 additions and 500 deletions.
15 changes: 10 additions & 5 deletions genmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,20 @@
from genmonlib import mymail, mylog, mythread, mypipe, mysupport, generac_evolution, generac_HPanel, myplatform


GENMON_VERSION = "V1.8.8"
GENMON_VERSION = "V1.8.9"

#------------ Monitor class --------------------------------------------
class Monitor(mysupport.MySupport):

def __init__(self):
def __init__(self, ConfigFilePath = None):
super(Monitor, self).__init__()
self.ProgramName = "Generator Monitor"
self.Version = "Unknown"
if ConfigFilePath == None:
self.ConfigFilePath = "/etc/"
else:
self.ConfigFilePath = ConfigFilePath

self.ConnectionList = [] # list of incoming connections for heartbeat
# defautl values
self.SiteName = "Home"
Expand Down Expand Up @@ -141,7 +146,7 @@ def GetConfig(self, reload = False):
config = RawConfigParser()
# config parser reads from current directory, when running form a cron tab this is
# not defined so we specify the full path
config.read('/etc/genmon.conf')
config.read(self.ConfigFilePath + 'genmon.conf')

# getfloat() raises an exception if the value is not a float
# getint() and getboolean() also do this for their respective types
Expand Down Expand Up @@ -798,13 +803,13 @@ def signal_handler(signal, frame):

#------------------- Command-line interface for monitor -----------------#
if __name__=='__main__': #

ConfigFilePath = None if len(sys.argv)<2 else sys.argv[1]

# Set the signal handler
signal.signal(signal.SIGINT, signal_handler)

#Start things up
MyMonitor = Monitor()
MyMonitor = Monitor(ConfigFilePath = ConfigFilePath)

while True:
time.sleep(1)
8 changes: 6 additions & 2 deletions genmonlib/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@

class GeneratorController(mysupport.MySupport):
#---------------------GeneratorController::__init__-------------------------
def __init__(self, log, newinstall = False, simulation = False, simulationfile = None, message = None, feedback = None):
def __init__(self, log, newinstall = False, simulation = False, simulationfile = None, message = None, feedback = None, ConfigFilePath = None):
super(GeneratorController, self).__init__()
self.log = log
self.NewInstall = newinstall
self.Simulation = simulation
self.SimulationFile = simulationfile
self.FeedbackPipe = feedback
self.MessagePipe = message
if ConfigFilePath == None:
self.ConfigFilePath = "/etc/"
else:
self.ConfigFilePath = ConfigFilePath
self.Address = None
self.SerialPort = "/dev/serial0"
self.BaudRate = 9600
Expand Down Expand Up @@ -75,7 +79,7 @@ def __init__(self, log, newinstall = False, simulation = False, simulationfile =
config = RawConfigParser()
# config parser reads from current directory, when running form a cron tab this is
# not defined so we specify the full path
config.read('/etc/genmon.conf')
config.read(self.ConfigFilePath + 'genmon.conf')

# getfloat() raises an exception if the value is not a float
# getint() and getboolean() also do this for their respective types
Expand Down
6 changes: 3 additions & 3 deletions genmonlib/generac_HPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,10 @@ class Output8(object):
class HPanel(controller.GeneratorController):

#---------------------HPanel::__init__--------------------------------------
def __init__(self, log, newinstall = False, simulation = False, simulationfile = None, message = None, feedback = None):
def __init__(self, log, newinstall = False, simulation = False, simulationfile = None, message = None, feedback = None, ConfigFilePath = None):

# call parent constructor
super(HPanel, self).__init__(log, newinstall = newinstall, simulation = simulation, simulationfile = simulationfile, message = message, feedback = feedback)
super(HPanel, self).__init__(log, newinstall = newinstall, simulation = simulation, simulationfile = simulationfile, message = message, feedback = feedback, ConfigFilePath = ConfigFilePath)

self.LastEngineState = ""
self.CurrentAlarmState = False
Expand Down Expand Up @@ -484,7 +484,7 @@ def GetConfig(self):
config = RawConfigParser()
# config parser reads from current directory, when running form a cron tab this is
# not defined so we specify the full path
config.read('/etc/genmon.conf')
config.read(self.ConfigFilePath + 'genmon.conf')

if config.has_option(ConfigSection, 'address'):
self.Address = int(config.get(ConfigSection, 'address'),16) # modbus address
Expand Down
Loading

0 comments on commit 4709e2a

Please sign in to comment.