Music Streamer Interface

Posted on
Sun Dec 27, 2020 11:22 pm
pgershon offline
Posts: 509
Joined: Jul 10, 2004

Music Streamer Interface

For years I have used Squeezebox devices to play music to my whole house audio system and interfaced with Indigo to identify the songs playing on my keypads. Unfortunately, Logitech has long since discontinued the Squeezebox and my units are failing and needed replacement. I have added a Sonos for Sirius XM (although the plugin no longer works with Sonos' latest update), but I also added a few much cheaper WiFi streaming devices like the Pyle 123 and the Audiocast M5. They all seems to use similar and interchangeable iPhone for control (Smart Sonix, WiSound and Audiocast 5). The software pulls up both players in the same way, which makes me believe there is some standard protocol being followed, but I have no idea how to determine what it is. It would be great to have Indigo (a) identify the songs being played and (b) control what is being streamed to the music output of each device (essentially these devices create Airplay devices.

Does anyone have any ideas? Thanks.

Posted on
Sun Jan 03, 2021 10:05 am
pgershon offline
Posts: 509
Joined: Jul 10, 2004

Re: Music Streamer Interface

Answering my own query - but I found the answer. The devices I referenced are all Airplay streamers, generally for wireless speakers. They seem to all use a Linkplay A31 Smart Audio Module as their core hardware and firmware. The Linkplay is controlled by its own API. After much searching, I found Anders Fluur posted great documentation of this API - here it is. I am going to be able to integrate into my Nuvo Concerto system to get the song playing and give keypad access to changing the music state.

https://github.com/AndersFluur/LinkPlay ... ter/api.md

Posted on
Sun Jan 03, 2021 11:33 am
Korey offline
User avatar
Posts: 813
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Music Streamer Interface

Interesting find! are you going to write a plugin :D

I use Airfoil to stream to all my airplay devices via my Indigo server, I have scripts and logic setup for Spotify, iTunes & VLC streams.

My Airplay devices are the old 2012 Airport Express units (Airplay2) or Apple TV units connected to Powered speakers or Stereo inputs.

Used everyday and works flawlessly to control 9 Zones of audio.

--
Korey

Posted on
Sun Jan 03, 2021 3:34 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Music Streamer Interface

Korey wrote:
Used everyday and works flawlessly to control 9 Zones of audio.

Nine zones???

That's just showing off. :D

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

[My Plugins] - [My Forums]

Posted on
Sun Jan 03, 2021 3:54 pm
Korey offline
User avatar
Posts: 813
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Music Streamer Interface

DaveL17 wrote:
Korey wrote:
Used everyday and works flawlessly to control 9 Zones of audio.

Nine zones???

That's just showing off. :D


:D :D :D

What can I say! I've made my living as a Audio Engineer! I love Music! and I love Indigo! :wink:
Attachments
Screen Shot 2021-01-03 at 1.44.08 PM.jpg
Screen Shot 2021-01-03 at 1.44.08 PM.jpg (123.95 KiB) Viewed 3667 times

--
Korey

Posted on
Sun Jan 03, 2021 4:17 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Music Streamer Interface

Korey wrote:
What can I say! I've made my living as a Audio Engineer! I love Music! and I love Indigo! :wink:

You know you are my hero, Korey! :D

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

[My Plugins] - [My Forums]

Posted on
Sun Jan 03, 2021 5:18 pm
Korey offline
User avatar
Posts: 813
Joined: Jun 04, 2008
Location: Henderson, NV

Re: Music Streamer Interface

:lol: :lol: :P

All the Plugin Developers (like yourself!), Matt and Jay are the real Heroes!!

3 cheers for this community!

Hip Hip Hurray!
Hip Hip Hurray!!
Hip Hip Hurray!!!

8)

--
Korey

Posted on
Tue Jan 05, 2021 2:51 am
pgershon offline
Posts: 509
Joined: Jul 10, 2004

Re: Music Streamer Interface

Working on a plugin. I have communicated with devices before from Indigo through Telnet, but this API requires HTTP commands and sends back responses. Not sure how to send and receive via HTTP within Indigo / python. For example, I want to query "http://192.168.1.154/httpapi.asp?command=getStatus" and store the result to a variable for analysis. Any suggestions on the easiest way to do this?

Posted on
Tue Jan 05, 2021 4:59 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Music Streamer Interface

pgershon wrote:
Working on a plugin. I have communicated with devices before from Indigo through Telnet, but this API requires HTTP commands and sends back responses. Not sure how to send and receive via HTTP within Indigo / python. For example, I want to query "http://192.168.1.154/httpapi.asp?command=getStatus" and store the result to a variable for analysis. Any suggestions on the easiest way to do this?

Have a look at the Python Requests library. It's the easiest way by a mile.

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

[My Plugins] - [My Forums]

Posted on
Tue Jan 05, 2021 6:19 am
pgershon offline
Posts: 509
Joined: Jul 10, 2004

Re: Music Streamer Interface

Got it - many thanks

Posted on
Tue Jan 05, 2021 1:27 pm
pgershon offline
Posts: 509
Joined: Jul 10, 2004

Re: Music Streamer Interface

Actually, it looks like the GhostXML plugin does what I need too and saves me the steps of parsing the data that comes back.

But I have another question - I am working on a plugin for these LinkPlay devices. I have multiple on my system so I assume others would too. I would like my plugin to use GhostXML to get the raw data from the device, but I want to be able to modify some fields (like translating Hex to ASCII) for display. So I figure I would create separate devices for each of my LinkPlays, each with its own IP address. I would then use GhostXML with a variable for the IP address to communicate with each player.

But is there a way my plugin can create devices in GhostXML so a user would not have to manually do this to start?

Thanks

Posted on
Tue Jan 05, 2021 6:00 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Music Streamer Interface

As far as I know, it's not possible in the way you describe. You can read (but not set) device states of other plugins' devices -- anything beyond that could present a pretty big security risk. That said, feel free to steal anything from the GhostXML plugin code you want so that your plugin can create its own devices.

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

[My Plugins] - [My Forums]

Posted on
Wed Jan 06, 2021 1:09 pm
pgershon offline
Posts: 509
Joined: Jul 10, 2004

Re: Music Streamer Interface

I am trying to work my way through the plugin development with my limited and only sporadic knowledge of python. I am sure my question is easy here, but perhaps you can help...

Trying to refresh (manually) GhostXML devices from within a script. I keep getting an error message, though the GhostXML log seems to show a refresh takes place. Here is the code:

ghostplugin=indigo.server.getPlugin("com.fogbert.indigoplugin.GhostXML")
ghostplugin.executeAction("refresh_data")

I get a message back "TypeError: No registered converter was able to produce a C++ rvalue of type CCString from this Python object of type PluginAction"

Not sure why. Here is the log from GhostXML:

2021-01-06 14:08:45.845 DEBUG Plugin.get_the_data [XML Device 1] URL: http://[A]/httpapi.asp?command=getStatus (before substitution)
2021-01-06 14:08:45.846 DEBUG Plugin.get_the_data [XML Device 1] URL: http://192.168.1.36/httpapi.asp?command=getStatus (after substitution)
2021-01-06 14:08:45.940 DEBUG Plugin.getDeviceStateList self.managedDevices: {569380312: <__main__.PluginDevice object at 0x1122fae90>, 1436315584: <__main__.PluginDevice object at 0x11240e710>}
2021-01-06 14:08:46.347 DEBUG Plugin.get_the_data [XML Player 1] URL: http://[A]/httpapi.asp?command=getPlayerStatus (before substitution)
2021-01-06 14:08:46.348 DEBUG Plugin.get_the_data [XML Player 1] URL: http://192.168.1.36/httpapi.asp?command=getPlayerStatus (after substitution)
2021-01-06 14:08:46.453 DEBUG Plugin.getDeviceStateList self.managedDevices: {569380312: <__main__.PluginDevice object at 0x1122fae90>, 1436315584: <__main__.PluginDevice object at 0x11240e710>}

Posted on
Wed Jan 06, 2021 1:56 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Music Streamer Interface

pgershon wrote:
I get a message back "TypeError: No registered converter was able to produce a C++ rvalue of type CCString from this Python object of type PluginAction"

So I know what's going on, but I may be under qualified to be able to fully explain it. I'll try.

The *.executeAction call is literally calling for a plugin action item to be run. In this instance you're calling the 'refresh_data' action to be run. That action item calls the method 'refresh_data_action()' from plugin.py and starts the refresh process. If it's successful, the 'refresh_data_action()' returns: the boolean True, and the indigo.Dict() object values_dict. However--and this is the important bit--I believe that the only things that are allowed to pass back out of the plugin through the broader exectueAction method are strings. There may be other things that are allowed, but bools and dicts are not. If I change the return from the Action to an all string return, it runs successfully.

So in the short run, it's not possible to execute the Action in the way you want. I'll take a look at whether the 'return True, values_dict' is even needed. It may not be and that would be easy to fix.

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

[My Plugins] - [My Forums]

Posted on
Wed Jan 06, 2021 9:36 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Music Streamer Interface

I have uploaded a new version to the Indigo Plugin Store which removes the returns from the Action Item calls which I believe are not needed. This should allow calls to executeAction to work without objection. I don't think this will create downstream issues, but it's at least theoretically possible that it could (meaning that we'll need to take another look). But I think we'll be good.

Your users will have to be on *at least* v0.5.07 of the GhostXML plugin for your calls to work properly.

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

[My Plugins] - [My Forums]

Who is online

Users browsing this forum: No registered users and 6 guests