HTTP call in response to a trigger?


#1

Um… I don’t think I’m using WebCoRE yet - just regular CoRE - maybe I need to switch? But…

Need some basic guidance: How can I make an HTTP call in response to a trigger?

I’d like to make an http call with a temperature update whenever a temperature changes. Something like

IF
    Temp Changes (I can create this trigger)
THEN
    Send HTTP://adress.php/[static text][Temp][static text]

Can I do that in a Piston? Do I need WebCoRE?


#2

definitely. :slight_smile: more powerful and easier to build pistons in a full size browser window than in a smartapp.

if you already know how to do the trigger in webcore, then you should be able to do a http request pretty easily as well. under the then:

  1. click add a new statement
  2. click add an action
  3. click add a task
  4. from the please select a command drop down select make a web request

once you are there the url/params should be familiar if you are used to html coding. if not, just ask.

the pistons are also called pistons in webcore, just easier to build and maintain. :slight_smile:


How do I Make a "Get" request
#3

Boy were you right! webCoRE rocks!


#4

Ok, I am jumping into deep water here. I am slowly learning webcore. I use webcore to interface with Kodi, my audio player. I can Play Track and supply the URL for the song and Kodi will play it. I want to do the same for a playlist. But as far as I know, webcore does not have a Play Playlist. So I was thinking about trying a Make A Web Request and pass the name of the playlist to Kodi to play. If that is possible, I would love some assistance with the code.


#5

If you can call the play list via a URL from a browser or curl then it might be possible to do it via webcore.

Got an example URL?


#7

The URL is : \OSMC\osmc.kodi\userdata\playlists\music\Vocal Trance.xsp

It gives me the following response from my browser :


Of course, it is in the Smart Playlist format used by Kodi. If I can somehow pass the playlist name, Vocal Trance.xsp, to the Kodi slot AudioPlaylist, then Kodi SHOULD play it with a Play command.


#8

I think there is something out there that already works with kodi or an ST integration that someone created… can’t place it at the moment but let me do some searching so we don’t have to reinvent the wheel lol


#9

I admit, I do not know much about how to pass a playlist file name from webcore to kodi.

I did find this. I thought this might help…https://kodi.wiki/view/JSON-RPC_API/Examples


#10

So I finally figured out how to use JSON RPC to interface with Kodi to pass a playlist name :

http://192.168.xxx.xxx:xxxx/jsonrpc?request={“jsonrpc”:“2.0”,“id”:“1”,“method”:“Player.Open”,“params”:{“item”:{“file”:“special://profile/playlists/music/Christian.xsp”}}}

It took me a while to realize that the URI for files within OSMC use “profile” in the path. Especially since I was sure my path was :

OSMC/osmc/.kodi/playlists/music/xxx.xsp

Now I have to figure out how to code that JSON into webcore…