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
#1
Hello All,
I'm searching for a small script, which switches off a power plug if device in stanby mode for a long time.
For example I'm using MDT AMS16.12 with power measuring function. The TV is connected to the power plug, which is controlled by AMS1216 device.
So after watching TV I forget sometimes to disable the plug. 
I looking for a script like: 
if TV power plug status =1, but power consumption < 10W for 1 hour, 
then disable the plug.

Tried to use FBD editor of WISER, but without succes. Please 
advise.
Reply
#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
#3
Thanks a lot, your script is working perfect!
Reply


Forum Jump: