INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Make MC compatible with Home Assistant  (Read 3357 times)

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Make MC compatible with Home Assistant
« on: December 28, 2023, 10:41:04 am »

This is a longstanding issue as originally reported in https://yabb.jriver.com/interact/index.php/topic,115440.msg798510.html#msg798510 and subsequently requested in https://yabb.jriver.com/interact/index.php?topic=130305.0

Home Assistant is increasingly popular and not being able to drive MC from HA due to some proprietary extension is not great.

One alternative is for someone to contribute a custom integration to HA to enable it to work with it directly, most other popular software equivalent to MC has been given this treatment so this could be an even better path

example -> https://github.com/home-assistant/core/tree/dev/homeassistant/components/roon

Logged

eve

  • Citizen of the Universe
  • *****
  • Posts: 689
Re: Make MC compatible with HomeAssistant
« Reply #1 on: December 28, 2023, 07:45:47 pm »

This is a longstanding issue as originally reported in https://yabb.jriver.com/interact/index.php/topic,115440.msg798510.html#msg798510 and subsequently requested in https://yabb.jriver.com/interact/index.php?topic=130305.0

Home Assistant is increasingly popular and not being able to drive MC from HA due to some proprietary extension is not great.

One alternative is for someone to contribute a custom integration to HA to enable it to work with it directly, most other popular software equivalent to MC has been given this treatment so this could be an even better path

example -> https://github.com/home-assistant/core/tree/dev/homeassistant/components/roon

My solution is running a service that 'intelligently' polls MC to deal with state / file metadata. This way I get a nice REST interface (with some massaging to deal with things like 'tracks' in video) providing JSON responses. The playback position gets spat out via websocket too since that's sometimes more useful than polling in applications.
I then have some wrappers around MCWS functions / playback controls and a bunch of queue management shenanigans. Besides that, it handles dealing with multiple systems running MC, through a single point of entry for me (so I can control / access a device and zone by names or ids, which are tied to the rest of my control system)



+1 though.

I love HA. Been using it a long time. I outgrew it for media and the actual UI. My media stuff is too complex to rely on HA however. I ended up building my own frontend for some of the smart home stuff but like, as a 'get all your devices talking' platform it's fantastic. I used to take advantage of NodeRED for a bunch of the device stuff to talk to HA but I've gradually replaced those things with actual code. Still awesome for mocking things up.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #2 on: December 29, 2023, 03:28:20 am »

yes I have similar apps (polls and broadcasts via ws, custom UI) but the 1st one is just covering a gap in MC itself, having to write an app just to avoid clients having to poll for updates is a pretty unfriendly, and the latter predates panel and does some other stuff so I kept with it.

