LinkPlay Integration

Ohhh! Yes it works! if you solve multiroom also i will love you forever :rofl:
buying audiopro and missing out on the google home was a big bummer, but this will cover my needs all the way!

This part i dont get, can i get buttons for the presets to?

{% linkable_title Service linkplay_preset_button %}

Simulate pressing one of the physical preset buttons on the device.

Service data attribute Optional Description
entity_id no Name(s) of the Linkplay devices where the button should be pressed.
preset no The preset button to simulate pressing.

Multiroom is more or less done. I can add/remove “slaves” and set individual volume/mute when in multiroom mode. Left to do is being able to set L/R channel and full group volume/mute. And a LOT of testing :slight_smile:

Regarding presets, its used to “press” one of the four numbered buttons on top of the device where you can save radio channles/playlists etc.

1 Like

This functionallity can only be used from the “Services” page though. I haven’t done any modifications to the actual user interface…

1 Like

Tag me when you want me to update my .py file for tests :slight_smile:

Will do! Thanks for helping out.

1 Like

I’m just testing this setup… I can control the source, play buttons, volume.
The state is unknown most of the time. Sometimes it shows playing. Is there a way to make it send info from speaker to home assistant?

Could not make tts to work. Am I missing something?

@ nicjo814 Any thoughts why this message shows up?
“Unable To Connect To Device”

Sorry for being late to the party…

I’d love to help testing, can’t believe I missed this…

Will try now!

/Johan

Didn’t work.

Update for media_player.dining_room_audio fails

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/media_player/linkplay.py", line 635, in update
import upnpclient
ImportError: No module named 'upnpclient'

Should one start trying things, say pip3 install upnpclient or did I just do something stupid…?

/Johan

Here is my 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 685, in update
player_status[‘iuri’]).decode())
KeyError: ‘iuri’

That was strange. It should download upnpclient and install it automatically. I guess you could try to install it manually, but I haven’t tried that myself. Thanks for testing and reporting back!

What brand/model is your device? I’ve only tested it with AudioPro devices… Maybe the API isn’t as “generic” between devices as I had hoped.

The speaker is a Promate Streambox-L https://uae.souq.com/ae-en/promate-true-wireless-speaker-powerful-bluetooth-speaker-with-wifi-streaming-and-digital-internet-radio-built-in-mic-sd-card-slot-usb-input-and-aux-input-for-smartphones-tablets-mp3-and-mp4-streambox-l-blk-blu-22046599/i/

On the electronics inside it is written LinkPlay A31 https://fccid.io/2AAPP-A31/User-Manual/15-A31-UserMan-pdf-3034717

It can be controlled using https://github.com/AndersFluur/IEastMediaRoom

TTS is working fine if SSL is disabled.

Sending commands using your addon is working, but receiving the state from the speaker is not working.

Tried that, but got a new error.

It might be that I made something else wrong, never used a custom component before.

Sun Jan 13 2019 22:06:24 GMT+0100 (CET)

Update for media_player.dining_room_audio fails
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
  File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/.homeassistant/custom_components/media_player/linkplay.py", line 635, in update
import upnpclient
  File "/srv/homeassistant/lib/python3.5/site-packages/upnpclient/__init__.py", line 143, in <module>
from upnpclient import const, errors, marshal, soap, ssdp, upnp, util  # noqa: F401
  File "/srv/homeassistant/lib/python3.5/site-packages/upnpclient/soap.py", line 4, in <module>
from lxml import etree
ImportError: libxslt.so.1: cannot open shared object file: No such file or directory

Any ideas?

/Johan

Could you post the output from the following two URLs while your device is playing Spotify (if possible)
http:///httpapi.asp?command=getPlayerStatus
http:///httpapi.asp?command=getStatus

Make sure that there is no sensitive info in the output before posting :slight_smile: I need to compare which “keys” are available on your device…

I see that you are running Python 3.5 and my system is using 3.6. What version of HA are you using? I’ve tested the component on 0.83

Theoretically, the speaker can play spotify, but it does not show on available devices on spotify.

Maybe I am doing something wrong… I have never used spotify before.

Can I post the output from other source?

Sure, it should be fine with any source. It’s just that I’ve had some issues with Spotify playback that might be fixed on other devices :grinning:

Bluetooth connected on spotify. Hope it helps.

getStatus:
{"language":"en_us","ssid":"StreamBox-L_0B4C","hideSSID":"0","firmware":"3.5.3612","build":"release","project":"StreamBoxL","priv_prj":"StreamBoxL","Release":"20161012","group":"0","expired":"0","internet":"1","uuid":"FF31F0121C3C24A44F3E6AEC","MAC":"redacted","date":"2019:01:15","time":"21:38:20","netstat":"2","essid":"4169724E6574","apcli0":"192.168.0.103","eth2":"0.0.0.0","hardware":"A31","VersionUpdate":"0","NewVer":"0","mcu_ver":"120","disable_mcu":"0","mcu_ver_new":"0","ra0":"10.10.10.254","temp_uuid":"808F8A44EEE5922B","cap1":"0x104200","capability":"0x8002000","languages":"0x6","streams_all":"0x7ffffffe","streams":"0x7ffffffe","region":"unknown","external":"0x0","preset_key":"6","plm_support":"0x0","WifiChannel":"1","RSSI":"-42","battery":"0","battery_percent":"0","securemode":"0","upnp_version":"1003","uart_pass_port":"8899","communication_port":"8819","web_firmware_update_hide":"0","DeviceName":"albastru","GroupName":"albastru","user1":"299:524","user2":"5959:6291"}

getPlayerStatus:
{"type":"0","ch":"0","mode":"41","loop":"0","eq":"0","status":"play","curpos":"0","totlen":"0","Title":"556E6B6E6F776E","Artist":"556E6B6E6F776E","Album":"556E6B6E6F776E","alarmflag":"0","plicount":"0","plicurr":"0","vol":"3","mute":"0"}

Thanks! I can see that one key that I’m using to determine content type is missing in your output. Will have to try and figure out how to work around that :grinning: It’ll probably take a few days though…