gpt4 book ai didi

python - 如何在 Python 中使用 BAC0 readRange

转载 作者:行者123 更新时间:2023-12-04 08:37:27 36 4
gpt4 key购买 nike

大家好,我尝试在 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).
"""

最佳答案

要从设备对象读取多个属性,您必须使用 readMultiple .readRange将从类似于数组的属性中读取(例如,TrendLogs 对象将记录实现为数组,我们使用 readRange 使用记录块读取它们)。
关于如何使用 readMultiple 的详细信息可以在这里找到:https://bac0.readthedocs.io/en/latest/read.html#read-multiple
一个简单的例子是

bacnet = BAC0.lite()
tmp_points = bacnet.readMultiple("11:2 analogInput 0 presentValue description")

关于python - 如何在 Python 中使用 BAC0 readRange,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64733467/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com