[BETA RELEASE] TV Timer for Parental "Smart" Control

For a laptop you are correct this wouldn’t work. However if you controlled the Monitor for the computer this would work. I believe that is how BOB recommends it to be used with a PC.

True also for Game Consoles. We have friends who have Game Consoles all by themselves on a small TV and that is how they control them.

Cheers, so looking at that App it’s tied in to the home security… so you couldn’t use that app as the PIN management, you would need to include that in addition to quota and time period management.

Unless there is something that can already manage this then a fair bit to do to get this to work, unless you just edit the smart app you linked to remove the security aspects and add in quota management… Either way a fair bit of work required…

I will have to look at this closer when I get home. However I could swear I saw someone modify this to work with actions other than security.

If I find it I will post a link. Thanks.

As I stated before I am willing to pay if it’s reasonable. Anyone or a group that can help.

So have been looking at the code, thinking you could use the existing code and modify, but the key thing missing is different events for different users, now if I can workout just how to get the PIN event, then I could write the logic to check that value against the stored PINs linked to users (that bits easy if you can get the PIN) and the quota management should be pretty easy too, although not sure the extra quota logic will be easy without using dummy switches due to the user editable fields being read only to the code.

Part of the issue is that without the actual device here, testing is a little more complicated :smile:

I’ll take another look tomorrow and see if I can work it out! (Not in it for the money, just in it for the fun!)

I can PayPal you some money if you can buy one at Lowe’s. If you are interested in helping that is. Just let me know.

I just picked one up from Lowe’s today. It was $39.99. I just added the device. Seems to be when it’s added ST sees it as a Thing. Must be a device ID thing. Not a huge issue just had to edit the device type to Centralite Keypad. The Wireless Light on the device kept blinking until I pressed the Off and then the On button. Now it has stopped and the device showed active. See picture below of device screenshot.

@Entityxenon Jake, I have successfully added and configured the Iris 3405-L Keypad (CentraLite). In order to finalize the device I actually had to go into the app and click the “Configure” and “Refresh” buttons inside the app to get the paired keypad to start working with ST. (Using the custom devicetype created by @mitchp Mitch Pond)

I then used the modified User Lock Manager created by @ethayer Erik Thayer and modified by @blebson Ben Lebson to set the SHM (Smart Home Monitor) states (ArmAway/ArmStay/Disarm). Also this offers multiple Users and Passwords Which can be blocked out on certain times of the day.

Then I used Rule Machine created by @bravenel Bruce to switch the Z-Wave Switch On after SHM is set to Arm/Away (On button on the keypad) and then to switch the Z-Wave Switch Off after SHM is set to Disarm (Off button on the keypad). Also Rule Machine can block out these rules during certain days of the week and certain hours of the day.

Doing it this way is not ideal as I will eventually want the Arm/Disarm functions to only be used when I get the Security side of my smart home working.

I have also set Rule Machine to Turn this Z-Wave Switch Off at a certain hour of day when we want the TV off for the kids bedtime.

So as far as basic functionality this hardware works perfectly. This is a feasible thing to accomplish with the chosen hardware.

Of course Time Management does not exist and some other functionality the BOB offers.

This is very cool. And I want to thank all of you.

@jgravert thanks for the offer on the keypad, but I’m in the UK and our HA market is currently quite small so product selections are very limited.

Regarding the app you are using, it should be fairly easy to strip out the SHM elements and get it to trigger a switch, the issue comes when you want to manage the quotas for the users which is a bit more than swapping out a few lines of code because I don’t think the current structure supports handling of individual users in this way, will need to take a look later though at work right now. Will take a look at the device specs you posted as well as might be significantly easier just to write from scratch as long as I can work out what the device actually outputs :slight_smile: which should be simple looking at the custom device

OK I think I’ve found something I can work with in mitch’s code… I’ll see what I can pull together in the next hour…

1 Like

So 9 days later of pretty much daily coding, re-coding, researching, testing, re-testing @jgravert and I have developed an app to do this…

Parent and Child app… create 2 new apps in IDE (Parent first which you should save and publish) and then the child which you should just save)

THIS IS BETA

I haven’t written a proper install or feature guide but the feature list is below, also please ignore the “TEST SWITCH” option, as will only do something if you have a user called “Jake”

Use a Centralite Keypad to turn on/off a TV or screen for multiple users:

Each user:

  • Own PIN
  • Own Quota
  • Stops quota when TV turns off
  • Stops quota if another user activates
  • Allowed time periods
  • Reset quota switch in app

Globally:

  • Single switch to turn off all users
  • Single switch to provide free usage to all users
  • Single page to view available quota

Code can be found here, any suggestions or forks to code are welcome!

2 Likes

Kudos to @Entityxenon for creating this awesome app! Thank you! :grinning:

NOTE: Scroll to the top of this thread for how I created a Padlocked Outlet to keep kids from unplugging the TV and plugging into a regular outlet.

Instructions for Installing TVTimer Manager

Install Device Types

  1. Centralite Keypad (I will post the Iris Keypad information at the end of this post)
  2. Smart Outlet with or without a built in Smart Meter (Any type that you are using to power your TV)
    Metered Outlet Recommendation will be at the bottom of this post.

Install and Configure Smart outlet

General Instructions here: https://support.smartthings.com/hc/en-us/articles/205956950-How-to-connect-and-configure-new-devices

Install Centralite Keypad
Manually from Code

For this method you will need to have one browser window open on GitHub and another on the IDE.

Follow these steps to install the Centralite Keypad:
Thanks to @mitchp Mitch Pond for creating this custom device type

  • [IDE] Click on My Device Handlers
    
  • [IDE] Click + Create New Device Handler (top right corner)
    
  • [IDE] Click the From Code Tab
    
  • [GitHub] Go to the respository for the Centralite Keypad: https://github.com/mitchpond/SmartThingsPublic/tree/indev/devicetypes/mitchpond/centralite-keypad.src
    
  • [GitHub] Click Raw
    
  • [GitHub] Select all of the text in the window (use Ctrl-A if using Windows)
    
  • [GitHub] Copy all of the selected text to the Clipboard (use Ctrl-C if using Windows)
    
  • [IDE] Click inside the text box
    
  • [IDE] Paste all of the previously copied text (use Ctrl-V if using Windows)
    
  • [IDE] Click Create
    
  • [IDE] Click Save
    
  • [IDE] Click Publish --> For Me
    

Confirgure/Pair the Iris Keypad/Centralite Keypad

General Instructions here: https://support.smartthings.com/hc/en-us/articles/205956950-How-to-connect-and-configure-new-devices

For specific Help with the Iris Keypad: CentraLite Keypads

Install the TVTimer SmartApp
(You will be installing two SmartApps a Parent/Manager App and a Child/User App)

Install Manually from Code

For this method you will need to have one browser window open on GitHub and another on the IDE.

Follow these steps to install the TVTimer Parent/Manager App:

  • [IDE] Click on SmartApps
    
  • [IDE] Click + New SmartApp (top right corner)
    
  • [IDE] Click the From Code Tab
    
  • [GitHub] Go to the respository for the TVTimer Manager SmartApp: https://github.com/jebbett/TVTimer/blob/master/TVTimer_Manager.groovy.txt
    
  • [GitHub] Click Raw
    
  • [GitHub] Select all of the text in the window (use Ctrl-A if using Windows)
    
  • [GitHub] Copy all of the selected text to the Clipboard (use Ctrl-C if using Windows)
    
  • [IDE] Click inside the text box
    
  • [IDE] Paste all of the previously copied text (use Ctrl-V if using Windows)
    
  • [IDE] Click Create
    
  • [IDE] Click Save
    
  • [IDE] Click Publish --> For Me
    
  • [IDE] Click on SmartApps Above
    
  • [IDE] Verify that the SmartApp shows up in the list and is marked with Status Published
    

Now Follow these steps to install the TVTimer Child/User App:

  • [IDE] Click on SmartApps
    
  • [IDE] Click + New SmartApp (top right corner)
    
  • [IDE] Click the From Code Tab
    
  • [GitHub] Go to the respository for the TVTimer User SmartApp: https://github.com/jebbett/TVTimer/blob/master/TVTimer_User.groovy.txt
    
  • [GitHub] Click Raw
    
  • [GitHub] Select all of the text in the window (use Ctrl-A if using Windows)
    
  • [GitHub] Copy all of the selected text to the Clipboard (use Ctrl-C if using Windows)
    
  • [IDE] Click inside the text box
    
  • [IDE] Paste all of the previously copied text (use Ctrl-V if using Windows)
    
  • [IDE] Click Create
    
  • [IDE] Click Save - NOTE: DO NOT PUBLISH
    
  • [IDE] Click on SmartApps Above
    
  • [IDE] Verify that the SmartApp shows up in the list and is marked with Status Unpublished
    

Setup the TVTimer App

Go to the Smartthings App on your phone or tablet.

  1. Select Marketplace -> SmartApps (Scroll Down to the Bottom) -> My Apps -> TVTimer Manager

  2. Select Done (You could configure from here however if you are having network issues you may not want to do this yet).

  3. Go Back to the Dashboard.

  4. Select My Home -> SmartApps -> TVTimer Manager.

  5. Scroll down to Advanced Settings and Tap

  6. Go to Keypad Input and select your keypad

  7. Go to Switch To Control and select your TV Outlet

  8. Optional: Scroll down to When This Meter and select your Metered TV Outlet

  9. Select Done

  10. Select Create New User

  11. Enter the Name, Quota Minutes and PIN Code

  12. Optional: Scroll Down and setup Allowed Times. These are windows of time that reguardless of the Users allowed time the TV Outlet will not function. Think of this as Blackout times.

  13. Select Done

  14. Wait for the App to update. The User you just created will populate on the screen above Create New User

  15. Now select Done.

Enjoy!

NOTE: Android Users there is a known bug with the Smartthings App on Android. Be sure when changing settings to ALWAYS press DONE. Do Not use the BACK button.

