Sending strings to a webserver

If you have a question or need help, this is the place to be.
jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Sending strings to a webserver

Post by jachin99 » Wed Sep 19, 2018 7:44 pm

I am trying out a program designed to control Windows Media Center, and to some extent Windows itself over TCP IP. From the MCE Controller's GitHub page, "MCE Controller lets you control a Windows HTPC (or any PC) over the network. It runs in the background listening on the network (or serial port) for commands. It then translates those commands into actions such as keystrokes, text input, and the starting of programs. Any remote control, home control system, or application that can send text strings via TCP/IP or a serial port can use MCE Controller to control a Windows PC"

With that out of the way, I haven't found a good plugin that interacts with this web server just yet. For learning purposes, I was able to connect to the webserver via telnet (Using the loopback address) and send it a few commands just to verify I was formatting them correctly. When I tried to do the same via the network event sender, I was able to read in MCEController's log that it was receiving data but it wasn't getting anything the program recognized. MCEController just reads Cmd Unknon Cmd: quintessence. I thought about trying to send it telnet commands via python script but I would rather avoid telnet altogether, and find a plugin where I just input the needed string and WMC acts accordingly. What plugin should I use.

Here is the homepage: https://github.com/tig/mcec/wiki/Documentation thanks

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Sending strings to a webserver

Post by yokel22 » Wed Sep 19, 2018 9:47 pm

I believe the webserver plugin should work for you. I'm not in front of a pc, but I think the action you want is something like "send to other webserver"

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Wed Sep 19, 2018 9:52 pm

That's what I suspected, and I'll try it out thanks!!

User avatar
kgschlosser
Site Admin
Posts: 4582
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sending strings to a webserver

Post by kgschlosser » Wed Sep 19, 2018 10:55 pm

I think that someone made an SSH plugin. I would imagine you can use this since SSH and Telnet are the same thing except one has encryption and one does not. I do not know if you have the ability to disable the encryption in the SSH plugin. but maybe.

or you can use realterm and com0com to set up a telnet to virtual serial loop. There are other all in one apps to do this but i think they all have trial periods. Then you can use the serial plugin to do the EG bits. That's if the SSH plugin does not allow you to disable the encryption.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Thu Sep 20, 2018 12:10 am

Yokel, is your webserver demo compatible with EG 5RC4? I have had the webserver plugin running at one point but I can't remember what version of EG I was on, and which webserver plugin I used.

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Thu Sep 20, 2018 2:22 am

kgschlosser wrote:
Wed Sep 19, 2018 10:55 pm
I think that someone made an SSH plugin. I would imagine you can use this since SSH and Telnet are the same thing except one has encryption and one does not. I do not know if you have the ability to disable the encryption in the SSH plugin. but maybe.

or you can use realterm and com0com to set up a telnet to virtual serial loop. There are other all in one apps to do this but i think they all have trial periods. Then you can use the serial plugin to do the EG bits. That's if the SSH plugin does not allow you to disable the encryption.
I would rather use SSH but my end goal is to send it commands via the webserver component. I don't think its compatible. I'm likely going to end up requesting at least one additional feature for it, and I want to be armed with as much proficiency at this as possible before I do so. MCE controller is actually a fork of another program called vistacontroller or something similar that would broadcast events as well but it doesn't seem to be a part of this. I need a way to get things like pause, play, etc. from WMC into the EG log and I would prefer to get the media state (paused, stopped, play) from WMC itself rather than relying on remote presses. I'll need it to control lights at least.

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Thu Sep 20, 2018 12:15 pm

I tried out the webserver but I still get unknown command errors. Are all of the commands sent via the webserver plugin in JSON format? Reading some of the macros included with the webserver, I see a few to remove JSON formatting, which is what is leading me to this question.

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Sending strings to a webserver

Post by yokel22 » Thu Sep 20, 2018 4:30 pm

Yes, demo should work with any version of eg. If you get an error, try installing most current webserver plugin.

When sending data. It's json formatted (python dictionary) . It requires an indent in front of the data though (4 spaces) . I'm not sure why this is, but it will throw an error if you don't indent it. Can you post an example of the data that was working for you?
*edit* After looking at the docs for this. It looks like what you really want here is the TCPIP plugin. Have you tried it yet? *edit*

Pako did a ssh plugin for the raspberry pi. Should work for any ssh client. Search for pi in the plugin forum.

User avatar
kgschlosser
Site Admin
Posts: 4582
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sending strings to a webserver

Post by kgschlosser » Thu Sep 20, 2018 7:33 pm

I mentioned the SSH plugin because you mentioned the use of Network Event Sender. which is keyed to only be able to be used with Network Event Receiver. It functions very similar to Telnet. SSH is a variant of Telnet that has encryption.
If you like the work I have been doing then feel free to Image

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Thu Sep 20, 2018 8:03 pm

I got it figured out :D It turns out there was an eventghost plugin for a VMC Controller (MCE controller is a fork of this), and THAT program included an event broadcasting service. I installed VMC controller on WIn 7, and Win 10, and the EG VMC Plugin still works with EG 5 RC4!! Now I get a stream of events from WMC in my EG log so I'm all set in that aspect. I just need to hook up all of my Zwave gear, get a few lights, and run the Zwave plugin, and I should all set. This was actually the biggest part of my whole setup so I'm pretty happy it all worked out. Thanks for the suggestions, and I still want to toy around with the web server but I can save that for another day.

Edit: I haven't figured out the command structure for VMC controller, or which commands to send to VMC via the EventGhost plugin but the most important part of this was to receive events. There are other programs to control WMC if absolutely neccessary however I'm still going to try and figure out how to use VMC exclusively for TCP/IP control. I have everything connecting, I just need to learn the right commands.

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Fri Sep 21, 2018 2:26 am

Here is a link to the EG thread about the VMC Controller plugin. viewtopic.php?f=9&t=911&start=15

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Fri Sep 21, 2018 2:43 am

I had to go to the web archive but here are the commands as of january 6 2011

button-rec - sends key to application
button-left - sends key to application
button-up - sends key to application
button-right - sends key to application
button-down - sends key to application
button-ok - sends key to application
button-back - sends key to application
button-info - sends key to application
button-ch-plus - sends key to application
button-ch-minus - sends key to application
button-dvdmenu - sends key to application
button-dvdaudio - sends key to application
button-dvdsubtitle - sends key to application
button-cc - sends key to application
button-pause - sends key to application
button-play - sends key to application
button-stop - sends key to application
button-skipback - sends key to application
button-skipfwd - sends key to application
button-rew - sends key to application
button-fwd - sends key to application
button-zoom - sends key to application
button-num-0 - sends key to application
button-num-1 - sends key to application
button-num-2 - sends key to application
button-num-3 - sends key to application
button-num-4 - sends key to application
button-num-5 - sends key to application
button-num-6 - sends key to application
button-num-7 - sends key to application
button-num-8 - sends key to application
button-num-9 - sends key to application
dvdrom <open|close> - Opens and closes the default dvd drive door
msgbox "caption" "message" <timeout seconds>
goto <ExtensibilityUrl|FMRadio|InternetRadio|LiveTV|ManageDisks|MovieLibrary|MorePrograms|MusicAlbums|MusicArtists|MusicSongs|MyMusic|MyPictures|MyTV|MyVideos|PhotoDetails|RecordedTV|RecorderStorageSettings|ScheduledTVRecordings|Slideshow|SlideshowSettings|Start|TVGuide|Visualizations|WebAddIn> <optional page parameters>
playrate <Stop|Pause|Play|FF1|FF2|FF3|Rewind1|Rewind2|Rewind3|SlowMotion1|SlowMotion2|SlowMotion3|SkipForward|SkipBack>
position <seconds>
fullscreen - moves the current media playback experience into full-screen mode
version - returns the version of MediaCenter
capabilities - returns a key value pair list of device capabilities
volume <0-50|Up|Down|Mute|UnMute>
play-audio <The URL of the audio to play>
play-video <The URL of the audio to play>
play-dvd <A string in the following format: //path? address> http://msdn2.microsoft.com/en-us/library/ms814628.aspx
play-radio <A string in the following format: band:nn.n or band:nn,n, depending on the locale. For example, "fm:103.1" or "fm:103,1". For band, only FM is currently supported>
play-tv <A string representing the call sign of the service to play, or channel number>
play-dvr <The URL of the video to play>
queueaudio <The URL of the audio to play>
schedule <recording|recorded|scheduled>
epg-lineup <all|channel,channel...>
epg-onnow <all|channel,channel...>
epg-details <all|channel,channel...>
window-close - sends command to Media Center Window
window-minimize - sends command to Media Center Window
window-maximize - sends command to Media Center Window
window-restore - sends command to Media Center Window
changer-load <Slot Address>

