用于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数据传输, 因为在大多数用例中,它的解析是不必要的。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
空字符串检查在java中未按预期工作   JavaSpringWebClient:自动计算主体的HMAC签名并将其作为头传递   foreach是否有一个Java等效的foreach循环和一个引用变量?   java如何在Eclipse中导入jar   使用特定第三方或java时lombok触发错误。*方法或构造函数   安卓 java将对象数组转换为int数组   java使一定百分比的JUnit测试通过   java Android:将Seekbar的一个值与另一个值进行比较   java将int数组(图像数据)写入文件的最佳方式是什么   java取代了系统。yml的构造函数内的getProperty   sqlite Java将公钥和私钥转换为字符串,然后再转换回字符串   安卓获取白色像素并将其保存到java opencv中的数组中   java为什么是ServerSocket。setSocketFactory静态?   Java数组似乎在不直接修改的情况下更改值