UPDATE: How to Use TVTimer

You can get the Iris Keypad here: http://www.lowes.com/pd_690406-41277-3405-L___?productId=999925326&pl=1&Ntt=iris

A good Smart Meter Outlet although you can use any. (2 listed below)

15 Amp: http://www.amazon.com/Enerwave-ZW15RM-Resistant-Receptacle-Screwless/dp/B00SXEMD9G
20 Amp: http://www.amazon.com/gp/product/B00SXEMALM/ref=pd_lpo_sbs_dp_ss_3?pf_rd_p=1944687642&pf_rd_s=lpo-top-stripe-1&pf_rd_t=201&pf_rd_i=B00SXEMD9G&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=1KV017YDFNKD8GN6RSSS

2 Likes

A few updates and fixes added, added ability to see if a user is active in the app.

And also updated code to stop using the troublesome unschedule() command due to recent SmartThings issues

1 Like

realise this is an old thread, but is there a way to use this smartapp without having to be quite so draconian and have a keypad etc?

I’d happy just punch in a number at the beginning of the day, and have the tv turn off after that time.

Not tried this yet, but I wonder if it’s a bit overkill for my 7yr old!!

No worries,

This app has had no active development since Feb 2016… I’m not even sure if it even still works or if James is still using it, there were some significant issues with the ST platform at the time which meant it was not the most reliable…

I know there have been significant improvements in the ST platform with regards to scheduling, but code will need to be updated to take advantage of some of these benefits, although some stability improvements should have helped regardless.

In terms of your question… what are you actually trying to achieve? Are you just looking to provide an allowance per day? If so I don’t have a keypad either, I used a virtual switch for testing, the code is probably even still in there… I’d just need to hunt it out and re-enable it and you could just create a virtual switch? Just let me know what you are trying to do and if it wont take much time I’ll update it… if it’s going to be significant work or the platform changes mean I need to re-code then I wont be able to put in the time required…

I still use this. It has been working wonderfully especially since ST updated servers, etc.

If you are simply looking for something to automatically turn off the TV at a specific time you probably don’t need this app.

There are other ways to have something turn off either at a specific time or after a certain amount of time has passed.

The power of this app is the ability to allow the kids to use the TV themselves and manage how much time they are on the TV and limit the window of when they can use it.

When I implemented this my youngest was 6 years old. I simply made his code 1111 so he would remember it. Not a bad thing for him to learn to use as it translates into use of an ATM or 10 key later in life.

thanks for the reply. I am looking for a way to basically log/see how much tv is being watched per day, and then probably the rest of the involvement needs to be human - I’m not sure my kids would cope too well with it just switching off with no warning - there would be a riot!

I might look instead to create a simple daily timer that starts/stops when my Harmony is in a certain mode (ie netflix) and if I can get that visible as a device in smartthigns that’s even better. for now I will look at doign that with something like webcore, but thank you for your offer to help. this community is what makes ST so engaging!

We never had an issue other than disappointment when the TV turns off. Also since we have 4 kids using it it works quite nicely. They have simply adapted to how it functions.

We have had to lock it down a few times when they weren’t listening and it is quite interesting to see how quickly they respond once you do that. It has been a great tool.

We have even used the free time option and that was perfect when people were visiting.

@mu71rd You could also monitor power consumption on the plug, so when power > 10 watts and use that to monitor all TV usage…

I don’t think this app keeps a track of daily usage… but I think it logs sessions…

There are other ways also… there is an app that can log activity to a google spread sheet… I guess you could use that also?

@jgravert Glad to know it’s still working and being used!

I will take a look - it’s certainly a very interesting app. I’m just totally incapable of anything but the most basic editing of apps, so if it’s too far in the wrong direction for what I’m after then I don’t have the skills to edit it!

I’ll report back with how I get on - thanks!

ok so quick question. I think i can set this up to do what I want.

I have an ‘activity’ on my Harmony remote which the kids will use to turn on the TV for Netflix. This can listed in ST and shows up as an on/off, which I’ve put in the advanced settings>‘switch to control’.

I thought that when that was on, the timer would start counting, but of course i’ve completely ignored the whole PIN thing. Do I need to install some kind of virtual device that pretends to be a keypad that has entered a particular code? Is that what triggers the activity? What could I do in its place - I’m not setting different users etc, they watch it together.

I just want that when they turn on their “kids netflix” activity on Harmony, it starts the app counting, and the app then turns that off after the preset time. Is that possible? thanks.

It doesn’t quite work like that…

The “switch to control”, when a successful PIN is entered then this switch is turned on…

You could get it to turn on netflix I guess, but there would be nothing to stop the child from using the remote? Also if they turned off the TV at the TV then this would not turn off the netflix activity and would then not stop the timer… this is why we use a power outlet that can monitor power usage, I could do something to manually trigger the start with a virtual switch perhaps?

However… just checked the code and what you are looking for already exists… click the “Debug Logging” option and this will give you and option to add a switch… you will then need to create a user called “Test” and that user will respond to the switch rather than PIN :slight_smile: