LinkPlay Integration

No problem!
Glad I can help!
Count on me for testing.

1 Like

This is awesome. I was able to get my 3 audiocast devices up and running around the house. I can stream to to them with spotify or use them as announcers for text to speech! Thank you! I didn’t see where I could create switches to group them together or ungroup them. Maybe I missed something? Is there a way to have add that to the player card?

Just received the second speaker and was wondering what’s the status? :slight_smile:
Can’t wait to test it!
Is there anything I could help with?

I haven’t had any time left due to work and family taking up all my time the last weeks. I really hope I’ll be able to look at this soon. I have an idea on how to solve it at least :slight_smile:

There is no grouping/ungrouping functionallity in the mediaplayer control itself. However there are services that let you do this. I really don’t know enough about the frontend to implement this in the mediaplayer control I’m afraid.

Ok, I’ve made some changes now located here:
https://github.com/nicjo814/home-assistant/blob/noiuri/homeassistant/components/media_player/linkplay.py
Could you test this version and see if it works?

1 Like

Please note that the changes introduced here disables media info for MP3 files.

Testing…
Here is the log:

Update for media_player.albastru fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
    await self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
    await self.hass.async_add_executor_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/media_player/linkplay.py", line 677, in update
    if self._is_playing_new_track(player_status):
  File "/config/custom_components/media_player/linkplay.py", line 567, in _is_playing_new_track
    status['Title']).decode('utf-8') != self._media_title)
ValueError: non-hexadecimal number found in fromhex() arg at position 0

What is it you are playing on the device?

Online radio: http://192.168.0.151/httpapi.asp?command=setPlayerCmd:play:http://50.7.68.251:7168/listen.pls

Perfect, I’ll test with it as soon as I can.

Hey, good news! :slight_smile:
No more error logs and the status of the device is showing as playing!
Is the screenshot showing a normal behavior?

It looks good. Could you try to download and test a new version from:


Also could you try to play something via TuneIn in the mobile companion app (if you have it) to check if you also get cover art and station info.

Will check the new wersion and reply.

But I would like to inform you that last night when tested, was not working. In the morning, when replyed with screenshot, was working, and now when returned home, was not working again.

1 Like

Ok, I need to know what source you are playing when it’s working and not working and also the log from HA. There are lots of things that can go wrong :grin:

The source for testing was always the same: http://192.168.0.151/httpapi.asp?command=setPlayerCmd:play:http://50.7.68.251:7168/listen.pls

This test is made using the last version.
It was not working when using the source above, but when used TuneIn was getting the cover art and station info.
After using the TuneIn, changed the source to above and was working like in the screenshot.

No log when working.
Here is the log when not working:

Update for media_player.albastru fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/media_player/linkplay.py”, line 700, in update
if self._is_playing_new_track(player_status):
File “/config/custom_components/media_player/linkplay.py”, line 568, in _is_playing_new_track
status[‘Title’]).decode(‘utf-8’) != self._media_title)
ValueError: non-hexadecimal number found in fromhex() arg at position 0

Right now it it is working! :slight_smile:

Could you post the result of the getPlayerStatus API call when it fails due to title not being hex? I haven’t encountered that problem myself…

I don’t know how to make it fail, but right now is working fine. I will post it if it fails.

One thing is that when switching from TuneIn to the source above, the cover and info from TuneIn remains unchanged. It stays there until changing TuneIn station or it “resets” after restarting home assistant.

Good to know, I’ll see if I can fix that.

One of the speakers failed.
The logs:

Sun Feb 03 2019 13:08:55 GMT+0200 (Eastern European Standard Time)

Error fetching data: <PreparedRequest [GET]> from http://192.168.0.152/httpapi.asp?command=multiroom:getSlaveList failed with HTTPConnectionPool(host=‘192.168.0.152’, port=80): Read timed out. (read timeout=2)

Sun Feb 03 2019 13:08:55 GMT+0200 (Eastern European Standard Time)

Update for media_player.alb fails
Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 221, in async_update_ha_state
await self.async_device_update()
File “/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py”, line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/media_player/linkplay.py”, line 723, in update
slave_list = json.loads(slave_list)
File “/usr/local/lib/python3.6/json/init.py”, line 348, in loads
‘not {!r}’.format(s.class.name))
TypeError: the JSON object must be str, bytes or bytearray, not ‘NoneType’

Sun Feb 03 2019 13:09:05 GMT+0200 (Eastern European Standard Time)

Error fetching data: <PreparedRequest [GET]> from http://192.168.0.152/httpapi.asp?command=getPlayerStatus failed with HTTPConnectionPool(host=‘192.168.0.152’, port=80): Max retries exceeded with url: /httpapi.asp?command=getPlayerStatus (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0xffff8ead8400>, ‘Connection to 192.168.0.152 timed out. (connect timeout=2)’))