用于huber循环浴缸的python驱动程序。
huber的Python项目详细描述
休伯
用于Huber Baths的以太网驱动程序和命令行工具。
安装
pip install huber
用法
命令行
对于基本任务,此驱动程序包含一个命令行界面。阅读帮助 更多。
huber --help
Python
对于更复杂的项目,请使用python自动化您的工作流。这个 驱动程序只使用异步python≥3.5。
importasynciofromhuberimportBathasyncdefget():withBath('192.168.1.100')asbath:print(awaitbath.get())asyncio.run(get())
如果浴缸正在通信,则应打印以下格式的字典:
{'on':False,# Temperature control (+pump) active'temperature':{'internal':23.49,# Internal temperature, °C'setpoint':20.0# Temperature setpoint, °C},'pump':{'pressure':0.0,# Pump head pressure, mbar'speed':0,# Pump speed, rpm'setpoint':0# Pump speed setpoint, rpm},'status':{'circulating':False,# True if device is circulating'controlling':False,# True if temperature control is active'error':False,# True if an uncleared error is present'pumping':False,# True if pump is on'warning':False# True if an uncleared warning is present},'fill':0.0,# Oil level, [0, 1]'maintenance':338,# Time until maintenance alarm, days'warning':{# Only present if warning is detected'code':-1,'condition':'','recovery':'','type':''},'error':{# Only present if error is detected'code':-1,'condition':'','recovery':'','type':''}}
mainget
方法将多个tcp请求串在一起,可能需要0.5s
去跑步。如果不需要所有数据,则应使用以下命令:
awaitbath.get_setpoint()# °Cawaitbath.get_internal()# °Cawaitbath.get_pressure()# mbarawaitbath.get_pump_speed()# rpmawaitbath.get_fill_level()# [0, 1]awaitbath.get_next_maintenance()# daysawaitbath.get_status()# boolean dictionaryawaitbath.get_warning()# None or dictionaryawaitbath.get_error()# None or dictionary
您还可以启动、停止、设置温度设定点和设置泵速。
awaitbath.start()awaitbath.stop()awaitbath.set_setpoint(50)# °Cawaitbath.set_pump_speed(2000)# rpmawaitbath.clear_warning()awaitbath.clear_error()
实施
它使用中描述的pb方法 the manual。 注意,这并没有利用pb package命令,这将 以额外的浴缸配置为代价减少数据传输。 这也没有利用高精度的PB数据传输, 因为在大多数用例中,它的解析是不必要的。