Custom Alert Help on a custom service

I have a custom service for a device that is monitoring a few relays. I have the graphing working and that’s all good. The graphs will show 0 if the relay isn’t triggered. I have alerts setup to send me an alert if it is triggered (triggered will return a 1 instead of 0) and that will work. However I want to add an alert on one of the graphs that if the trigger (ie a value of 1) doesn’t show up for the previous 7 days, I will receive an alert. What would be the best way to accomplish this?

Sorry, i have the same situation. I need and alert that must be send with relay change his state. If you has the solution, pse…tell me it.
thanks in advance.