Yamaha Musiccast - How to script

Posted on
Wed May 10, 2017 11:48 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Yamaha Musiccast - How to script

Hi everyone,

I am looking for a "simple" way to interface with my new Yamaha musiccast speakers and receiver.
The musiccast system is completely network controlable by http and json.
What I am trying to start with are some simple commands:
For example:
To mute a network speaker I start an shell command
Code: Select all
curl http://192.168.1.80/YamahaExtendedControl/v1/main/setMute?enable=true

To unmute the same speaker I do
Code: Select all
curl http://192.168.1.80/YamahaExtendedControl/v1/main/setMute?enable=false;

So far so good.

What I now need, is the possibility to get the status of that speaker
This is done with a request that looks like this:
Code: Select all
http://192.168.1.80/YamahaExtendedControl/v1/main/getStatus

which results in the following response
Code: Select all
{"response_code":0,"power":"on","sleep":0,"volume":29,"mute":true,"max_volume":60,"input":"mc_link","distribution_enable":false,"equalizer":{"mode":"manual","low":9,"mid":0,"high":6},"link_control":"standard","disable_flags":0}

or as json interpretation
Code: Select all
response_code   0
power   "on"
sleep   0
volume   29
mute   true
max_volume   60
input   "mc_link"
distribution_enable   false
equalizer   
mode   "manual"
low   9
mid   0
high   6
link_control   "standard"
disable_flags   0

I would like to feed that response into some variables, but I don't know how I would do that.
Would anybody with more knowledge than me be able to help out?
Thanks in advance
Wilhelm

Posted on
Wed May 10, 2017 12:29 pm
chobo offline
Posts: 126
Joined: Dec 08, 2013
Location: USA

Re: Yamaha Musiccast - How to script

Hi Wilhelm, The incredibly useful GhostXML plugin from DaveL17 might be a good place to start: viewtopic.php?f=134&t=15137. I use it to parse feedback from several different A/V devices. It works great for both XML and JSON data sources. Keep us posted on your progress!

Posted on
Wed May 10, 2017 2:34 pm
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Yamaha Musiccast - How to script

thanks, for the tip.
I will look into it.
Cheers
Wilhelm

Posted on
Wed May 10, 2017 3:38 pm
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Yamaha Musiccast - How to script

Please let us know how you get on or if you have any questions.


Sent from my iPhone using Tapatalk

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu May 11, 2017 7:33 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Yamaha Musiccast - How to script

Thanks Dave for the plugin and the offer,

let's see what I have so far:

Hardware:
2 Musiccast Receivers
5 Musiccast LAN Speakers.

I have set up 1 Lan Speaker with Indigo to see what I could do. This setup consists of the following:

* The great GhostXML Plugin
* 1 virtual device for 1 Speaker which allows me to Switch that speaker on and off by Indigo and Homekit (via Homebridge)
consisting of the following:
* 2 Actiongroups that do a curl to switch the speaker on and off (used in the virtual device)
* 1 GostXML device that fetches the status periodically (so that I can check the state of the speaker)
* 2 Triggers which set the state variable for the virtual device

It works, but you can imagine for My equipment to simply Do On and Off for every device I would need
7 vitual devices (ok) 7 GhostXML devices, 14 Action Groups and 14 triggers. Those 7 GhostXML devices would all poll their individiual speaker ervery 15 seconds.
So I think/hope there must be a better way to do this and I am very open for ideas.

The second thing that comes to mind are the timeouts for the GhostXML devices. Every device has a minimum timeout 5 seconds. That means if there would be something wrong at least the thread would hang for 35 seconds. If I set the minimum polling rate in every device, that would supposedly mean 7 qeued updates for every timeout. I won't test this at the moment, but it seems likely to block the server in time.

There is another question concerning GhostXML:
The Musiccast system also has an event system that allows for a "subscription" in every device, that would send any change to an external application. These events are transmitted via UDP broadcast to the subscribing application.

event example:
Code: Select all
{
"system":{
"name_text_updated":true },
"main":{
"power":"on", "input":"siriusxm", "volume":30, "mute":false, "status_updated":true
}, "zone2":{
"power":"on", "input":"cd", "volume":50, "mute":false "enhancer":false
}, "tuner":{
"play_info_updated":false },
"netusb":{
"play_error ":0, "account_updated":true, "play_time":50, "trial_status":{
"input":"siriusxm",
"enable":false },
"trial_time_left":{ "input":"siriusxm", "time":5
}, "play_info_updated":false, "list_info_updated":false
}, "cd":{
"tray_status":"ready", "play_time":100, "play_info_updated":false
} }

