Skip to content

Commit

Permalink
New develop branch
Browse files Browse the repository at this point in the history
including small fix for old bacnet devices that aren't able to send their objeclist in one message

Signed-off-by: Christian Tremblay <christian.tremblay@servisys.com>
  • Loading branch information
ChristianTremblay committed Jul 20, 2016
1 parent 8799fc3 commit ef2bd77
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions BAC0/core/devices/mixins/read_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _discoverPoints(self):


points = []
print(objList)
#print(objList)
def retrieve_type(obj_list, point_type_key):
"""
retrive analog values
Expand Down Expand Up @@ -248,15 +248,33 @@ def retrieve_type(obj_list, point_type_key):
point_type = str(each[0])
point_address = str(each[1])
point_infos = binary_points_info[i]
if len(point_infos) == 3:
#we probably get only objectName, presentValue and description
point_units_state = ('OFF', 'ON')
point_description = point_infos[2]
elif len(point_infos) == 5:
point_units_state = (point_infos[2], point_infos[3])
try:
point_description = point_infos[4]
except IndexError:
point_description = ""
elif len(point_infos) == 2:
point_units_state = ('OFF', 'ON')
point_description = ""
else:
#raise ValueError('Not enough values returned', each, point_infos)
# SHOULD SWITCH TO SEGMENTATION_SUPPORTED = FALSE HERE
print('Cannot add %s / %s' % (point_type, point_address))
continue
i += 1
points.append(
BooleanPoint(
pointType=point_type,
pointAddress=point_address,
pointName=point_infos[0],
description=point_infos[4],
description=point_description,
presentValue=point_infos[1],
units_state=(point_infos[2], point_infos[3]),
units_state=point_units_state,
device=self))
print('Ready!')
return (objList, points)
Expand Down

0 comments on commit ef2bd77

Please sign in to comment.