This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Auto OFF function
#2
Hello.

Here is the resident script, which will be executed every minute

Code:
if not minute_counter then
  minute_counter = 0
end

plug_status = grp.getvalue('plug_status') -- the object of plug status

power_consumption = grp.getvalue('power_consumption') -- the object of power in watts

log(minute_counter)
--log(plug_status)
--log(power_consumption)

if plug_status and power_consumption < 10 then
  minute_counter = minute_counter + 1
else
  minute_counter = 0
end

if minute_counter > 59 then -- one hour passed
  grp.write('plug_control', false) -- turn off plug (plug control object)
  minute_counter = 0
end
Reply


Messages In This Thread
Auto OFF function - by eurosting - 21.10.2024, 09:13
RE: Auto OFF function - by RomansP - 21.10.2024, 10:22
RE: Auto OFF function - by eurosting - 21.10.2024, 17:29

Forum Jump: