Skip to content

Commit

Permalink
Merge pull request #13 from NREL/none_empty_priority_array
Browse files Browse the repository at this point in the history
Add ability to cede control of point by writing null to priority array
  • Loading branch information
TShapinsky authored Jun 7, 2023
2 parents 8146c85 + 3fe1ca9 commit 48ec2b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions alfalfa_bacnet_bridge/alfalfa_bacnet_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def setup_points(self):
else:
self.points[input] = AnalogValueCmdObject(objectName=input, objectIdentifier=("analogValue", index))
print(f"Creating INPUT point: '{input}'")
self.points[input]._had_value = False
index += 1

for output in output_names:
Expand Down Expand Up @@ -127,6 +128,10 @@ def main_loop():
current_value, value_type = object._highest_priority_value()
if value_type is not None:
set_inputs[point] = current_value
object._had_value = True
elif object._had_value:
set_inputs[point] = None
object._had_value = False
if len(set_inputs) > 0:
self.client.set_inputs(self.site_id, set_inputs)

Expand Down

0 comments on commit 48ec2b1

Please sign in to comment.