Author |
|
smarty Super User
Joined: May 21 2006 Location: United States
Online Status: Offline Posts: 728
|
Posted: December 26 2016 at 09:12 | IP Logged
|
|
|
So, Santa brought me a new Roku stick for Christmas.
In looking over the SDK ECP (external control protocal section here:), It looks like there are some neat things that can be done.
So far I have been able to use the ph_getitcurl() function to retrieve information like:
ph_getitcurl("http://192.168.0.81:8060/query/apps",10)
I have also been able to send commands with the ph_posturl1() function like this:
ph_posturl1("http://192.168.0.81:8060/launch/23048","",0,10)
or
ph_posturl1("http://192.168.0.81:8060/keypress/home","",0,10 )
For the heck of it, I then searched the PH forum to see if "Roku" was ever discussed (I didn't recall any discussions), but then I found this:
Posted: July 22 2014 at 09:22 | IP Logged Quote dhoward
lizaoreo,
Excellent! Glad to hear its working.
The classname for the Roku plugin should be PH_Roku.phroku. The classname for the Growl plugin should be PH_Growl.phgrowl.
I was pretty sure the Growl plugin had a readme file with it (in the plugins directory) but I'll have to verify it when I get home. The Roku plugin is probably not yet documented so I'll work that up and post as well.
Dave.
Sure enough, there was a Roku plugin in the PH plugin folder.
Question is, what is the documentation of this plugin? That I didn't find. How are others using PH to control their Roku (I have some ideas, but just curious what others may be doing)?
Merry Christmas and Happy New Year to all!
__________________ Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: December 26 2016 at 11:42 | IP Logged
|
|
|
Merry Christmas Steve!
Since you've already found the SDK ECP for the Roku,
most of the commands have been implemented in the Roku
plugin.
To get going, you'll create a new plugin ID (I'll use
ROKU for my examples below) with a classname of:
PH_Roku.phroku. Set the Init Data field to the IP of
your Roku stick (192.168.0.81 from what you posted
above).
Restart or reinit PowerHome for the plugin to take
effect.
Afterwards, you can send commands to the plugin using
the ph_picmd function. I use a timeout value of 2
seconds. Set the CMD, DATA1, and DATA2 parameters to
0. The DATA3 can be any of the following:
keyup, keydown, keypress, launch, saveicon, applist
Most of those should be self-explanatory if you've
reviewed the SDK.
When using "keyup","keydown", or "keypress", the DATA4
parm should be the key you want to send. Valid values
are:
home, rev, fwd, play, select, left, right, up, down,
back, instantreplay, info, backspace, search, and
enter. You can also place the letters a thru z and the
numbers 0 thru 9, space etc.
For "applist", the DATA4 parameter will be empty ("")
and the function will return the XML listing the apps
and the app number within the Roku.
For "saveicon", the DATA4 parm will be the app number
followed by a tab (~t) followed by the full path and
filename you want the graphic saved to. This is good
to save the Roku graphics and then use later for
designing in your Control Center.
For "launch", the DATA4 parm will the app number you'd
like to launch.
Examples:
ph_picmd(2,"ROKU",0,0,0,"applist","")
ph_picmd(2,"ROKU",0,0,0,"saveicon","12~tc:\powerhome\w
eb\graphics\icons\netflix.png")
ph_picmd(2,"ROKU",0,0,0,"launch","12")
ph_picmd(2,"ROKU",0,0,0,"keypress","right")
ph_picmd(2,"ROKU",0,0,0,"keypress","select")
ph_picmd(2,"ROKU",0,0,0,"keypress","a")
ph_picmd(2,"ROKU",0,0,0,"keypress","b")
ph_picmd(2,"ROKU",0,0,0,"keypress","5")
ph_picmd(2,"ROKU",0,0,0,"keypress","%20") - This will
send the space character.
Hope this helps with your new toy.
Dave.
|
Back to Top |
|
|
|
|