LinkPlay Integration

What version are you running on hassio?

Is it python-magic 0.4.15 that is needed?

Edit: got it working again by adding this to manifest:

The python-magic package is only used indirectly in the component — through the eyed3 package. The eyed3 package is specified in requirements. So this is not a failure in the configuration of the component, but a failure specifically in your HA instance.

For this reason, I see no reason to change the requirements in the package.

PS. Everything works for me without problems on the latest version of HA. Prior to this, there were no failures in this place either.

Ok. But I have not deleted anything in my setup. And if eyed3 need python-magic it kinda sounds like a requirement …I solved it my self so if you don’t add it I can do it manually myself.

Edit: asked some other devs, they said it should be under dependencies in the manifest.

Did a little bit of digging, python-magic is listed in main in eyed3 dependencies so I don’t know why it’s ignored in my setup. No errors in any logs about it. Well it works now so I will let it go for now :smile:

It seems to me that it’s time for you to start supporting this component on a par with me. :wink:

:joy: my wife would kill me if I would put more time in to home automation. We are expecting or third kid i a couple of weeks so computer time is a bit limited for a while. But I will think about it :wink:

1 Like

Hi

I tried connecting to my Linkplay wireless ceiling speakers with this plugin and getting the following error on the logs:

Update for media_player.kitchen_speakers fails

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/urllib3/connection.py”, line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File “/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py”, line 84, in create_connection
raise err
File “/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py”, line 74, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

I can connect to the speakers fine and get a json response:

http://my-ip/httpapi.asp?command=getStatus

{ “language”: “en_us”, “ssid”: “Wifi Speaker_5F10”, “hideSSID”: “0”, “firmware”: “3.6.4122”, “build”: “release”, “project”: “Lumi_WSP-6_A31”, “priv_prj”: “Lumi_WSP-6_A31”, “Release”: “20170222”, “group”: “0”, “expired”: “0”, “internet”: “1”, “uuid”: “FF31F01281534F88B617C394”, “MAC”: “removed”, “date”: “2020:01:21”, “time”: “16:38:16”, “netstat”: “2”, “essid”: “486F6D655F57696669”, “apcli0”: “ip-removed”, “eth2”: “0.0.0.0”, “hardware”: “A31”, “VersionUpdate”: “0”, “NewVer”: “0”, “mcu_ver”: “1611”, “mcu_ver_new”: “0”, “ra0”: “ip-removed”, “temp_uuid”: “CE407CCBF3E01539”, “cap1”: “0x0”, “capability”: “0x20680200”, “languages”: “0x6”, “dsp_ver”: “”, “streams_all”: “0xfffffff”, “streams”: “0xfffffff”, “region”: “unknown”, “external”: “0x0”, “preset_key”: “6”, “plm_support”: “0x2”, “WifiChannel”: “11”, “RSSI”: “-70”, “battery”: “0”, “battery_percent”: “0”, “securemode”: “1”, “auth”: “WPAPSKWPA2PSK”, “encry”: “AES”, “psk”: “removed”, “upnp_version”: “1004”, “upnp_uuid”: “uuid:FF31F012-8153-4F88-B617-C394FF31F012”, “uart_pass_port”: “8899”, “communication_port”: “8819”, “web_firmware_update_hide”: “0”, “privacy_mode”: “0”, “user1”: “278:524”, “user2”: “5959:6291”, “DeviceName”: “Kitchen Speakers”, “GroupName”: “Kitchen Speakers” }

The speakers work with any commands I’ve tried from here:

Any ideas where to go from here?
Thanks

Also seeing this in the logs if it helps:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 279, in async_update_ha_state
await self.async_device_update()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 461, in async_device_update
await self.hass.async_add_executor_job(self.update)
File “/usr/local/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/linkplay/media_player.py”, line 705, in update
lxml.etree.XMLSyntaxError):
NameError: name ‘lxml’ is not defined

It is more correct to send bugreports here:

I created a bugreport according to your information, but so far I can’t promise that I can solve the problem. I myself hardly understand this program…