Beta 1 & 2 added: Exit - closes the connection (not useful via http) (note had to expost function CloseClient() to support)
mediametadata - returns information on the currently playing media (artist, title, album, etc - varries based on what is playing)
playrate-get - shows the current playrate of the currently playing media
playstate-get - shows the current playstate of the currently playing media
postition-get - shows the current position of the currently playing media
type - sends a string to the application
list-artists <filter>- returns a list of artists in the library (very slow - my 1K artists takes 1 minute to return)
list-artist-songs <filter | index> - returns a list of songs by a given artist (using the index returned by list-artists makes this fast)
list-artist-albums <> - returns a list of albums by a given artist (using the index returned by list-artists makes this fast)
list-albums <filter | index> - returns a list of songs by a given artist (using the index returned by list-artists makes this fast)
list-album-songs <filter | index> - returns a list of songs by a given artist (using the index returned by list-artists makes this fast)
list-all-custom
list-artist-custom
list-album-custom
list-song-custom
play-audio-artist <filter | index> - plays all songs by first matching artist (using the index returned by list-artists makes this fast)
play-audio-album <filter | index> - plays all songs on the specified album by index, or the first album by the first matching artist (using the index returned by list-artists makes this fast)
play-audio-song <filter | index> - plays the specified song by index, or the first song by the first matching artist (using the index returned by list-artists makes this fast)
queueaudio-artist <filter | index> - same as play, except adds to the queue
queueaudio-album <filter | index> - same as play, except adds to the queue
queueaudio-song <filter | index> - same as play, except adds to the queue

beta 3: added the music / photo commands: music-list-artists - lists matching artists
music-list-album-artists - lists matching album artists
music-list-albums - list matching albums
music-list-songs - list matching songs
music-list-details - lists info on matching songs / albums / artists
music-list-genres - list matching genres
music-list-recent - lists recently played / queued commands
music-play - plays matching songs
music-queue - adds matching songs to the now playing list
music-cover - serves the album cover of the first match
music-clear-cache - forces the cache to be cleared (normally only happens when the music library's length changes)
music-stats - lists stats (Artist / Album / Track counts, cache age, available templates, etc)
photo-clear-cache - Forces the index cache to reset (otherwise only resets when the number of photos changes)
photo-list - Lists all the matching images found in the photo collection
photo-play - list / play from photo collection
photo-queue - list / play from photo collection
photo-tag-list - Lists all the tags found in the photo collection
photo-serv - Serves the photo to a web browser (all filters apply, first or random matching image is returned)
photo-stats - Lists stats of the current querry (filters, counts, etc)

User avatar
yokel22
Experienced User
Posts: 265
Joined: Thu Feb 05, 2015 5:56 pm
Location: U.S. - Kansas city

Re: Sending strings to a webserver

Post by yokel22 » Fri Sep 21, 2018 12:50 pm

Cool. If I still recorded TV this would be pretty interesting to me. This seems to open pretty much every control WMC has. WMC was the most rock solid DVR I ever used. I may play around with this a bit & see if I can't get the formatting worked out.

jachin99
Experienced User
Posts: 580
Joined: Sat Feb 13, 2016 8:39 pm

Re: Sending strings to a webserver

Post by jachin99 » Fri Sep 21, 2018 3:29 pm

yokel22 wrote:
Fri Sep 21, 2018 12:50 pm
Cool. If I still recorded TV this would be pretty interesting to me. This seems to open pretty much every control WMC has. WMC was the most rock solid DVR I ever used. I may play around with this a bit & see if I can't get the formatting worked out.
If your still interested in WMC there is a group of new developers making improvements including dual live TV buffers so you can flip between channels and still rewind each one. I have dug up quite a few cool things to add to it so let me know. Hopefully I can setup a web page in EG to control it some day via a web browser and nice web page.

User avatar
kgschlosser
Site Admin
Posts: 4582
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Sending strings to a webserver

Post by kgschlosser » Fri Sep 21, 2018 4:10 pm

microsoft should just release the code for it as open source.
If you like the work I have been doing then feel free to Image

Post Reply