- logging = cfg.get("logging","enabled")
- except:
- logging = None
- owmuser = cfg.get("openweathermap","user")
- owmpasswd = cfg.get("openweathermap",'passwd')
- if owmuser:
- owm_temp = cfg.get("openweathermap",'temp')
- owm_pres = cfg.get("openweathermap",'pres')
- owm_humi = cfg.get("openweathermap",'humi')
- owm_lat = cfg.get("openweathermap",'lat')
- owm_lon = cfg.get("openweathermap",'lon')
- owm_station = cfg.get("openweathermap",'station')
- reconnect()
+
+ cfg = ConfigParser.RawConfigParser(allow_no_value=True)
+ cfg.readfp(open('/etc/weathermon.conf'))
+ dbhost = cfg.get("mysql","host")
+ dbuser = cfg.get("mysql","user")
+ dbpasswd = cfg.get("mysql","passwd")
+ try:
+ path = cfg.get("serial","port");
+ except:
+ path = None
+ try:
+ serialnum = cfg.get("serial","id")
+ except:
+ serialnum = None
+ try:
+ logging = cfg.get("logging","enabled")
+ except:
+ logging = None
+ try:
+ timeout = int(cfg.get("serial","timeout"))
+ except:
+ timeout = 120
+ try:
+ baud = int(cfg.get("serial","baud"))
+ except:
+ baud = 57600
+ try:
+ narmon = cfg.get("narodmon","enable")
+ except:
+ narmon = 'off'
+ try:
+ devid = cfg.get("narodmon","devid")
+ except:
+ devid = "{:0>12X}".format(getnode())
+ try:
+ owmuser = cfg.get("openweathermap","user")
+ owmpasswd = cfg.get("openweathermap",'passwd')
+ except:
+ owmuser = None
+ if owmuser:
+ owm_temp = cfg.get("openweathermap",'temp')
+ owm_pres = cfg.get("openweathermap",'pres')
+ owm_humi = cfg.get("openweathermap",'humi')
+ owm_lat = cfg.get("openweathermap",'lat')
+ owm_lon = cfg.get("openweathermap",'lon')
+ owm_station = cfg.get("openweathermap",'station')
+ try:
+ alarm_script = cfg.get("alarm","exec")
+ import subprocess
+ except:
+ alarm_script = None
+
+ reconnect()