Skip to content

Commit

Permalink
Merge pull request #330 from dechamps/loop
Browse files Browse the repository at this point in the history
Add loop objects as points
  • Loading branch information
ChristianTremblay committed Jun 14, 2022
2 parents 503fc80 + 1f8034c commit 5288cec
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions BAC0/core/devices/mixins/read_mixin.py
Expand Up @@ -203,6 +203,11 @@ def _discoverPoints(self, custom_object_list=None):
obj_cls=EnumPoint, obj_type="multi", objList=objList
)
)
points.extend(
self._process_new_objects(
obj_cls=NumericPoint, obj_type="loop", objList=objList
)
)
points.extend(
self._process_new_objects(
obj_cls=StringPoint, obj_type="characterstringValue", objList=objList
Expand Down Expand Up @@ -259,6 +264,8 @@ def _process_new_objects(
prop_list = "objectName presentValue inactiveText activeText description"
elif obj_type == "multi":
prop_list = "objectName presentValue stateText description"
elif obj_type == "loop":
prop_list = "objectName presentValue description"
elif obj_type == "characterstringValue":
prop_list = "objectName presentValue"
elif obj_type == "datetimeValue":
Expand Down Expand Up @@ -296,7 +303,7 @@ def _find_propid_index(key):
pointName = point_infos[_find_propid_index("objectName")]
presentValue = point_infos[_find_propid_index("presentValue")]
if presentValue != None:
if obj_type == "analog":
if obj_type == "analog" or obj_type == "loop":
presentValue = float(presentValue)
elif obj_type == "multi":
presentValue = int(presentValue)
Expand Down Expand Up @@ -362,6 +369,10 @@ def _process_new_objects(
units_state = self.read_single(
"{} {} stateText ".format(point_type, point_address)
)
elif obj_type == "loop":
units_state = self.read_single(
"{} {} units ".format(point_type, point_address)
)
elif obj_type == "binary":
units_state = (
(
Expand All @@ -381,7 +392,7 @@ def _process_new_objects(
presentValue = self.read_single(
"{} {} presentValue ".format(point_type, point_address)
)
if obj_type == "analog" and presentValue:
if (obj_type == "analog" or obj_type == "loop") and presentValue:
presentValue = float(presentValue)

_newpoints.append(
Expand Down

0 comments on commit 5288cec

Please sign in to comment.