Guidance for media player presets functionality

I’m thinking about extending the ‘openhome/linn’ media player integration to support a feature called ‘Pins’ (https://docs.linn.co.uk/wiki/index.php/Linn_DS/DSM_control#PINS), this can be thought of as a type of preset and as far as I’m aware there are 6 of them (though looking at the technical documentation, it would appear many more are possible).

I’ve just added it to the underlying library: https://github.com/bazwilliams/openhomedevice

Looking at some of the other media player integrations (Bluesound, Channel) appear to overloaded the media player ‘source’ with those channels or presets and put some logic in the integration to handle this. Onkyo appears to use the ‘play_media’ functionality to invoke a preset.

Since the openhome integration already supports a dynamic (and potentially long) list of sources, I’m a bit reluctant to merge them together. This is further complicated by the capability to ‘pin’ a source to a button - in this case, there would be two equally named entries in the choose source dropdown.

So my question to other developers is, what approach should I take? Is there an idea for an additional type of preset functionality in the media player component, should I consider adding one? Or is overloading/merging sources acceptable in this case?

Can this interact with the Nabu Casa Alexa integration? For example, the official Linn Alexa skill uses the ChannelController to permit pin selection (https://github.com/linn/linn-api-alexa-smart-home/blob/5f8a336846ec0537944a7e17ec5889bc0db74d01/src/handlers/ChannelControlHandler.ts).

1 Like

Hey. Nice going with this!

I don’t want to hijack your thread, but may I ask how you configure a Linn product. - I owing a Linn Sneaky.

I get my media_player sensor, but it does not work. Not even power it on/off.

media_player:
- platform: openhome  #Linn

Can you check you have the discovery: component enabled and have a look at the logs for what is discovered?

You might need to tweak any firewalls you have as the component uses SSDP to be discover openhome/Linn devices and that requires UDP inbound traffic to work.

Back on topic - I’m planning to add an openhome.invoke_pin service which takes the following data object:

{
  entity_id: media_player.foo
  pin: 4
}

This would allow automations and scripts to invoke the specified pin (4 in my example). I imagine it wouldn’t take much to generalise this into a media_player.invoke_preset service - but I see many of existing integrations use the name of the preset rather than an index so more evidence required.