import BAC0
bacnet = BAC0.connect()
my_obj_list = [('file', 1),
('analogInput', 1002),
('analogInput', 1),
('analogInput', 1006),
('analogInput', 1011),
('analogInput', 1010),
('analogInput', 1001)]
# # Provide it as an argument
fx = BAC0.device('16102:19', 1610219, bacnet, object_list = my_obj_list)
p=fx.points
for point in p:
print(point)
The code is returning the point values as expected, but throwing an exception. Can not figure out what I'm doing wrong.
error
2018-11-26 17:45:51,864 - INFO | Starting BAC0 version 0.99.944 (Lite) 2018-11-26 17:45:51,908 - INFO | Using ip : 192.168.0.16 2018-11-26 17:45:51,909 - INFO | Starting app... 2018-11-26 17:45:51,910 - INFO | BAC0 started 2018-11-26 17:45:51,910 - INFO | Registered as Simple BACnet/IP App 2018-11-26 17:45:54,529 - INFO | Changing device state to DeviceDisconnected'> 2018-11-26 17:45:54,726 - INFO | Changing device state to RPDeviceConnected'> 2018-11-26 17:45:54,928 - INFO | Device 1610219:[device1610219] found... building points list 2018-11-26 17:45:57,674 - INFO | Ready! 2018-11-26 17:45:57,676 - INFO | Polling started, values read every 10 seconds Exception in thread rpm_poll: Traceback (most recent call last): File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\threading.py", line 916, in _bootstrap_inner self.run() File "C:_website\BacTest\venv\lib\site-packages\BAC0\tasks\TaskManager.py", line 45, in run self.process() File "C:_website\BacTest\venv\lib\site-packages\BAC0\tasks\TaskManager.py", line 52, in process self.task() File "C:_website\BacTest\venv\lib\site-packages\BAC0\tasks\Poll.py", line 77, in task self.device.read_multiple(list(self.device.points_name), points_per_request=25) File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\devices\mixins\read_mixin.py", line 452, in read_multiple self.read_single(each,points_per_request=1, discover_request=discover_request) File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\devices\mixins\read_mixin.py", line 459, in read_single return self.properties.network.read(request) File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\io\Read.py", line 87, in read args_split, arr_index=arr_index, vendor_id=vendor_id, bacoid=bacoid)) File "C:_website\BacTest\venv\lib\site-packages\BAC0\core\io\Read.py", line 310, in build_rp_request addr, obj_type, obj_inst, prop_id = args[:4] ValueError: not enough values to unpack (expected 4, got 2)
device1610219/ai_2 : 2.30 noUnits device1610219/zone_temp : 45.00 degreesFahrenheit device1610219/ai_6 : 75.00 degreesFahrenheit device1610219/ai_11 : 1.00 65535 device1610219/ai_10 : -53.30 degreesFahrenheit device1610219/ai_1 : 0.00 noUnits
Process finished with exit code 0
I've made some tests trying to replicate your bug and I think you may be fighting with a weird device.
Using the exact same script I succeed reading all points.
If I may suggest though, declaring your device using default "poll" parameters will assure reading of all points every 10 seconds.
Using points will force a reading of points (one by one) when called which will slow the process. For that, I would use
point.lastValue
When the device polls its point list, internally, it'll use a ReadPropertyMultiple that will read a bunch of points and properties at the same time. It is more efficient.
Something like (playing with format...) :
(Extract of result)
If you keep getting issues, please post one here : https://github.com/ChristianTremblay/BAC0/issues