Rule, that check if last update is older than 5 Minutes

Hello,

I wrote a script collecting data from my SmartMeter and pushes data through RESTAPI in Openhab.
Its Working fine, but now i want to check if the Last Update was older than 5 Minutes and set HEARTBEAT(OFF)
and my Value to 0.
But i now i am struggeling finding the right Syntax for this RULE. Even the documentation could not Help me…

I hope someone can help me…

Here are my rules… Rule 1 is working fine … for Rule2 i need some help.

rule E750_HEARTBEAT 
when
  Item E750_HEARTBEAT changed
then
  E750_LASTUPDATE.postUpdate( new DateTimeType() )
end


rule CheckHeartbeat
when
    Time cron "0 0/1 * * * ?" 
then
// IF (E750_LASTUPDATE.STATE is older than NOW-5Minutes    
// then
E750_POWER_ALL_PHAESES..postUpdate(0)
E750_HEARTBEAT.postUpdate(OFF)
// ENDIF
end

Best Regards,
Stephan Mullis

There are examples in this all over the Design Patterns.

I recommend using the Design Pattern: Expire Binding Based Timers and just put that on your HEARTBEAT Item and throw away the LASTUPDATE Item and Rule, unless you want to show it on your sitemap for some reason.

Switch E750_HEARTBEAT ... { ..., expire="5m,command=OFF" }
rule "No Heartbeat"
when
    Item E750_HEARTBEAT received command OFF
then
    E750_POWER_ALL_PHASES.postUpdate(0)
end