Makeshift Heater/Thermostat (using HSM100 and Plug in Heater)?

So,

I want to setup a heater in my son’s room. I have a table top heater plugged into a z wave wall outlet. In the same room I have an HSM100 3-in-1 sensor.

So currently I have two scenes, One to turn the heater on when it’s under 65 and one to turn the heater off when it gets over 70. My question is does anyone have a luup code (or another way to do it) to make the scenes only active from 8pm-6am? So during the day the temp can drop to 55 or whatever then at 8pm it kicks back in.

Any thoughts?

[code]local t = os.date(‘*t’)
local current_time = t.hour * 3600 + t.min * 60 + t.sec
local begin_time = 6 * 3600 – 06:00
local end_time = 20 * 3600 – 20:00

if ( current_time > begin_time ) and ( current_time < end_time ) then
return false
else
return true
end[/code]

Returning false from the Luup code prevents the scene commands from running.

Great thank you!