Skip to content

Conversation

@hillsandales
Copy link

I came across a need to delay an alert for a certain amount of time before actually sending the alert. I thought this might be a handy feature for others and that you may want to add it.

I'm monitoring a dehumidifier's power usage. When it turns off, I was trying to send an alert, indicating the unit was full (power goes down when it's not running of course). However, the unit sometimes cycles on and off depending on the humidity. It may turn off only for a minute and then turn back on for an hour. I came up with the idea to set a delay before the event message is actually sent. So it would only send a message after one hour of the condition being true. Each time the condition is indicated as false, it resets a timestamp that's used to calculate if the time delay period has elapsed.

I tested it with a frequently updating value (uptime) from an arduino node. It seems to work as expected, and seems to behave nicely when using a "Mutetime" parameter too.

The following is the solution I came up with. The downside might be that it updates a time value in the database each time the feed check is processed (seems to be every time a value is sent from the node that has an event entry attached to it), but I couldn't figure out how to get around this easily. If there's another solution that's more elegant, by all means, use that one! I tried to leave as much code alone as I could manage. If there's another way to make it cleaner, that's great!

@elyobelyob
Copy link
Collaborator

Probably best to add the new variable in the update to the end of the call? Am also concerned r.e. the time stamp updating. Does this mean that my last update gets a new 'sent' time even if its just a 'touch' of the row? Quite a useful addition though. Does it cater for devices that still have a base value when not running? E.g. To tell me when my washing machine finishes? I've always dreamt of some sort of power analysis tool, where certain behaviours on total power consumption can be identified.

@elyobelyob
Copy link
Collaborator

This can't be merged automatically according to github.

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.

2 participants