Can PLEG do this? -Controlling excessive computer usage in my home

Hi all.

As a parent, I need to limit the time my kid uses on the computers and smart phones. Exessive usage isn’t helping kids get better grades or improving their face-to-face social skills. (I know that I use too much time myself but it’s already too late to do something about it)

I already have a working solution involving a PLEG device, a variable container device, a Countdown Timer device and a Binary Ligt Switch device that turns the dedicated router on or off. It works well but I believe my current solution involves too many devices and it’s somewhat “quick and dirty”. It would be nicer to accomplish everything in one clean and single PLEG and eliminate the need of the Countdown Timer device which I believe is quite resource hungry.

My kids computer devices usage are already detected by my router that toggle the on/off status on a virtual multiswitch device.

What I don’t know is how to implement a countdown timer within PLEG that I dynamically can assign an arbitrary amount of time (that I choose). When computer usage is detected I would like the PLEG timer to count down. If computer usage suspends (takes a pause), I want the timer to stop counting and preserving the time left. When additional computer usage is detected it will continue counting down from whatever time is left. I want to detect when 5 minutes is left so I can let vera Alert inform my kid to save his work or whatever he want’s to do. Would it be feasible to make this kind of timer in PLEG? I’d be really happy for some hints in to to accomplish it. Thanks!

You can do this … but PLEG does not have a timer that can be paused, and it does not have a UI.

For a UI you can use a Variable Container.
One variable for the Limit … and another as the InitialAllocation for the TimeRemaining
The units of IniitialAllocation are Hours.
You have not indicated how you want to reset the counter … Done at 4:00 in the morning ?

Conditions like:

TimeRemaining 4OClock ? InitialAllocation * 3600 : ((ComputerOn and (ComputerOn; NOW)) ? TimeRemaining - (#NOW - #TimeRemaining) : TimeRemaining)
You will need repeat to be on.

Warn TimeRemaining < 5 * 60
If you want 1 minute warnings … turn repeat on!

Off TimeRemaining < 0

The action for TimeRemaining is to set the Variable Container for Time Remaining.
i.e. use {(TimeRemaining / 3600)} in the Advanced tab as the value for the Variable Container.

Note: This has an average error rate in the timer of about 30 seconds per start-stop sequence because of the sampling of the NOW timer.

There are also, non-Vera based methods that might work better… Parental Control apps for the computer/phone, or Router that has Parental Control / Quota / etc built-in. They also allow usage/bandwidth/site tracking where any Vera integration would not.

and eventually your kids will figure out you turned off the router and simply turn it on again… IMO to control the access point, controls in the Router Firmware will be your best bet as it will simply only allow admins to change it.

@Aaron, thanks. I’m actually quite happy with the functionality I can get from letting Vera control turn on/off the router. Next step will be to let Vera control the DD-WRT router’s firewall rules. I have an idea already how to implement that.

@Richard

You are very kind. Thanks a lot. I’ve tried to set up what You suggested but I’m a little bit confused about what “Decumulator” is. Is it the device Variable Time remaining?

Please see my attachment. It doesn’t work yet but I think it’s very close now. Just need a small push in the right direction. BTW, is {(Decumulator / 3600)} really correct as action?

I updated my previous entry …

I started to use the variable name Decumulator then change to TimeRemaining

@farang

When my son was younger, I needed to protect him from bad content on the Internet and enforce Internet time restrictions. I highly recommend NetNanny, it’s a more elegant solution than what you are trying. It also generates reports on what exact web pages they are using their time on. So when they request more time to get their homework done, you can simply show the report and say, “You haven’t been working on your homework.”

It also gives the kids the ability to request more time right from the screen, which then sends you an email. You can then remotely grant them extra time. I really, really, recommend this program.

-TC

@TC

Thanks for the recommendation. I realize that my attempt to limit exessive computertime has its flaws and you are probably right that there are other solutions out there that are more elagant. As kids are getting more and more ways to access Internet parents need to be aware of what’s going on. My son has access to 3 computers and one of them is technically the property of the school so I a not allowed to install any software on it. I guess every situation is different and the need of control is not static but varying over time. In my case I’ve put the main computer in a central place of the house. I also have a good dialogue with my son and we discuss these matters. What I achive with the PLEG may not be 100% effective but my experience so faar is that I don’t have to constantly nagging him, confronting him about exessive computer usage. He accepts the current state and the degree of invasion of privacy of the constraints means to him. After time is consumed he normally goes out playing basket ball or doing some outdoor activity as he knows he will probably be rewarded with some bonus time afterwards. It kind of works well here. But thanks anyway for the recommendation. :smiley:

@Richard

Thanks Richard, it works very well now. It’s truly amazing what the PLEG may be used for and I am impressed by your kindness and ability to help others trying to learn. I am extremely grateful for your help.

Today I’ll be expanding the functionality a bit. I’ll try to figure out by myself how to purge any remaining time after a certain time in the evening.

One thing that I failed doing yesterday (and might need some assistance with) is to format the remaining time string a bit nicer. I tried something like

math.floor(TimeRemaining/3600)..":"..string.format("%02.f", math.floor((TimeRemaining-math.floor(TimeRemaining/3600)*3600)/60)) in the advanced tab but I think it was too long and therefore truncated. I also tried to put the formatting as described in in a condition but I failed using it. I am a beginner after all. ;D ;D ;D

UPDATE: I solved the above by writing the Timeremaining value to my Variable Container and at the same time writing “1” to an unused variable that I used to trigger some LUUP-code to do the reformatting for me. Somewhat ugly solution but it works. :smiley:

Nested Ternary Statements can be a mess and is not so easy for the brain to interpret but I guess that’s the way we must do it…

Here’s the TimeRemaining condition after one day mangling

(sNewWeekDay or sNewWeekEnd) ? pAllocDay * 3600 : (sNewMorning1 or sNewMorning2 ? pAllocMorning * 3600 : (Add30Mins ? 30 * 60 : (Add60Mins ? 60 * 60 : ((sPurgeTime1 or sPurgeTime2) and (TimeRemaining > 300) ? 5 * 60 : (((TimeRemaining - (#NOW - #TimeRemaining)) <= 0 ) ? 0 : (((c3On and (c3On; NOW)) or (c6On and (c6On; NOW)) or (TimeRemaining <= 300)) and (TimeRemaining > 0) ? TimeRemaining - (#NOW - #TimeRemaining) : TimeRemaining))))))

You can break this into multiple conditions!