Apple Integration

It’s the Apple TV Integration, but it also covers Mini/Home Pods.

Firstly, been using it for some years with the Apple TVs, but now (for some months) it’s all over the place. Mostly it is unable to report status correctly and indeed at this very moment my wife is using the ATV in the lounge to watch TV and although the Samsung Integration correctly shows the TV is on, the ATV steadfastly remains showing as OFF. At other times it has reported being ‘paused’ or ‘playing’ while it is in fact OFF. Ongoing discussion on github about this, but nothing is being done.

My question though is about this integration and the HomePod Mini. The integration creates a media_player that basically doesn’t work. This script:-

action: media_player.play_media
target:
  entity_id: media_player.minipod_kitchen
data:
  media:
    media_content_id: http:///some.url
    media_content_type: music

does nothing. The brief message at the bottom of the screen simply says it was run successfully, but er, no sound emanates from the Minipod and no errors.

I have tried several URLs, all of which are to a local server and they are resolvable and play the intended radio station exactly as expected in all players - except in HA.

There is unfortunately much ambiguity when such matters are discussed, particularly whether the stream from that URL is being AirPlayed to the Minipod, or whether the URL is passed to the Minipod which then ‘pulls’ the stream from that URL itself. 2 very different processes, but indistinguishable to the user. However potentially a big difference in the impact on the network.

I can say that using other ‘music servers’ I can happily AirPlay from the URL to the MiniPod. That works, perfectly.

That raises some fundamental questions though:-

Is there any way that HA, with the ATV Integration can AirPlay to a MiniPod (or any AirPlay receiver device)? Is it supposed to be able to do that?

I believe the underlying pyatv might be able to do that, but it’s not actually what I’m trying to achieve. Which is to pass the stream URL to the MiniPod and have that play it, no AirPlay involved.

A pyatv’s Github issue mentions that pyatv should be able to pass the URL in that way, as that is used in TTS, but I can find no answer on how to do this. Seems to me the ATV Integration should implement this functionality as it is based on pyatv, but how? What commands can be used to do that?

So my question is 2 fold. What should the ATV Integration be able to do and how to achieve that?

To add to the above, I used atvremote (comes with pyatv) to successfully send a stream URL to the MiniPod using the play-url command. Complained a lot about it not being the right stream (its meant for video) but did eventually actually play the radio stream and I believe the MiniPod was playing the URL directly rather than receiving an AirPlay stream.

That is what I am trying to achieve. Just send a URL to a Mini/HomePod that it will then play. So it is possible with pyatv (needs refinement) and therefore the Apple TV Integration should be able to do this.

How?