def main(): global arguments error=None configfile="./etc/config/ht_proxy_cfg.xml" try: client= ht_proxy_if.cht_socket_client(configfile, devicetype=ht_proxy_if.DT_MODEM) except: print("couldn't connect to server") raise trx=ht_transceiver.ctransceiver(client) cfg=ht_yanetcom.cyanetcom(client) if arguments['temp'] != 10.0: error=cfg.set_tempniveau(arguments['temp']) if error != None: print("{0}".format(error)) if arguments['bart'] != 'none': error=cfg.set_betriebsart(arguments['bart']) if error != None: print("{0}".format(error)) if arguments['cfg'] != 10: error=trx.cfg_mode(arguments['cfg']) if error != None: print("{0}".format(error)) if arguments['adr'] != 0: error=trx.cfg_deviceaddress(arguments['adr']) if error != None: print("{0}".format(error)) if arguments['rst'] != 0: error=trx.reset() if error != None: print("{0}".format(error))
if len(sys.argv) > 1: if '/' in str(sys.argv[1]): binfile = str(sys.argv[1]) else: binfile = os.path.join("./var/log", str(sys.argv[1])) try: print(" -- start binaer data logging to file: {0} --".format(binfile)) fobj = open(binfile, "wb") except: print("couldn't open file:{0}".format(binfile)) raise try: client = ht_proxy_if.cht_socket_client(configfile, devicetype=ht_proxy_if.DT_MODEM) except: print( "couldn't open proxy-client;check config-file:{0}".format(configfile)) raise loop = True while loop: try: fobj.write(client.read()) except (KeyboardInterrupt): loop = False except IOError: loop = False print("couldn't write to file:{0}".format(binfile)) raise
if len(sys.argv) > 1: if '/' in str(sys.argv[1]): binfile=str(sys.argv[1]) else: binfile=os.path.join("./var/log", str(sys.argv[1])) try: print(" -- start binaer data logging to file: {0} --".format(binfile)) fobj=open(binfile,"wb") except: print("couldn't open file:{0}".format(binfile)) raise try: client=ht_proxy_if.cht_socket_client(configfile, devicetype=ht_proxy_if.DT_MODEM) except: print("couldn't open proxy-client;check config-file:{0}".format(configfile)) raise loop=True while loop: try: fobj.write(client.read()) except (KeyboardInterrupt): loop=False except IOError: loop=False print("couldn't write to file:{0}".format(binfile)) raise
def main(configfile, ems_bus): global arguments error = None heater_circuit = 1 temp_mode = ht_const.HT_TEMPNIVEAU_NORMAL try: client= ht_proxy_if.cht_socket_client(configfile, devicetype = ht_proxy_if.DT_MODEM) except: print("couldn't connect to server") raise trx = ht_transceiver.ctransceiver(client) cfg = ht_yanetcom.cyanetcom(client, ems_bus) if ems_bus == False: if arguments['hcircuit'] != 1: heater_circuit = arguments['hcircuit'] if arguments['tempmod'] != ht_const.HT_TEMPNIVEAU_DUMMY: temp_mode = arguments['tempmod'] else: temp_mode = ht_const.HT_TEMPNIVEAU_NORMAL if arguments['temp'] != 4.0: error = cfg.set_tempniveau(arguments['temp'], hcircuit_nr = heater_circuit, temperatur_mode = temp_mode) if error != None: print("{0}".format(error)) if arguments['bart'] != 'none': error = cfg.set_betriebsart(arguments['bart']) if error != None: print("{0}".format(error)) else: if arguments['temp'] != 4.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (temporary) error = cfg.set_tempniveau(arguments['temp'], temperatur_mode = ht_const.EMS_TEMP_MODE_TEMPORARY) if error != None: print("{0}".format(error)) if arguments['tempc1'] != 11.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (comfort1) error=cfg.set_tempniveau(arguments['tempc1'], temperatur_mode = ht_const.EMS_TEMP_MODE_COMFORT1) if error != None: print("{0}".format(error)) if arguments['tempc2'] != 12.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (comfort2) error=cfg.set_tempniveau(arguments['tempc2'], temperatur_mode = ht_const.EMS_TEMP_MODE_COMFORT2) if error != None: print("{0}".format(error)) if arguments['tempc3'] != 13.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (comfort3) error=cfg.set_tempniveau(arguments['tempc3'], temperatur_mode = ht_const.EMS_TEMP_MODE_COMFORT3) if error != None: print("{0}".format(error)) if arguments['tempeco'] != 14.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (eco) error=cfg.set_tempniveau(arguments['tempeco'], temperatur_mode = ht_const.EMS_TEMP_MODE_ECO) if error != None: print("{0}".format(error)) if arguments['tempman'] != 15.0: # first setup to manual-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_MANUAL) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (manual) error=cfg.set_tempniveau(arguments['tempman'], temperatur_mode = ht_const.EMS_TEMP_MODE_MANUAL) if error != None: print("{0}".format(error)) if arguments['ecomode'] != -1: error=cfg.set_ecomode(arguments['ecomode']) if error != None: print("{0}".format(error)) if arguments['bart'] != 'none': if str(arguments['bart']).lower() in ('manual','man','m'): omode = ht_const.EMS_OMODE_MANUAL else: omode = ht_const.EMS_OMODE_AUTO error=cfg.set_operation_mode(omode) if error != None: print("{0}".format(error)) if arguments['adr'] != 0: error=trx.cfg_deviceaddress(arguments['adr']) if error != None: print("{0}".format(error)) if arguments['rst'] != 0: error=trx.reset() if error != None: print("{0}".format(error))
def main(configfile, ems_bus): global arguments error = None heater_circuit = 1 temp_mode = ht_const.HT_TEMPNIVEAU_NORMAL try: client = ht_proxy_if.cht_socket_client(configfile, devicetype=ht_proxy_if.DT_MODEM) except: print("couldn't connect to server") raise trx = ht_transceiver.ctransceiver(client) cfg = ht_yanetcom.cyanetcom(client, ems_bus) if ems_bus == False: if arguments['hcircuit'] != 1: heater_circuit = arguments['hcircuit'] if arguments['tempmod'] != ht_const.HT_TEMPNIVEAU_DUMMY: temp_mode = arguments['tempmod'] else: temp_mode = ht_const.HT_TEMPNIVEAU_NORMAL if arguments['temp'] != 4.0: error = cfg.set_tempniveau(arguments['temp'], hcircuit_nr=heater_circuit, temperatur_mode=temp_mode) if error != None: print("{0}".format(error)) if arguments['bart'] != 'none': error = cfg.set_betriebsart(arguments['bart']) if error != None: print("{0}".format(error)) else: if arguments['temp'] != 4.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (temporary) error = cfg.set_tempniveau( arguments['temp'], temperatur_mode=ht_const.EMS_TEMP_MODE_TEMPORARY) if error != None: print("{0}".format(error)) if arguments['tempc1'] != 11.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (comfort1) error = cfg.set_tempniveau( arguments['tempc1'], temperatur_mode=ht_const.EMS_TEMP_MODE_COMFORT1) if error != None: print("{0}".format(error)) if arguments['tempc2'] != 12.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (comfort2) error = cfg.set_tempniveau( arguments['tempc2'], temperatur_mode=ht_const.EMS_TEMP_MODE_COMFORT2) if error != None: print("{0}".format(error)) if arguments['tempc3'] != 13.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (comfort3) error = cfg.set_tempniveau( arguments['tempc3'], temperatur_mode=ht_const.EMS_TEMP_MODE_COMFORT3) if error != None: print("{0}".format(error)) if arguments['tempeco'] != 14.0: # first setup to auto-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_AUTO) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (eco) error = cfg.set_tempniveau( arguments['tempeco'], temperatur_mode=ht_const.EMS_TEMP_MODE_ECO) if error != None: print("{0}".format(error)) if arguments['tempman'] != 15.0: # first setup to manual-mode error = cfg.set_operation_mode(ht_const.EMS_OMODE_MANUAL) if error != None: print("{0}".format(error)) time.sleep(1) # second setup temperatur (manual) error = cfg.set_tempniveau( arguments['tempman'], temperatur_mode=ht_const.EMS_TEMP_MODE_MANUAL) if error != None: print("{0}".format(error)) if arguments['ecomode'] != -1: error = cfg.set_ecomode(arguments['ecomode']) if error != None: print("{0}".format(error)) if arguments['bart'] != 'none': if str(arguments['bart']).lower() in ('manual', 'man', 'm'): omode = ht_const.EMS_OMODE_MANUAL else: omode = ht_const.EMS_OMODE_AUTO error = cfg.set_operation_mode(omode) if error != None: print("{0}".format(error)) if arguments['adr'] != 0: error = trx.cfg_deviceaddress(arguments['adr']) if error != None: print("{0}".format(error)) if arguments['rst'] != 0: error = trx.reset() if error != None: print("{0}".format(error))