to be clear, compatible doesn't mean "replace panel" or build some really complex integration, it's just a simple media control like play/pause/next/prev and so on that one can drop in amongst other stuff on a page as a simple control to interact with MC. At present, as far as I can see, the only thing that actually works is changing volume and mute (but unmute doesn't work). Browsing = fail, any playback control = fail.
Logged

Striker

  • World Citizen
  • ***
  • Posts: 176
Re: Make MC compatible with HomeAssistant
« Reply #3 on: December 29, 2023, 10:39:18 am »

yes I have similar apps (polls and broadcasts via ws, custom UI) but the 1st one is just covering a gap in MC itself, having to write an app just to avoid clients having to poll for updates is a pretty unfriendly, and the latter predates panel and does some other stuff so I kept with it.

to be clear, compatible doesn't mean "replace panel" or build some really complex integration, it's just a simple media control like play/pause/next/prev and so on that one can drop in amongst other stuff on a page as a simple control to interact with MC. At present, as far as I can see, the only thing that actually works is changing volume and mute (but unmute doesn't work). Browsing = fail, any playback control = fail.

I get full playback control using MC30.exe (or whatever version you use).

I use the old unsupported PlayingNow plugin to notify me when the track changes and the current and next track info.

Unfortunately... I believe JRiver now owns the rights to PlayingNow but has never updated or re-released it.  For that reason, I can't use the 64bit version of MediaCenter.

I've asked many times for JRiver to update the PlayingNow plugin.  There may be a very good reason JRiver has not done this, but they have never explained why.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #4 on: December 29, 2023, 11:15:09 am »

I get full playback control using MC30.exe (or whatever version you use).
you get full control in HA?
Logged

Striker

  • World Citizen
  • ***
  • Posts: 176
Re: Make MC compatible with HomeAssistant
« Reply #5 on: December 29, 2023, 11:18:08 am »

you get full control in HA?

Sorry I may not have explained it well.  I don't use HomeAssistant but I do have an elaborate home automation system using HomeVision (discontinued).  When I want to control MC externally, I have my home automation system call MC30.exe to do the control.

MCxx.exe is very powerful.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #6 on: December 29, 2023, 05:36:38 pm »

Yes sure, mcws is capable of many things but that's totally missing the point which is that it shouldn't mean that every user has to design their own custom integration ( just to be able to use a basic media browser/playback control)
Logged

mbagge

  • Galactic Citizen
  • ****
  • Posts: 255
Re: Make MC compatible with HomeAssistant
« Reply #7 on: January 01, 2024, 10:54:07 am »

As a happy MC user since version 8, I am also struggling with the integration with Home Assistant. HA has a DLNA integration that works just fine with many other dlna enabled devices but just not MC. You can stop playing a song but for some reason you cannot start playing the song again. It seems as if there are many flavors of dlna and MC has its own.
Are there any way to configure MC dlna to be compliant with other flavors of dlna ?
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #8 on: January 01, 2024, 12:36:26 pm »

Are there any way to configure MC dlna to be compliant with other flavors of dlna ?
as far as I know, not possible

I've started implementing an integration specifically for MC that uses MCWS, you can try it out once I get it working if you like
Logged

mbagge

  • Galactic Citizen
  • ****
  • Posts: 255
Re: Make MC compatible with HomeAssistant
« Reply #9 on: January 02, 2024, 04:07:49 am »

sure I will  :)
Do you have a github project to follow ?
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #10 on: January 02, 2024, 04:59:01 am »

Not yet, will start a thread when there is something functional to share
Logged

hoyt

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 867
Re: Make MC compatible with HomeAssistant
« Reply #11 on: January 02, 2024, 09:11:02 am »

I agree with this. Having a "proper" integration with Home Assistant would be wonderful. In case someone reads this and thinks that HA is a flash in the pan, so why would MC invest time in another project: https://github.blog/2023-11-08-the-state-of-open-source-and-ai/#the-state-of-open-source

It is listed here as the second highest number of contributors for an active open source project, behind MS's VSCode, and it's been around 10 years. That's not shabby.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #12 on: January 03, 2024, 02:49:03 am »

an example of the functionality that could be implemented *if* MC broadcast certain events (e.g. via a websocket)

https://www.home-assistant.io/integrations/kodi/#keypress-events

some things can be clumsily simulated by polling (e.g. changes to playing now) but others (like the above) are either impractical or not possible
Logged

eve

  • Citizen of the Universe
  • *****
  • Posts: 689
Re: Make MC compatible with HomeAssistant
« Reply #13 on: January 04, 2024, 03:56:41 pm »

an example of the functionality that could be implemented *if* MC broadcast certain events (e.g. via a websocket)

https://www.home-assistant.io/integrations/kodi/#keypress-events

some things can be clumsily simulated by polling (e.g. changes to playing now) but others (like the above) are either impractical or not possible
I've been harping on this topic for ages. The polling thing is inefficient at best and almost entirely rules out certain things.
Logged

zeltak

  • Regular Member
  • Galactic Citizen
  • ****
  • Posts: 494
Re: Make MC compatible with HomeAssistant
« Reply #14 on: January 05, 2024, 05:43:58 pm »

+1 for HA integration, LOVE both home assistant and mc :)
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13874
Re: Make MC compatible with HomeAssistant
« Reply #15 on: January 06, 2024, 11:28:45 am »

You all intrigued me enough to install HA. I chose to use a virtualbox container on my main linux server.
It looks pretty useful. The stuff it found on my network, like solar panels, Sonos, etc was interesting and being able to add some of the others like my thermostat was nice.

It's not like any of the data isn't available from the individual apps though. The Solar for example, it's interesting to see the data in that presentation but I get a way better representation of that data in the Enphase app.
The thermostat is controllable but way more options in the TCC app.
For me so far the main thing is to see all of the data in one place. I am not interested in voice control.

As for MC, my Id renderers added as DLNA devices (as someone pointed out above) are not able to stop and restart from the HA controls. Volume and Mute work fine. There shouldn't be a problem here, other DLNA controllers can do this fine with MC renderers. Not sure where that issue is.
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #16 on: January 06, 2024, 12:00:30 pm »

Whether an individual finds HA useful or not is not really relevant to this thread, it's only a question of can I access MC in it (for people who do find it useful).

The problem is you can barely do anything with it, you can't control playback, you can't unmute, you can't control theatre view using it, there's no obvious way to react to things MC is doing, you can't change playlists, you can change volume and that's about it. The integration is so minimal it might as well not exist.

The info re playback is in the linked post, it was reported long ago.
Logged

eve

  • Citizen of the Universe
  • *****
  • Posts: 689
Re: Make MC compatible with HomeAssistant
« Reply #17 on: January 06, 2024, 12:54:40 pm »


It's not like any of the data isn't available from the individual apps though. The Solar for example, it's interesting to see the data in that presentation but I get a way better representation of that data in the Enphase app.
The thermostat is controllable but way more options in the TCC app.
For me so far the main thing is to see all of the data in one place. I am not interested in voice control.

That's pretty much why I use HA, it's really useful to get things talking to each other. The lack of control options for specific devices is unfortunate but it happens (either the 'fault' of HA or just the MFR not exposing those features). When we're looking at "smart home"-y devices, I don't even consider the provided 'app' an option. It would be utter insanity to have an app for all of these things, thus the 'openness' of a device does matter to me.