Ok, thanks. I added additional log info to the bug report.

1 Like

Any idea why the linkplay media_player.device doesn’t get seen by Alexa as a device when exported by Homeassistant? I’d like to be able to control volume/playback by Alexa but it doesn’t seem to be discovered eventhough Homeassisant exports it as s speaker device with “Power,Speaker,StepSpeaker,Volume” etc. just like any other media_player which can be controlled by Alexa.

Edit: I figured this out. I customized the entity “mediaplayer.kitchen_speakers” and added “supported_features 56253” (the same as alexa in my kitchen) and once I did that Alexa finds the linkplay speakers and I can play/pause/control volume etc. of my linkplay speakers via Alexa now.

1 Like

I decided to radically modify a few things here&there in the code for myself, but didn’t want to mess with the original repo and pull requests one by one, so I’ve created my own fork:

Requires Home Assistant 0.110 or above.

A few new features:

  • Configurable input sources list, to match choices in HA with the pyhsical inputs available on each device
  • Configurable Icecast / Shoutcast webradio streams as additional input sources
  • Retrieval of current playing content metadata from Icecast / Shoutcast webradio streams and filenames on directly attached USB sticks, Tidal, Dezzer
  • Retrieval of coverart from last.fm service based on current playing content metadata from icecast or filenames
  • Multirooom in both WiFi-Direct and Router mode, using Sonos-like ‘join’ and ‘unjoin’ service calls.
  • Recall of music presets stored on the device
  • Snapshot and restore state of the player for smooth usage with TTS or alerts
  • Browsing and playing media files from the directly attached USB sticks through Lovelace UI
  • Linkplay-chipset specific commands through HA service calls
media_player:
    - platform: linkplay
      host: 192.168.1.11
      name: Sound Room1
      icecast_metadata: 'StationNameSongTitle'
      multiroom_wifidirect: False
      sources: 
        {
          'optical': 'TV sound', 
          'line-in': 'Radio tuner', 
          'bluetooth': 'Bluetooth',
          'udisk': 'USB stick'
          'http://94.199.183.186:8000/jazzy-soul.mp3': 'Jazzy Soul',
        }

    - platform: linkplay
      host: 192.168.1.12
      name: Sound Room2
      icecast_metadata: 'Off'  # valid values: 'Off', 'StationName', 'StationNameSongTitle'
      sources: {}

Note that this is heavily work in progress. Also this is not backwards-compatible with the previous linkplay integration. Read the documentation carefully.

1 Like

Added state icon handling.

Added possibility to add webradios (http-based streams) as input sources.

Much better multiroom now. As the current fimwares allow for connection through the existing network - no need for WiFidirect AP etc. changed integration to support that.
It’s now possible to make multiroom setup bewteen ethernet and wifi devices from different manufacturers.

Doing something wrong?
This is shown when checking configuration.

> Configuration invalid
> 
> Invalid config for [media_player.linkplay]: [icecast_metadata] is an invalid option for [media_player.linkplay]. Check: media_player.linkplay->icecast_metadata. (See ?, line ?).

are you using the integration from the link above? Or the one from hacs?

From the link above.

Can’t help without seeing your config.

This was used for testing:

    - platform: linkplay
      host: 192.168.0.151
      devicename: StreamBoxAlbastru
      name: Bucatarie
      icecast_metadata: 'StationNameSongTitle'
      unavailable_message: '<Indisponibil>'
      sources: 
        {
          'wifi': 'WiFi', 
          'optical': 'TV sound', 
          'line-in': 'Radio tuner', 
          'bluetooth': 'Bluetooth',
          'udisk': 'USB HDD',
          'http://94.199.183.186:8000/jazzy-soul.mp3': 'Jazzy Soul',
          'http://1.2.3.4:8000/your_radio': 'Your Radio',
          'http://icecast.streamserver.tld/mountpoint.aac': 'Another radio'
        }
1 Like

I think you’re still using the old integration.

  • make sure you really replaced the media_player.py with exactly this one
  • remove linkplay config completely
  • restart HA
  • add the config above
  • restart HA again.