Sleep Timer

I’ve had a Smartthings hub for a few years now and have had pretty good luck finding smart apps to solve problems in automation. I currently have a harmony hub that is integrated with my smartthings. I’m interested in creating a scene or finding an app that I can use to set an 15-30 min Timer to shut down my TV after I’ve fallen asleep. I do realize that this option is available in both the Logitech app and as a one time use in the v3 smartthings app. Ideally I’d like to push a button to trigger this. I’ve found apps that offer something close to this but they trigger as soon as the harmony is used to turn the TV on. I’m also not looking to automate this in webcore as I’ve had very little luck using it. Any help is greatly appreciated. Thanks

Partially because I’m curious and partially because I want to track the topic… What will be the trigger that you’ve fallen asleep? Like, when you get in bed you push the button?

1 Like

Yes. I usually watch TV before going to sleep. I’m aware that there is an Alexa skill that allows me to say set a sleep timer, but my girlfriend usually falls asleep before me and I don’t want to whisper since I don’t want to wake her up. I’ve got a Ikea button that I’d like to use. For example I start watching TV at 9pm and around 10:30 I press the button to shut the tv, receiver, and led lights in 30 mins. I have the tv, receiver, and led lights on a harmony automation.

That’s easy. :sunglasses:

Just create a virtual switch to act as your timer, use the power allowance option in the official smartlighting feature to have that device always turn itself off after 30 minutes, And then create a scene that turns all the other devices off and have that scene activate when the virtual switch turns off.

Finally, have your button turn on the virtual switch (to start the timer).

That way you can still use all the other devices however you want to in other automations or voice controls. It’s only when you press the button that the timer will start.

There are other ways to do this as well Using the delay feature in the new app, but I’m not as familiar with those. Basically, though, you would have the button activate the scene that turns everything off, but delay the action by 30 minutes.

Hopefully someone more familiar than I am with the new V3 app can explain that method, because it’s likely even simpler than the virtual switch.

First of all thanks for the quick response, much appreciated. I did try the method that you suggested but my TV would just turn off every 30 mins. The smartlighting feature would see the tv on due to the harmony integration and just shut it off. So I’m back to square one.

This is why you want to create a virtual switch and use power allowance only on the virtual switch. That way you can still control your devices with any other method and they won’t turn off. You don’t use the 30 minute timer on your TV. You use it on the virtual switch.

There is a how to article in the community – created wiki that explains this method, but it’s old and examples are from the older app. It’s the same basic idea, though. So take a look at that and see if it helps.

https://thingsthataresmart.wiki/index.php?title=How_to_create_a_virtual_timer_for_a_light

If that doesn’t clear it up, then we will need to see screenshots of the automations that you are using so we can help you sort it out. :sunglasses:

Hello @X0mbie,

Using the Rules API is another good option, you just need to use an API test tool, like Postman.
The sample below has this workflow:

  1. IF the button is pushed
  2. THEN set a 30-minute timer to turn OFF the TV
{
    "name":"If button is pushed, set timer to turn the TV off",
    "actions": [
        {
            "if":{
                "equals": {
                    "left": {
                        "device": {
                            "devices": [
                                "device-id-button"
                            ],
                            "component": "main",
                            "capability": "button",
                            "attribute": "button"
                        }
                    },
                    "right": {
                        "string": "pushed"
                    }
                },
                "then":[
                    {
                        "sleep": {
                            "duration": {
                                "value": {
                                    "integer": 30
                                },
                                "unit": "Minute"
                            }
                        }
                    },
                    {
                        "command": {
                            "devices": [
                                "device-id-tv"
                            ],
                            "commands": [
                                {
                                    "component": "main",
                                    "capability": "switch",
                                    "command": "off"
                                }
                            ]
                        }
                    }
                ]
            }
        }
    ]
}

Complete the rule by placing the device IDs correctly, for more information, check this document.

Let me know if you have any doubts.