LinkPlay Integration

Please don’t remove Tunein support, I spent months trying to get it to work myself so I know what station is playing. Just having the Station name/station logo si great and some streams show the correct artist/title which is brilliant.
Keep the functionality simple if needs be but don’t remove it.

Thanks for all your work.

p.s one thing I noticed with this new version is that play/pause doesn’t work with my speakers.
I can play using media_player.media_play but can’t pause or play_pause.
I tested directly with the speaker command - http://10.10.50.15/httpapi.asp?command=setPlayerCmd:onepause and it works fine so I made a workaround using a Rest command so my remote works but the buttons in the UI still don’t pause/resume correctly.

TuneIn support is not removed, it’s just implemented in a different way than the app does. If the stations you’re listening are using Shoutcast or Icecast as servers, you should see in HA at least station name, and if you enable in the config titles support you should be able to see artist and song info too. And if the artist and title are sent correctly by the station inside the stream, if you register for a free last.fm API key you’ll get cover arts too.

What are you trying to play/pause? Note that pausing a live stream is not really possible. Of course you can trigger it directly with onepause but the buffer will run out sooner or later in the module and it will fail to resume or will resume but stop after a few minutes. Play/pause is handled differently depending if it’s a stream, a file on a USB disk, or a Spotify track etc.

Ah my bad, I never thought of it that way with live radio. I noticed too though that listening to Spotify, when I pause from the Hass UI the mini-media-player doesn’t change to paused, it stays showing the pause button leading me to believe it hasn’t paused but on my Spotify app on my phone the track does in fact pause.
Not sure if it’s a mini-media-player bug but never noticed it happening on the previous version of linkplay integration.

On a side note, is there a way to correctly call a tunein station to play through linkplay like with the following URL - https://tunein.com/radio/RT-2fm-907-s15065/ or do we still have to go manually digging to find the stream URL from that page and use that to trigger playback on the Linkplay device?
Just wondering if I’m doing things correctly.

The problem with Spotify Play/Pause is that Linkplay API shows ‘pause’ state even when the stream is actually stopped. I’ll have a look at this again for some workarounds.

There’s no way to specify by TuneIn webpage the URL because TuneIn seems to change pretty often the way their website looks and works, so scraping their website for each web radio URL us out of the scope of this integration. I actually don’t think that TuneIn is the best place to look for radio stream URLs, usually aggregators like TuneIn or VTuner only publish the lowest quality MP3 stream of the available ones, to get maximum compatibility with lowest bandwidth, they want as less complaints from users as possible. If you have some favorite radios you like to listen online, I’d suggest to try to look for URLs on their websites directly, there they may have better quality streams at higher bitrates and compressions like AAC which sound much better than MP3.

Cool, thanks for the tip. I’ll do some digging for better URL. It’s only a handful of stations so not a big job.

For last.fm integration, do i just add the following to configuration file?

  • platform: linkplay
    host: 10.10.50.15
    icecast_metadata: ‘StationNameSongTitle’
    name: “Kitchen Speakers”
    lastfm_api_key: 12345678abc123

Or is the secret part needed too?

What secret part?

From last.fm theres an api key and shared secret.
I don’t get any album art/station logos so thought I may have it configured incorrectly.

You only need the api key.
For album art, you need proper artist and title info (like “Artist - Title” displayed in VLC titlebar if you play the same stream on your PC). If you don’t see them, lastfm won’t even be queried. It happens sometimes that they misspell the title of the song, in such cases lastfm can’t give proper information.

I pushed out an update to fix Spotify play/pause. Please check it out.

That seems to have worked nicely. Cheers.

Just coming back on this. I’m still unable to stop/pause internet streams. Once they play I can’t do anything to stop the stream.
I know you said that pause won’t work as it does with Spotify for example because it’s live but even if pressing pause were to stop the stream and pressing play again we’re to just restart the stream that would be a great help.
Not sure why the stop button doesn’t do anything though?

I think the default media player component offered by Lovelace is buggy, because if you go to Developer Tools > Services, and run the service media_player.media_stop against your media player’s entity, the playback will stop as expected.
Try using kalkih/mini-media-player (present in HACS). Besides having a lot more customizable features, it does stop/pause correctly.

Edit: working on a workaround.

Has anyone found a place to get the various releases of firmware for the linkplay modules… my device is running 4.2.7629.14 but it does not support router mode which i need due to the distance involved. i have a tool to update the firmware but i need 4.2.8 or later to enable router mode …any ideas.

here is the link to the tool if anyone wants it

Try fiddling with URLs from this page. But make 100% sure you only upload firmware matching your device by comparing UUID, otherwise you might brick the player as @malinduta did. He had to de-solder the chip and re-program it externally… although maybe with the tool you just shared you could recover (if you had a backup of the original firmware first).

You could also try changing in media_player.py from FW_MROOM_RTR_MIN = '4.2.8020' to 4.2.7620 and see if it works. Maybe your version already contains this, we can’t know for sure.

What model/type of device do you have?

Keiid…Project KD_W01 Version 4.2.7629 MCU version 14

Which one?

not sure i understand the question Keiid have to my knowledge 2 devices one is also an amp this is the receiver KD_W01 per my previous post… does that help/answer the question?

Sorry. On their website there are 3 wifi-capable models, and I failed to identify any of them as “KD_W01” as this string is not present in the description on the product page.

You could contact them and ask to compile an update with the newest linkplay module firmware. The firmware package is composed of at least 2 parts: communications module (linkplay) and MCU (vendor-specific). To my knowledge it looks like the communications firmware is more or less similar across the devices (this handles the network connections like wifi or lan, audio codecs, DSP and implements the API to control via Android/Upnp/Http/TCP) while the MCU is different for each device type (this implements the A/D-D/A audio conversion, physical inputs and outputs, buttons, displays, LEDs etc.).
I think the firmware for the communications module is made by the chip manufacturer Linkplay, while the MCU firmware is done by each device manufacturer separately.
So, in theory, all they have to do is to grab the newest linkplay release, pack it together with their own mcu code, and send it to your device.

There should be a way to update only the firmware of the communications part (linkplay) and leave the vendor-specific MCU chip untouched.

Thanks and sorry now i understand what you meant… the device is as follows…

KEiiD WiFi & Bluetooth (CSR 5.0) Wireless Stereo Receiver. i found a bin file that i can use to update the linkplay A31 module and i have updated the linkplay firmware to 4.2.8409.13 which appears to have a build date of 0609 2020. now i have to see if i can get it to go to router mode, that does not appear to be an option from the app ( to your point that could be an app or mcu issue) but hoping the commands listed above will still work)

thanks for all the input.

Router mode is not present in most of the apps (there are multiple branded apps outthere offering the same funcitionality but with different looks), or at least I didn’t see any Android app supporting it yet. This is still too new.

I got router mode info from manufacturer Arylic audio, but it works with other brands too. This is not MCU-specific.