Skip to content

Commit

Permalink
1.09-x - tweak to make the DOS start the new profile immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
brettonw committed Sep 13, 2022
1 parent 0773a1c commit 9d919b1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/apex/apex.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def set_dos_rate(self, did, profile_id, rate):
if int(profile["ID"]) != profile_id:
return {"error": "Profile index mismatch"}

# turn the pump off to start - this will enable a new profile setting to start immediately
# without it, the DOS will wait until the current profile period expires
return self.set_variable(did, f"Set OFF")

# check if the requested rate is greater than the OFF threshold
min_rate = 0.1
if rate > min_rate:
# our input is a target rate (ml/min). we want to map this to the nearest 0.1ml/min, and
Expand Down Expand Up @@ -215,6 +220,4 @@ def set_dos_rate(self, did, profile_id, rate):
return {"error": f"Requested rate ({rate} mL / min) exceeds the supported range (limit {int(pump_speeds[0] / safety_margin)} mL / min)."}
else:
# XXX TODO handle 0 < rate < 0.1ml/min by dosing over multiple minutes? Is this necessary?

# turn the pump off
return self.set_variable(did, f"Set OFF")
return {"error": ""}

0 comments on commit 9d919b1

Please sign in to comment.