Rule to check if the cable to the cars engine block heater is plugged in

This is a rule I use to help me to not forget to plug in my cars engine block heater in the evening.
The engine block heater draws about 500W and I also have a fan heater inside the car which draws about 1100W. The rule turns the outlet on for 10 seconds, checks the consumption and notifies me if things are in order or not. I use a Z-wave Aeotec Heavy Duty Smart Switch.

rule "Check engine block heater"

when
    Time cron "0 0 21 ? * MON,TUE,WED,THU,SUN *" //Runt test at 2100 on Sunday to Thursday evenings.
then
if (EngineHeater.state == OFF){ //Only run test if outlet is OFF
    sendCommand(EngineHeater, ON)
    Thread::sleep(10000) //Wait 10 sec to let the outlet report the current consumption
        if (EngineHeaterPower.state > 900){
        sendNotification("xxxx.xxxxx@xxxx.com", "OK! Cable plugged in. " + EngineHeaterPower.state + " W")
        }
        if (EngineHeaterPower.state > 400 && EngineHeaterPower.state < 800){
        sendNotification("xxxx.xxxxx@xxxx.com", "WARNING! Cable plugged in but not the fan heater. " + EngineHeaterPower.state + " W")
        }
        if (EngineHeaterPower.state < 399){
        sendNotification("xxxx.xxxxx@xxxx.com", "WARNING! Cable NOT plugged in! " + EngineHeaterPower.state + " W")    
        }
    sendCommand(EngineHeater, OFF)
}

end

This is probably not a problem with a Rule like this. But long sleeps can be dangerous. A Timer would be a better approach.

Thanks for sharing!

Aha I didn’t know that. It seems to work fine here though. Where can I read about this possible problem?