LUA script to turn off device if power consumption = 0

Hi!

Do you know to do a script for that function?

Thanks!