This is quite off topic though. Glad you found HA interesting!




Logged

eve

  • Citizen of the Universe
  • *****
  • Posts: 689
Re: Make MC compatible with HomeAssistant
« Reply #18 on: January 06, 2024, 12:58:33 pm »

As for MC, my Id renderers added as DLNA devices (as someone pointed out above) are not able to stop and restart from the HA controls. Volume and Mute work fine. There shouldn't be a problem here, other DLNA controllers can do this fine with MC renderers. Not sure where that issue is.

The issue has been around for ages (apparently offhandedly mentioned by me in a thread here, probably when I started trying to make JRiver work with HA a little nicer). It relates to the AVTransport.xml that JRiver serves up for DLNA. There's non standard arguments in the 'play' command I guess? Anyways, I just abandoned using DLNA for the integration I needed.
Logged

bob

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 13874
Re: Make MC compatible with HomeAssistant
« Reply #19 on: January 06, 2024, 04:24:46 pm »

The issue has been around for ages (apparently offhandedly mentioned by me in a thread here, probably when I started trying to make JRiver work with HA a little nicer). It relates to the AVTransport.xml that JRiver serves up for DLNA. There's non standard arguments in the 'play' command I guess? Anyways, I just abandoned using DLNA for the integration I needed.
It doesn't expose a Pause function for MC's renderer. I'm not sure why specifically. Bubble as well as others do work with MC.
Rygel does work with HA though so I might look at it's AVTransport.xml
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Logged

MasterC

  • Recent member
  • *
  • Posts: 32
Re: Make MC compatible with HomeAssistant
« Reply #21 on: January 06, 2024, 11:33:14 pm »

Another vote for JRiver control in HA. I have HA running almost everything in my house - and it integrates nicely with everything. Having the JRiver integration would complete my setup!

Logged

BillT

  • World Citizen
  • ***
  • Posts: 208
Re: Make MC compatible with HomeAssistant
« Reply #22 on: January 07, 2024, 03:25:19 am »

I use HomeSeer (tried Home Assistant but at the time I tried it in order to do anything much you had to use YAML - way too difficult). HomeSeer used to have a JRiver add on years ago, but JRiver changed so often that the HS integration kept failing so eventually it was dropped.

The solution that I came up with was to use MCWS. Send http strings. In HomeSeer &hs.GetURL("http://192.168.0.6:52199/MCWS/v1/Playback/Stop?Zone=-1&ZoneType=ID","", True, 80) sends the stop command. All the transport functions are available and you can change views (and probably a lot more functions that I don't use).

I use a web browser running Panel in a HSTouch window (http://192.168.0.6:52199/Panel/). The HS main interface isn't generally used.

I would think that a similar approach would work with HA. If I can do it it cant be that difficult!
Logged

mattkhan

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4231
Re: Make MC compatible with HomeAssistant
« Reply #23 on: January 07, 2024, 03:28:46 am »

it's what I do atm, define a few restful commands and call them via buttons, e.g.

Code: [Select]
cmdserver_mc_stopall:
  url: "http://1.2.3.4:12345/MCWS/v1/Playback/StopAll"
  username: !secret mc_user
  password: !secret mc_pass
Logged

eve

  • Citizen of the Universe
  • *****
  • Posts: 689
Re: Make MC compatible with HomeAssistant
« Reply #24 on: January 07, 2024, 04:08:52 pm »

it's what I do atm, define a few restful commands and call them via buttons, e.g.

Code: [Select]
cmdserver_mc_stopall:
  url: "http://1.2.3.4:12345/MCWS/v1/Playback/StopAll"
  username: !secret mc_user
  password: !secret mc_pass

See for me, I have multiple JRiver clients and it seemed impractical to juggle them and their IPs so the way I set up my layer between MCWS (plus a few functions that run locally on the systems) is that the IPs are generated based upon my config in a database (this config system makes up the backbone of how all my AES67 crap works too). This way, if I spin up a new JRiver instance or need to change an IP of a device, I just update the database and everything works. Furthermore it simplifies accessing specific JRiver instances by name / identifier and their respective zones. This also gives me the benefit of like helper functions and longer macros? So for example since I run OLEDs, pausing a movie in an ideal world means not leaving a static image displayed, there's a function that handles hiding / showing JRiver correctly (which requires not only JRiver MCC commands but some OS things) + a whole thing for like, swapping to an 'idle' zone that provides automatically generated background material (think trailers and featurettes and 'retro ephemera' stuff) to display instead of just going to black.
More complex functions are easy too, all that queuing and queue generation stuff can happen in that service which then provides the queued items to JRiver (without JRiver needing to manage them in it's library database or anything).

Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72444
  • Where did I put my teeth?
Re: Make MC compatible with HomeAssistant
« Reply #25 on: January 08, 2024, 11:41:17 am »

Logged
Pages: [1]   Go Up