LinkPlay Integration

First off: big thanks for the integration! I just “smartened” up a speaker with an Arylic Up2Stream Mini, streaming works like a charm! I mainly use it to stream internetradio for my alarm clock. which also works fine, including fade in.

The only thing I am struggling is, that i want to choose the radio station for my alarm clock in lovelace. Up to now I am only able to “hardcode” it in the automation.

So I put three stations in sources:

media_player:
  - platform: linkplay
    host: 192.168.x.xxx
    name: Schlafzimmer_Linkplay
    icecast_metadata: 'StationNameSongTitle'
    sources: 
      {
        'http://orf-live.ors-shoutcast.at/oe3-q2a': 'OE3',
        'http://orf-live.ors-shoutcast.at/oe1-q2a': 'OE1',
        'http://orf-live.ors-shoutcast.at/fm4-q2a': 'FM4'
      }

It is working, if i set the source like that: Actually it is not, see my next posting.

action:
  - service: media_player.volume_set
    target:
      entity_id: media_player.schlafzimmer_linkplay
    data:
      volume_level: 0.1
  - service: media_player.select_source
    data:
      source: OE1
    target:
      entity_id: media_player.schlafzimmer_linkplay
  - service: media_player.media_play
    target:
      entity_id: media_player.schlafzimmer_linkplay

It is not working when i use the input_select.radiosender I created where I can choose OE3, OE1 or FM4.

  - service: media_player.select_source
    data:
      source: {{states('input_select.radiosender')}}
    target:
      entity_id: media_player.schlafzimmer_linkplay

If I paste {{states('input_select.radiosender')}} in the templating tool, it returns the current state (OE3, OE1 or FM4).
Also changing data: to data_template: changes nothing…
When I save the automation and open it again it shows like that:

  - service: media_player.select_source
    data:
      source: '[object Object]'
    target:
      entity_id: media_player.schlafzimmer_linkplay

Any ideas how i could get that working?

New release, added common_sources optional configuration directive to be able to maintain all the same stream sources for multiple players in a single config file. So you can keep local sources as before in the sources section, and you can include additional common sources with include.
Solves https://github.com/nagyrobi/home-assistant-custom-components-linkplay/issues/33

2 Likes

Excite to try this but I am running into an issue with UPNP not being found. How do I add that? When I try to do it via integrations it doesn’t find any devices and aborts.

I maybe found a bug, or did I do somenthing wrong?

My automation only selects the correct source at the second run, the first run after a change the previous source is played.

action:
  - service: media_player.volume_set
    target:
      entity_id: media_player.schlafzimmer_linkplay
    data:
      volume_level: 0.1
  - service: media_player.media_play
    target:
     entity_id: media_player.schlafzimmer_linkplay
  - service: media_player.select_source
    data:
      source: OE1
    target:
      entity_id: media_player.schlafzimmer_linkplay 

If I change the source to e.g. FM4, the first time I run the automation afterwards it still plays OE1. The next time I run the automation it plays FM4. I tried selecting the source before calling the media_play service, this didn’t work at all…

Any ideas?

Edit: Or could this be an Home assistant automation bug? (cache?) Thanks to the new automation tracing i found out, that for the first run after changing the source the previous source is still used:
In this example I changed from OE3 to OE1. for the first run it still used OE3. Second run was OE1 then…

You have to use this order:

    1. select source
    1. set volume
    1. play, but only in rare cases, as selecting a source will usually automatically play.

It’s important to know that Linkplay modules set volume per input/source which means if you set volume before selecting a source, you’re actually setting the volume for the previous source.

1 Like

Perfect, thanks! Simple change, everything working now!

Updated release:

  • add unique_id property to the media players in HA (makes it easier to rename entities through Lovelace, also can be assigned to areas)
  • add volume_step option: Step size in percent to change volume when calling volume_up or volume_down services
3 Likes

Is there a way to play radio stations (already done), mp3 files stored on my SSD connected to Raspberry and Spotify? I would like to select the input “Radio”, “MP3” (the files on my SSD) or Spotify.

if you connect the SDD to the Linkplay speaker directly, yes.
Spotify has to be selected from the app on your phone, this is by design of Spotify (they don’t want you to use their service without their app)

1 Like

Many thanks for this plugin. I have a few Audio Pro devices (three A10 and one Drumfire) that I’m using it with.

I am wondering if there’s a way to “warm up” the speakers (i.e, turn them on) before trying to play through them. I have an audible warning if a door has been left open and while I perform a Snapshot and then wait, it seems they only really start to wake up when I play the sound and thus it’s missed if they had gone to sleep.

Speaking of Snapshot, I haven’t actually been able to get that to work. Neither web radio streams nor local DLNA resumes after Restore.

Play a 2-second silence file before the audible warning :wink:

Great! I was already looking into a way to make more gradual volume changes, cause at night the change from 10 to 20% is quite a lot!

I just got my first linkplay device and i’m having an issue with the integration. If i use the app to set the device to line-in input, then HA sees the device and can control it from the mini media player. If it set the input to bluetooth or stream internet radio, the HA status goes to unavailable and the log gives this message: Erroneous JSON during update player_status. Any ideas?

Interesting. What’s the firmware version? Can you post the player_status json during Bluetooth or internet radio stream? The output of:

