Looking for something to report recording status

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

Looking for something to report recording status

#1

Post by clemon79 » Tue Oct 04, 2016 6:25 am

I have been getting into home automation lately, and I've set up a Home Assistant server on a Raspberry Pi.

I have decided I would like for it to know when WMC is recording. I know there is that little icon in the tray that turns red when it's recording and green when it isn't, so clearly the state is tracked someplace, so if there is a way to get that state communicated out to Home Assistant I can then do things with that information.

So, is there some kind of 3rd party thing that will track that and report that information in a retrievable way?

Thanks much!

-- Chris

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#2

Post by clemon79 » Tue Oct 04, 2016 7:35 am

Correction: the red icon is there when recording and gone when it isn't. So maybe there's a way to poll for presence of that icon? Is it a running process of some kind?

webminster

Posts: 656
Joined: Tue Dec 20, 2011 11:05 pm
Location:

HTPC Specs: Show details

#3

Post by webminster » Tue Oct 04, 2016 11:08 pm

This is a little out there... but maybe using the Windows Media Center TCP/IP controller code, which provides a way for you to get status from the media center? https://vmccontroller.codeplex.com/

It says Vista, but I've had a recent version running on Windows 7 MC. Maybe you can do something with the status connection, connect a socket and watch for the recording indications... No idea if feasible or usable.
-Alan

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#4

Post by clemon79 » Wed Oct 05, 2016 1:17 am

Someone else mentioned that to me, and I agree that it's a possibility. I assure you're referring to the "schedule" command...the problem is, the documentation is pretty must nonexistent. I'm not sure how that command is issued or otherwise works.

....aaaaand it doesn't matter anyhow, because when I try to install the beta 2 (for HTTP), it throws an error and fails the install.

webminster

Posts: 656
Joined: Tue Dec 20, 2011 11:05 pm
Location:

HTPC Specs: Show details

#5

Post by webminster » Wed Oct 05, 2016 1:32 am

Was actually thinking more the socket (not HTTP) connection mode to the primary server/port, and seeing if you get the stream of events it supposedly sends. Like the "recording" event documented in https://msdn.microsoft.com/en-us/librar ... 2147217396

https://vmccontroller.codeplex.com/wiki ... umentation

Maybe if you can find /a/ version you can install (maybe https://vmccontroller.codeplex.com/releases/view/45909) you could use a telnet or netcat client to examine the stream and decode something useful.
Last edited by webminster on Wed Oct 05, 2016 1:38 am, edited 1 time in total.
-Alan

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#6

Post by clemon79 » Wed Oct 05, 2016 1:38 am

Well, unless I can somehow find Beta 1 (it seems the only download link is for Beta 2), it's not gonna matter anyhow, because Beta 2 won't install.

EDIT: Wait, I found it. Let's see if it will even install.

MOAR EDIT: Nope, that one craps out with the same error. Something about a problem during the "commit" phase.

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#7

Post by clemon79 » Wed Oct 05, 2016 1:58 am

Aha! 45909 worked. (I was just about to try it when I saw your post.) Now we see if I can figure out anything to do with it. :)

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#8

Post by clemon79 » Wed Oct 05, 2016 2:34 am

Hmm, this works and I can use URLs to make things happen. That's interesting. Unfortunately the "schedule" command seems to not be in this version. I'm not sure how to use what I have to get a status.

webminster

Posts: 656
Joined: Tue Dec 20, 2011 11:05 pm
Location:

HTPC Specs: Show details

#9

Post by webminster » Wed Oct 05, 2016 3:19 am

I thought from what you were asking you might use the status stream, as I mentioned above... that would tell you when recording started and stopped (and more). It wouldn't tell your the upcoming schedule, I don't know if it can. Another idea for that might be installing and reverse-engineering Ceton's MyMediaCenter server API, or even the Remote Potato server. Both sound like a hassle.
-Alan

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#10

Post by clemon79 » Wed Oct 05, 2016 3:25 am

Yeah, I gotta figure out how that stream works. It's too bad there doesn't appear to be an HTTP status command for that, because it seems like it would be pretty easy to poll it every few seconds and then trigger a switch-flip in Home Assistant when it's recording.

I have an SSH client, but I am not sure how to attach to that feed with it.

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#11

Post by clemon79 » Wed Oct 05, 2016 4:53 am

Okay, I managed to get connected. SO close. It sends a "Recording=True" when it starts recording. This is great! But does it send a "Recording=False" when it's done? Oh hells no, because that would make sense! :) Just sends "Stop=True" (which it sends basically any time any playback whatsoever is stopped, so that isn't useful) and an EndSession=## notice. So basically it's a combination of making a note of the session number that is generated when recording is started (which pops up in a StartSession=## notice the line BEFORE Recording=True) and then watch for "Stop=True" followed by the "EndSession=##" notice that correlates. WAY too much hassle. "Recording=False" would have been perfect. Dammit.

mikinho

Posts: 248
Joined: Thu Jun 16, 2011 5:23 am
Location:

HTPC Specs: Show details

#12

Post by mikinho » Tue Oct 18, 2016 7:09 pm

If you are still looking for a quick way to do this let me know and I'm sure I can do a quick thing for you.

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#13

Post by clemon79 » Tue Oct 18, 2016 7:19 pm

mikinho wrote:If you are still looking for a quick way to do this let me know and I'm sure I can do a quick thing for you.
Thanks! Yeah, I never did find a solution. I don't even really care about "which tuner is recording" (though maybe that's useful?)...I just want to be able to access whether WMC is currently recording SOMETHING or not so Home Assistant can use that information.

mikinho

Posts: 248
Joined: Thu Jun 16, 2011 5:23 am
Location:

HTPC Specs: Show details

#14

Post by mikinho » Tue Oct 18, 2016 7:22 pm

Its really easy to get that. Do you want a lock file (if file exists recording is in process) or a simple HTTP get that response with 200 for record or 404 for not recording?

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#15

Post by clemon79 » Tue Oct 18, 2016 7:30 pm

mikinho wrote:Its really easy to get that. Do you want a lock file (if file exists recording is in process) or a simple HTTP get that response with 200 for record or 404 for not recording?
The GET request I think would be easier for me to parse into something I could use with HASS. I think I just poll at intervals and can have it take action based on the result.

Curious, how are you getting it?

mikinho

Posts: 248
Joined: Thu Jun 16, 2011 5:23 am
Location:

HTPC Specs: Show details

#16

Post by mikinho » Tue Oct 18, 2016 7:43 pm

Directly from Media Center's guide data.

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#17

Post by clemon79 » Tue Oct 18, 2016 7:48 pm

mikinho wrote:Directly from Media Center's guide data.
Ah, ok, so basically you're checking the guide data to see if I've marked anything to be recorded at that time, the same way I would be doing the GET to see if it's reporting recording?

mikinho

Posts: 248
Joined: Thu Jun 16, 2011 5:23 am
Location:

HTPC Specs: Show details

#18

Post by mikinho » Tue Oct 18, 2016 7:51 pm

No, the guide data also includes tuner information. So you can query to see if any tuner is recording anything.

clemon79

Posts: 63
Joined: Wed Nov 13, 2013 6:59 am
Location:

HTPC Specs: Show details

#19

Post by clemon79 » Tue Oct 18, 2016 8:18 pm

mikinho wrote:No, the guide data also includes tuner information. So you can query to see if any tuner is recording anything.
So if you know how to parse it, it's pretty much just as easy to tell which ones are recording as it is to tell whether any of them are? Nice.

mikinho

Posts: 248
Joined: Thu Jun 16, 2011 5:23 am
Location:

HTPC Specs: Show details

#20

Post by mikinho » Tue Oct 18, 2016 8:24 pm

Yep. Just let me know and I can either include which is recording or just a simple yes it is recording type thing. I probably won't have time to do it today but I can knock it out tomorrow. Its not much at all.

Post Reply