Skip to content
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

ThresholdAlert Bug Fixes #106

Merged
merged 1 commit into from
Aug 16, 2023
Merged

ThresholdAlert Bug Fixes #106

merged 1 commit into from
Aug 16, 2023

Conversation

rkoshak
Copy link
Owner

@rkoshak rkoshak commented Aug 15, 2023

Bug Fixes:

Function Problem Fix
stateToValue The JS function isNaN returns true for empty string causing problems when hysteresis was not set. Added if clause to handle empty string explicetly.
isAlertingState The ternary operation in the log statement was not working, showing the wrong value in the logs. Calculate the return value and save to a variable instead of recalculating it in the log statement.
notAlerting Testing the wrong timer in record before cancelling initAlertTimer Fixed if statement
refreshRecord It's not clear which value is being sent to stateToValue for conversion. Added log statements before calls to stateToValue indicating what is being converted (state, threshold, hyst).
procEvent state is already converted to a value before this function is called Use state instead of converting it again.
procEvent record[name] should only be initialized once Don't reinitialize if one of the timers or alerted do not exist. Treat those cases as an error.
procEvent Code simplicity Let notAlerting handle the case where we are no longer alerting but there is no endAlert rule to call.
refreshRecord Missing newline after Init Alert Rule ID in log statement.
Body Missing case for ItemStateUpdatedEvent Added case for ItemStateUpdateEvent to handle cases where the default trigger is changed to received update from changed.
Body It's not always clear when the rule is triggered manually Change debug log statement to info level when manually triggered.

Signed-off-by: Richard Koshak <rlkoshak@gmail.com>
@rkoshak rkoshak merged commit 4400d39 into main Aug 16, 2023
@rkoshak rkoshak deleted the taFixes branch August 18, 2023 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant