python - 如何在 Python 中使用 BAC0 readRange
问题描述
大家好,我尝试在 python 3 中使用 BAC0 包来获取 bacnet 网络中多个点的值。我使用如下内容:
bacnet = BAC0.lite(ip=x.x.x.x)
tmp_points = bacnet.readRange("11:2 analogInput 0 presentValue");
似乎不行:(错误是:
BAC0.core.io.IOExceptions.NoResponseFromController: APDU Abort Reason : unrecognizedService
在文件中我可以找到
def readRange(
self,
args,
range_params=None,
arr_index=None,
vendor_id=0,
bacoid=None,
timeout=10,
):
"""
Build a ReadProperty request, wait for the answer and return the value
:param args: String with <addr> <type> <inst> <prop> [ <indx> ]
:returns: data read from device (str representing data like 10 or True)
*Example*::
import BAC0
myIPAddr = '192.168.1.10/24'
bacnet = BAC0.connect(ip = myIPAddr)
bacnet.read('2:5 analogInput 1 presentValue')
Requests the controller at (Network 2, address 5) for the presentValue of
its analog input 1 (AI:1).
"""
解决方案
To read multiple properties from a device object, you must use readMultiple
.
readRange
will read from a property acting like an array (ex. TrendLogs objects implements records as an array, we use readRange to read them using chunks of records).
Details on how to use readMultiple can be found here : https://bac0.readthedocs.io/en/latest/read.html#read-multiple
A simple example would be
bacnet = BAC0.lite()
tmp_points = bacnet.readMultiple("11:2 analogInput 0 presentValue description")
推荐阅读
- python - python和c++上的LinkedList
- amp-html - 用户创建项目的加速移动页面(页面)
- bazel - 使用 --symlink_prefix 查询 bazel 目标的输出目标
- ios - 从文件中检索图像时旋转
- scenekit - 哪种类型的镜头(公式)scenekit 用于计算 scncamera 的视野?
- java - Spark 编码器:何时使用 beans()
- marklogic - Marklogic - 未找到模块 /com.marklogic.hub/dhf.xqy
- r - 在老鼠身上完成到底有什么作用?
- go - glide update 清空 glide.lock
- deployment - Kubernetes Ingress whitelist-source-range 允许所有 IP