I know this is a bit hefty, but it shows the possibilies.

Any ideas are very welcome.
Cheers
Wilhelm

Posted on
Thu May 11, 2017 8:58 am
DaveL17 offline
User avatar
Posts: 6742
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Yamaha Musiccast - How to script

Hi Wilhelm - sounds like quite the challenge! :D

The intent of the GhostXML plugin is to retrieve XML or JSON data and present the return as custom device states in Indigo. As you found, it's not meant for direct control. So some other means will definitely be required for that.

  • The minimum 15 second refresh rate can be overcome by selecting "Manual Refresh" and then invoking a refresh (at any desired frequency) using whatever means suits your purpose. There are actions built-in for this.
  • The 5 second timeout minimum could easily be changed (by me in a future update) to allow for a shorter duration.
  • If I'm thinking about this the right way, your server block concern should not be an issue. Because the plugin runs in a separate thread, all other server functions should carry on unaffected. During the timeout period, the plugin is simply waiting for a response from the server and this should represent a tiny load for Indigo. The thread would be blocked, but the server should not be.
  • UDP broadcast subscriptions are an intriguing notion but presently not something that the plugin can handle.

I'm a bit less clear on what might be a simpler way to do this "natively" in Indigo. It would be a pretty simple thing to do with a bit of Python scripting, but I realize that this is not up everyone's alley. :D

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Thu May 11, 2017 9:10 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Yamaha Musiccast - How to script

Thanks Dave - and I understand.
It's just that Yamaha did such a great job by defining that interface and the best is, that it doesn't involve any cloud sh...

The broadcast thing is just something that I think is a great way to get arround having to poll each device, but I know its not something that could be handled in such a universal plugin as yours.
My python abilities are close to nonexistant so until I have much more time on my hands I cannot get very far trying to do something with it.

What my next goal would be to find a means to use variables to stear the action groups and triggers, so that I don't have to duplicate every one of them for each device, but I think Indigo doesn't allow that.

Is there any way to pass parametrs to action groups or triggers?

Posted on
Thu May 11, 2017 9:25 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Yamaha Musiccast - How to script

Have you tried the Yamaha RX plugin? It may work if your device also supports the same API that they use for the RX line (it's not the same as your examples but it might support both).

If not, that plugin might be a good start for someone to write a plugin for your device as well.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu May 11, 2017 9:43 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Yamaha Musiccast - How to script

Hi Jay,

thanks but that plugin uses an Interface that was designed for use as a supplement for IR remote control. So it seems to do just that.
Yamaha Musiccast is a universal interface definition that connects all devices to act as a multiroom system.
The API 1.00 for that was release in the beginning of 2016 followed by an extende API in Oct 2016
The receivers supported by the RX Plugin are all before that.

Setting anything by tcpip only involves a curl command, but getting the status is something different.

I don't know how much I would implement at the moment. The goal for me ist to switch on the network speaker in a specific room when somebody enters and switch it off otherwise. That I can do now.

Still the question ist how do I get arround duplicating every action group and trigger for each device.

Posted on
Thu May 11, 2017 10:15 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Yamaha Musiccast - How to script

Well I just installed the RX plugin anyways.
I just don't get the plugin to list in the new devices dialog.

I stopped and started the server several times and finally I get a configure dialog that stated "The cake is a lie" and nothing else.
What does that mean?

Posted on
Thu May 11, 2017 10:21 am
Umtauscher offline
User avatar
Posts: 566
Joined: Oct 03, 2014
Location: Cologne, Germany

Re: Yamaha Musiccast - How to script

Ok, if you press save on that useless dialog, the plugin finally starts.
... but it is unusable for my intended purposes
Thanks

Posted on
Thu May 11, 2017 10:37 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Yamaha Musiccast - How to script

Umtauscher wrote:
I get a configure dialog that stated "The cake is a lie" and nothing else.
What does that mean?


LOL - I think it was the original author's idea of a placeholder (or perhaps a joke).

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests