【问题标题】:How to use BAC0 readRange in Python如何在 Python 中使用 BAC0 readRange
【发布时间】:2020-11-07 23:33:24
【问题描述】:

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

【问题讨论】:

    标签: python python-3.x iot bacnet bacnet4j


    【解决方案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")
    

    【讨论】:

    • 作为参考,unrecognizedService 是来自设备的消息,告诉您它不支持此服务。
    猜你喜欢
    • 2022-10-22
    • 1970-01-01
    • 1970-01-01
    • 2023-01-25
    • 1970-01-01
    • 2013-09-17
    • 2019-07-31
    • 2011-01-21
    • 2012-05-04
    相关资源
    最近更新 更多