Skip to content

Commit

Permalink
Fix EC Input error when calibration temperature is None
Browse files Browse the repository at this point in the history
  • Loading branch information
kizniche committed Oct 10, 2024
1 parent e3dea59 commit ffb9448
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions mycodo/inputs/atlas_ec.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,26 @@ def get_measurement(self):
_, unit, _ = return_measurement_info(
device_measurement, conversion)

if unit != "C":
out_value = convert_from_x_to_y_unit(
unit, "C", last_measurement[1])
if last_measurement[1] is None:
self.logger.error("Cannot use calibration temperature because it returned None. "
"Fix your temperature measurement and try again.")
else:
out_value = last_measurement[1]

self.logger.debug(
"Latest temperature used to calibrate: {temp}".format(
temp=out_value))

ret_value, ret_msg = self.atlas_command.calibrate(
'temperature', set_amount=out_value)
time.sleep(0.5)

self.logger.debug("Calibration returned: {val}, {msg}".format(
val=ret_value, msg=ret_msg))
if unit != "C":
out_value = convert_from_x_to_y_unit(
unit, "C", last_measurement[1])
else:
out_value = last_measurement[1]

self.logger.debug(
"Latest temperature used to calibrate: {temp}".format(
temp=out_value))

ret_value, ret_msg = self.atlas_command.calibrate(
'temperature', set_amount=out_value)
time.sleep(0.5)

self.logger.debug("Calibration returned: {val}, {msg}".format(
val=ret_value, msg=ret_msg))
else:
self.logger.error(
"Calibration measurement not found within the past "
Expand Down

1 comment on commit ffb9448

@kizniche
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Radical DIY Forum. There might be relevant details there:

https://forum.radicaldiy.com/t/atlas-ec-disappears-after-8-16-0-upgrade/1976/17

Please sign in to comment.