Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Sending HTTP command as Action
Sending HTTP command as Action
Without writing scripts or programming, does there already exist in EventGhost the capability to send an HTTP command? An example is "http://10.10.1.52:8080/remote/processKe ... d=keyPress", a DirecTV SHEF command. Is there a simple way to send this without using a browser window? There will be a short text response sent back (JSON) which I don't need to do anything with. Thanks very much for your expertise.
Re: Sending HTTP command as Action
Not that I know of but you could easily add a python script
import urllib
urllib.urlopen('http://10.10.1.52:8080/remote/processKe ... d=keyPress')
but if you don't want to do scripting then I guess you're out of luck.
import urllib
urllib.urlopen('http://10.10.1.52:8080/remote/processKe ... d=keyPress')
but if you don't want to do scripting then I guess you're out of luck.
Re: Sending HTTP command as Action
Thanks very much for the pointer. It's not that I don't want to do scripting, it's just that I'm clueless about Python. I'm willing to put in the time to try to figure it out, I just don't know if I'll get there. Would your example work as a Python command rather than a Python script?
Re: Sending HTTP command as Action
It appears that the answer is yes! The syntax to get it on one line is:kkl wrote:Would your example work as a Python command rather than a Python script?
import urllib; urllib.urlopen('http://10.10.1.52:8080/remote/processKe ... d=keyPress')
Now I'll have to see if I can figure out how to do a plugin.
Re: Sending HTTP command as Action
I am looking for a solution for this too. let me know if you find a compatible plugin, or if you make one!
I am going to start looking into it too
I am going to start looking into it too
Re: Sending HTTP command as Action
I tried for awhile but just couldn't figure out how to make a plug-in. However, I was able to use Python commands to do everything I needed. The syntax above does work. I put the following single Python commands in the Autostart section:
import urllib
dtv2 = "http://10.10.1.52:8080/remote/processKey?key="
dtv2 is a variable that has my HR24's IP address and the syntax for DirecTV's SHEF command that emulates the remote control. I then created macros for each keypress that contains another Python command. Example:
urllib.urlopen(dtv2 + 'pause')
This will send the pause command to my receiver. It can be triggered by any EG event that you specify. It took awhile to type in all of the commands, so I will post the EG XML code to save typing for others. You can copy and paste this to the appropriate section of your EG XML file.
import urllib
dtv2 = "http://10.10.1.52:8080/remote/processKey?key="
dtv2 is a variable that has my HR24's IP address and the syntax for DirecTV's SHEF command that emulates the remote control. I then created macros for each keypress that contains another Python command. Example:
urllib.urlopen(dtv2 + 'pause')
This will send the pause command to my receiver. It can be triggered by any EG event that you specify. It took awhile to type in all of the commands, so I will post the EG XML code to save typing for others. You can copy and paste this to the appropriate section of your EG XML file.
Code: Select all
<Folder Name="DirecTV SHEF - DTV2 - Family Room" Expanded="True">
<Macro Name="power" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'power')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'power')")
</Action>
</Macro>
<Macro Name="poweron">
<Action Name="urllib.urlopen(dtv2 + 'poweron')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'poweron')")
</Action>
</Macro>
<Macro Name="poweroff" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'poweroff')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'poweroff')")
</Action>
</Macro>
<Macro Name="format" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'format')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'format')")
</Action>
</Macro>
<Macro Name="pause" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'pause')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'pause')")
</Action>
</Macro>
<Macro Name="rew" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'rew')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'rew')")
</Action>
</Macro>
<Macro Name="replay" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'replay')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'replay')")
</Action>
</Macro>
<Macro Name="stop" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'stop')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'stop')")
</Action>
</Macro>
<Macro Name="advance" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'advance')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'advance')")
</Action>
</Macro>
<Macro Name="ffwd" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'ffwd')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'ffwd')")
</Action>
</Macro>
<Macro Name="record" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'record')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'record')")
</Action>
</Macro>
<Macro Name="play" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'play')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'play')")
</Action>
</Macro>
<Macro Name="guide" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'guide')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'guide')")
</Action>
</Macro>
<Macro Name="active" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'active')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'active')")
</Action>
</Macro>
<Macro Name="list" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'list')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'list')")
</Action>
</Macro>
<Macro Name="exit" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'exit')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'exit')")
</Action>
</Macro>
<Macro Name="back" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'back')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'back')")
</Action>
</Macro>
<Macro Name="menu" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'menu')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'menu')")
</Action>
</Macro>
<Macro Name="info" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'info')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'info')")
</Action>
</Macro>
<Macro Name="up" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'up')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'up')")
</Action>
</Macro>
<Macro Name="down" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'down')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'down')")
</Action>
</Macro>
<Macro Name="left" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'left')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'left')")
</Action>
</Macro>
<Macro Name="right" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'right')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'right')")
</Action>
</Macro>
<Macro Name="select" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'select')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'select')")
</Action>
</Macro>
<Macro Name="red" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'red')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'red')")
</Action>
</Macro>
<Macro Name="green" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'green')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'green')")
</Action>
</Macro>
<Macro Name="yellow" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'yellow')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'yellow')")
</Action>
</Macro>
<Macro Name="blue" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'blue')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'blue')")
</Action>
</Macro>
<Macro Name="chanup" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'chanup')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'chanup')")
</Action>
</Macro>
<Macro Name="chandown" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'chandown')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'chandown')")
</Action>
</Macro>
<Macro Name="prev" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'prev')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'prev')")
</Action>
</Macro>
<Macro Name="0" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '0')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '0')")
</Action>
</Macro>
<Macro Name="1" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '1')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '1')")
</Action>
</Macro>
<Macro Name="2" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '2')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '2')")
</Action>
</Macro>
<Macro Name="3" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '3')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '3')")
</Action>
</Macro>
<Macro Name="4" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '4')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '4')")
</Action>
</Macro>
<Macro Name="5" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '5')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '5')")
</Action>
</Macro>
<Macro Name="6" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '6')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '6')")
</Action>
</Macro>
<Macro Name="7" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '7')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '7')")
</Action>
</Macro>
<Macro Name="8" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '8')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '8')")
</Action>
</Macro>
<Macro Name="9" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + '9')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + '9')")
</Action>
</Macro>
<Macro Name="dash" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'dash')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'dash')")
</Action>
</Macro>
<Macro Name="enter" Expanded="True">
<Action Name="urllib.urlopen(dtv2 + 'enter')">
EventGhost.PythonCommand(u"urllib.urlopen(dtv2 + 'enter')")
</Action>
</Macro>
</Folder>
- jitterjames
- Experienced User
- Posts: 677
- Joined: Thu Aug 13, 2009 4:36 pm
- Location: Quebec, Canada
- Contact:
Re: Sending HTTP command as Action
AFAIK a python script is exactly the same as a python command but you can put multiple lines to get multiple commands.
It is easier to use and doesn't clog up your tree so much so I suggest you try it. The only advantage that I can see to using a command over a script, is that you can see the command text in the tree, so if that is important to you then stick with commands.
It is easier to use and doesn't clog up your tree so much so I suggest you try it. The only advantage that I can see to using a command over a script, is that you can see the command text in the tree, so if that is important to you then stick with commands.
