~robert-penz-name/heatpumpmonitor/trunk

« back to all changes in this revision

Viewing changes to heatpumpMonitor.py

  • Committer: Robert Penz
  • Date: 2010-04-26 12:20:20 UTC
  • Revision ID: robert@penz.name-20100426122020-oaxyz5cc4bb1ew3d
Bugfixes to user feedback by alphaomega

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
            except Exception, e:
89
89
                # log the error and just try it again in 120 sec - sometimes the heatpump returns an error and works
90
90
                # seconds later again
 
91
                # If the query takes longer than 2 minutes, we get a negative value ... maybe a problem in rare contitions
91
92
                logError(e)
92
93
                t.gotQueryError()
93
94
                time.sleep(120 - (time.time() - startTime))
114
115
            t.check(values)
115
116
            
116
117
            # lets make sure it is aways 60 secs interval, no matter how long the last run took
117
 
            time.sleep(61 - (time.time() - startTime))
 
118
            sleepTime = 61 - (time.time() - startTime)
 
119
            if sleepTime < 0:
 
120
                print "System is too slow for 60 sec interval by %d seconds" % abs(int(sleepTime))
 
121
            else:
 
122
                time.sleep(sleepTime)
118
123
    except Exception, e:
119
124
        # make sure the error got logged
120
125
        logError(e)
123
128
def main():
124
129
    global config
125
130
    config = config_manager.ConfigManager()
126
 
    deamon.startstop(config.getLogFile(), config.getPidFile())
 
131
    deamon.startstop(config.getLogFile(), pidfile=config.getPidFile())
127
132
    doMonitor()
128
133
    
129
134
if __name__ == '__main__':