I do have a couple of suggestions:
You may not need to watch your variables. There is a second value returned by a luup.variabe_get(…) which is the timestamp of the last change. See Variable Get.
You may get a Vera restart when you use long sleep time - E.g.
if (i == 1) then luup.sleep(120000) end
It would be better to use luup.call_delay(…). See Call Delay.
Thanks… I missed the second variable returned. I will play with it tomorrow as well as look into the delay.
At least I learned about variable_watch so it wasn’t a complete waste of effort 
The function:
luup.sleep
Is extremely dangerous and cause your Vera to restart.
You should NEVER use this for more than 10 seconds!
It should really only be used for less than 1 second.
I removed the sleep and the veriable_get is working great.