Timed Stop - Sleep

Here’s another command you can use to control Channels tvOS directly:

curl -XPOST http://appletv.local:57000/api/stop

2 Likes

Interesting. What other API commands are there? Are they documented anywhere?

They are undocumented, private and subject to change at any time. :slight_smile:

I suspected as much. :grinning:

Except for STOP which was made public and documented here? :grimacing:

Where did we land on this? Is this feature still be considered? Possibly on the product roadmap? If not, did anyone come up with a work around that is more elegant than the home bridge solution? Nothing against the work around, just checking. Wife loves falling asleep with the TV and therefore we can’t get rid of the TV remote. If we had sleep, only Apple TV remotes all around. Thanks

This is on the roadmap, but no ETA at this time.

Is the roadmap published somewhere?

Nope sorry.

1 Like

Thanks for the reply. Glad to know this is still being thought of.

1 Like

I tried this command with ip address and hostname.local and I get an error:

curl -XPOST http://192.168.7.36:57000/api/stop
“curl: (7) Failed to connect to 192.168.7.29 port 57000: Connection refused”

Do I need to authenticate first? I am on the machine where the DVR software is running.

Sounds like either that is not the IP of your ATV, or the Channels app is not running.

1 Like

It was the channel app on appletv was not running.

Any ideas on why I get this error?
PS C:> curl -XPOST http://192.168.1.28:57000/api/stop
Invoke-WebRequest : A parameter cannot be found that matches parameter name ‘XPOST’.
At line:1 char:6

  • curl -XPOST http://192.168.1.28:57000/api/stop
  •  ~~~~~~
    
    • CategoryInfo : InvalidArgument: (:slight_smile: [Invoke-WebRequest], ParameterBindingException
    • FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

On windows PowerShell, use:

iwr -usebasicparsing -method post http://192.168.1.28:57000/api/stop

It’s been over a year and a half, has no one come up with a better solution than the homebridge work around??

Hey everyone. We just released the Channels API.

This should make scripting the Channels app a little easier to do things like what the Homebridge hack above does. I know it’s not the same as having a sleep timer inside the app, but it’s at least accomplishable easier.

Also, instead of setting a sleep timer every night you watch, you could create an automation to just attempt to stop Channels every night at a specific time of night. Set it and forget it!

Also a native Homebridge plugin will be made available sometime soon, so you’d be able to do this even easier with Homebridge.

A Home Assistant media player is already in the core of Home Assistant and will be available with it’s next release. Using Home Assistant, you can do ALL KINDS of cool stuff with Channels really easily, including stopping playback when your TV turns off.

You can learn more here:

Channels API: https://getchannels.com/api
Community Announcement: Channels HTTP API

Thank you! I’m excited to play with this!

Does anyone do this? Does it work well?

Would be nice to have that just in the settings...
stop playback x hours and x minutes after last interaction...
really nice would be an optical warning 10 Minutes before switching of...
of course I could fiddle with homekit and external automation... i just want to not wake up to a running TV after going to sleep when watching tv...