http://player.ip/httpapi.asp?command=getStatusEx
http://player.ip/httpapi.asp?command=getPlayerStatus

Firmware seems to be 4.2.7312. I’ve tried the autoupgrade steps and got message 50. I have not figured out the manual upgrade steps, yet. The Bluetooth seems to be working today, but the internet radio still breaks the integration. Here is the output during internet radio playback:
{"type":"0","ch":"0","mode":"10","loop":"0","eq":"0","status":"play","curpos":"357992","offset_pts":"357992","totlen":"0","Title":"@Ö,@Ö,","Artist":"Ö,ÊV","Album":"","alarmflag":"0","plicount":"1","plicurr":"1","vol":"3","mute":"0","iuri":"687474703A2F2F32303630332E6C6976652E73747265616D746865776F726C642E636F6D3A38302F57584658464D5F53433F5447543D54756E65496E267464746F6B3D65794A30655841694F694A4B563151694C434A68624763694F694A49557A49314E694973496D74705A434936496D5A5465584134496E302E65794A7063334D694F694A3061584E7964694973496E4E3159694936496A49784D4459304969776961574630496A6F784E6A49774F444D334F5455314C434A305A4331795A5763694F6D5A6862484E6C66512E454F346677455A58366E6247466E6F4C5134384D4F676D2D6874424235346E305F3743415446567977494926444953543D54756E65496E26706172746E6572746F6B3D65794A68624763694F694A49557A49314E694973496D74705A434936496E5231626D567062694973496E523563434936496B705856434A392E65794A30636E567A6447566B58334268636E52755A5849694F6E527964575573496D6C68644349364D5459794D44677A4E7A6B314E53776961584E7A496A6F6964476C7A636E596966512E536F53774B5947366D52514E72336A4135366D6A6E6C355865504C7837367542465575586632484E61426F","uri":"687474703A2F2F706C6179657273657276696365732E73747265616D746865776F726C642E636F6D2F706C732F57584658464D2E706C733F444953543D54756E65496E265447543D54756E65496E266D6178536572766572733D32267464746F6B3D65794A30655841694F694A4B563151694C434A68624763694F694A49557A49314E694973496D74705A434936496D5A5465584134496E302E65794A7063334D694F694A3061584E7964694973496E4E3159694936496A49784D4459304969776961574630496A6F784E6A49774F444D334F5455314C434A305A4331795A5763694F6D5A6862484E6C66512E454F346677455A58366E6247466E6F4C5134384D4F676D2D6874424235346E305F3743415446567977494926706172746E6572746F6B3D65794A68624763694F694A49557A49314E694973496D74705A434936496E5231626D567062694973496E523563434936496B705856434A392E65794A30636E567A6447566B58334268636E52755A5849694F6E527964575573496D6C68644349364D5459794D44677A4E7A6B314E53776961584E7A496A6F6964476C7A636E596966512E536F53774B5947366D52514E72336A4135366D6A6E6C355865504C7837367542465575586632484E61426F"}
Thanks for your help!!

I think there’s an issue with the webradio stream URL, which is insanely long:

http://playerservices.streamtheworld.com/pls/WXFXFM.pls?DIST=TuneIn&TGT=TuneIn&maxServers=2&tdtok=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImtpZCI6ImZTeXA4In0.eyJpc3MiOiJ0aXNydiIsInN1YiI6IjIxMDY0IiwiaWF0IjoxNjIwODM3OTU1LCJ0ZC1yZWciOmZhbHNlfQ.EO4fwEZX6nbGFnoLQ48MOgm-htBB54n0_7CATFVywII&partnertok=eyJhbGciOiJIUzI1NiIsImtpZCI6InR1bmVpbiIsInR5cCI6IkpXVCJ9.eyJ0cnVzdGVkX3BhcnRuZXIiOnRydWUsImlhdCI6MTYyMDgzNzk1NSwiaXNzIjoidGlzcnYifQ.SoSwKYG6mRQNr3jA56mjnl5XePLx76uBFUuXf2HNaBo

I tried playing it but it’s all commercials for 10 minutes…

Try some of these instead:

http://17013.live.streamtheworld.com:80/WXFXFM_SC
http://17013.live.streamtheworld.com:3690/WXFXFM_SC
http://20603.live.streamtheworld.com:80/WXFXFM_SC
http://20603.live.streamtheworld.com:3690/WXFXFM_SC
http://15313.live.streamtheworld.com:80/WXFXFM_SC
http://15313.live.streamtheworld.com:3690/WXFXFM_SC

That works. What’s odd is that I’ve changed nothing, but now I can’t make it fail. Thanks for your help and for the awesome integration!

One of my upstream change IP everytime restarted even dhcp max lease and dhcp reservation table configured and i found it create a new media player entity

Bad router…

Hello. I have successfully updated my old devices (UUID FF310001, FF31F012) with firmwares v. 3.4-3.8 to v. 4.2.9502 using the utility Beta Firmware And Beta App Test Invitation - Firmware Update Log - Arylic Forum and firmwares from here http://s000.linkplay.com:8020/wifi_audio_image_7688/products.xml. I chose the firmware by UUID. There are many devices with the same UUID, I looked through all links with the same UUID until I found a <major-version> of 2021. Device UUID and FW version is listed in the <ver-url> file. Then I downloaded the <image-kernel> firmware and updated my devices through the utility. Enjoy…

1 Like