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.
Trigger Event From external URL call by Kodi
Trigger Event From external URL call by Kodi
I am trying to integrate this new Kodi plugin called Sleep. Its like a TV Timer to shut down my equipment after a set time. The developer implemented an option to call a URL after the sleep timer goes off. I'm trying to figure out what I need in Eventghost to capture this event? Can I use just the network receiver or am I better off with the webserver plugin?
If I have to use the webserver how do I implement it so that just calling a page on the webserver triggers the event, so that no clicking is required on the webpage?
The Kodi addon implements this line of Kodi to make the URL request urllib.urlretrieve(url)
here is a link to the github page of the addon
Any help with this would be much appreciated.
If I have to use the webserver how do I implement it so that just calling a page on the webserver triggers the event, so that no clicking is required on the webpage?
The Kodi addon implements this line of Kodi to make the URL request urllib.urlretrieve(url)
here is a link to the github page of the addon
Any help with this would be much appreciated.
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Trigger Event From external URL call by Kodi
webserver plugin would be the way to go.
and it looks as tho you can change the URL maybe from inside Kodi???
doesn't matter at any rate it can be changed in the code
this is a piece of the Kodi sleep timer where it's doing the URL thing
fp, h = urllib.urlretrieve(url)
this line here can be changed to send a command to trigger an event using the webserver very easily
as long as you want to keep the webserver unsecured
or the code can be modified to send a UDP broadcast and you can pickup on the broadcast using the broadcaster plugin
and it looks as tho you can change the URL maybe from inside Kodi???
doesn't matter at any rate it can be changed in the code
Code: Select all
url = Settings.getShutdownURL()
if url in [None, ""]:
log("Sleep: Shutdown URL not set")
else:
log("Sleep: Calling shutdown url %s" % url)
try:
# Call the url, we don't care about the response
fp, h = urllib.urlretrieve(url)
log(h)
except:
fp, h = urllib.urlretrieve(url)
this line here can be changed to send a command to trigger an event using the webserver very easily
as long as you want to keep the webserver unsecured
or the code can be modified to send a UDP broadcast and you can pickup on the broadcast using the broadcaster plugin
Re: Trigger Event From external URL call by Kodi
Thanks for the reply. I can set the URL to anything I like from within the settings interface of the Addon in Kodi. I figure my URL I provide the addon in Kodi would be something like "http://127.0.0.1/<some html page>".
Now what would I need to do to do on the webserver plug-in side to get it to capture this url call from Kodi?
Also what are your concerns with the security of the webserver? I plan on only having the local install of Kodi to access Eventghost webserver on the same machine.
Now what would I need to do to do on the webserver plug-in side to get it to capture this url call from Kodi?
Also what are your concerns with the security of the webserver? I plan on only having the local install of Kodi to access Eventghost webserver on the same machine.
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Trigger Event From external URL call by Kodi
well then it should be simple
all you have to do is create a folder somewhere that you can keep it because you will have to point the webserver plugin to it. and in that folder create a text text document (empty file) and rename the file to index.html
then install the webserver plugin and point it to the folder you just made. make sure the username and password fields are blank and don't change anything else
well you can change the port to whatever you want. just make not of it
and in the sleep plugin for kodi change the URL to this
this is an example but you will be able to understand it easily
change the that are surrounded by **
the last one the payload you can remove it is not needed you have to remove the & with it if you do not want to use it. the purpose for it is in writing scripts mainly but make sure you have the ? after the index.html
and that's it
should take all of about 2 minutes for you to set up.
the call to urllib in the sleep plugin should work fine the way it is
that will trigger an event in eventghost for you
make sure you have the port you set open in windows firewall
all you have to do is create a folder somewhere that you can keep it because you will have to point the webserver plugin to it. and in that folder create a text text document (empty file) and rename the file to index.html
then install the webserver plugin and point it to the folder you just made. make sure the username and password fields are blank and don't change anything else
well you can change the port to whatever you want. just make not of it
and in the sleep plugin for kodi change the URL to this
this is an example but you will be able to understand it easily
Code: Select all
http://localhost:**WHATEVERPORTYOUENTERED**/index.html?**TESTEVENT**&**TESTPAYLOAD**
the last one the payload you can remove it is not needed you have to remove the & with it if you do not want to use it. the purpose for it is in writing scripts mainly but make sure you have the ? after the index.html
and that's it
should take all of about 2 minutes for you to set up.
the call to urllib in the sleep plugin should work fine the way it is
that will trigger an event in eventghost for you
make sure you have the port you set open in windows firewall
Re: Trigger Event From external URL call by Kodi
I don't know if it's the same thing, but I don't even use the index file with the webserver plugins for my EG triggers. Just something like:
http://192.168.0.12:8082/?YourEventNameHere
gives me an event.
On a side note, I use it in the LUUP code bit of Vera scenes with:
local status, result = luup.inet.wget("http://192.168.0.14:8083/?YourEventNameHere", 5)
to trigger EventGhost when something happens on the Vera, but of course your plugin renders that obsolete.
http://192.168.0.12:8082/?YourEventNameHere
gives me an event.
On a side note, I use it in the LUUP code bit of Vera scenes with:
local status, result = luup.inet.wget("http://192.168.0.14:8083/?YourEventNameHere", 5)
to trigger EventGhost when something happens on the Vera, but of course your plugin renders that obsolete.
Re: Trigger Event From external URL call by Kodi
Thanks guys for the How-To. I'll try it out later tonight and will report back.
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Trigger Event From external URL call by Kodi
sure thing let us know if it works
K
K
Re: Trigger Event From external URL call by Kodi
OK so I finally got back from my vacation and just set this up and it worked. Thanks everyone for showing me the ropes. Now I can do a lot of things
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Trigger Event From external URL call by Kodi
Well of course it worked.. LOLTalguy wrote:OK so I finally got back from my vacation and just set this up and it worked. Thanks everyone for showing me the ropes. Now I can do a lot of things
Just kidding
Thats why we help. I know personally if I can make someone else's life just a little bit easier and save them a hand full of hair. That makes it all worth it and makes me happy. I don't know why people say they are doing this to help others. Me hell no I do this to make me happy. And helping others is a result of me trying to give myself a better day.
LOL
But seriously I am glad it has worked. If there is any other questions or problems you have please feel free to either post in the forum or PM me personally and if it is something I do not have the answer to I will do my best to find a solution.
K
Re: Trigger Event From external URL call by Kodi
kgschlosser wrote: Thats why we help. I know personally if I can make someone else's life just a little bit easier and save them a hand full of hair. That makes it all worth it and makes me happy. I don't know why people say they are doing this to help others. Me hell no I do this to make me happy. And helping others is a result of me trying to give myself a better day.
K
Such a great attitude
- kgschlosser
- Site Admin
- Posts: 5190
- Joined: Fri Jun 05, 2015 5:43 am
- Location: Rocky Mountains, Colorado USA
Re: Trigger Event From external URL call by Kodi
I don't know if that is sarcasm or not but either way I'm ok with it.

