-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set default threshold to self.THRESHOLD_TEMP #89
Conversation
The value of |
s_tui/Sources/TemperatureSource.py
Outdated
@@ -51,6 +51,8 @@ def __init__(self, custom_temp=None, temp_thresh=None): | |||
self.temp_thresh = int(temp_thresh) | |||
logging.debug("Updated custom threshold to " + | |||
str(self.temp_thresh)) | |||
else: | |||
self.temp_thresh = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change to self.THRESHOLD_TEMP to be consistent.
s_tui/Sources/TemperatureSource.py
Outdated
@@ -51,6 +51,8 @@ def __init__(self, custom_temp=None, temp_thresh=None): | |||
self.temp_thresh = int(temp_thresh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we are at it, its a good idea to address the case of ValueError
for this conversion, and set to THRESHOLD_TEMP if it fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a new commit that reflects all this.
e95e4fb
to
4079dee
Compare
If no custom threshold is set we need something to compare to. If the custom threshold is not a valid value we need to catch ValueError. If the custom threshold is lower than zero we need to set some value, too. For all these cases, we use self.THRESHOLD_TEMP as value for temp_thresh. This fixes issue amanusk#87.
4079dee
to
c6f590b
Compare
New commit, combining possible errors. |
Sorry for the long delay. This looks good. I will review and approve this shortly. |
@mkesper thank you for you contribution. Now merged. |
Thanks a lot! |
If no custom threshold is set we need something to compare to.