thlucas1 / homeassistantcomponent_soundtouchplus

Home Assistant integration for Bose SoundTouch speakers
MIT License
13 stars 1 forks source link

possible to show a picture in mini media player when product:TV #14

Closed elmattt closed 6 months ago

elmattt commented 6 months ago

Checklist

Is your feature request related to a problem? Please describe.

i use mini media player to show on screens what is playing, it works with BT, spotify, tunenin etc with full cover

Describe the solution you'd like

would like to add the possibility of showing picture or screencap of my fire tv when the media player is on PRODUCT:TV

Describe alternatives you've considered

...

Additional context

...

thlucas1 commented 6 months ago

Hi @elmattt - thanks for reaching out.

I don't believe I can help too much with this, as the mini media player (separate integration) is responsible for displaying of cover art and media controls. The SoundTouchPlus just interfaces with the speaker. You might try submitting this to the Mini Media Player GitHub Issues link to see if they can add the requested functionality.

The best I could do would be to add a service to retrieve the "NowPlaying" information, and return it as service response data. The information returned might contain a cover art url, which could be used by the mini-media player for display. Though I am not sure if this would return a cover art image for the "PRODUCT:TV" source. Here is what I see for my ST-300 NowPlaying when the source is "PRODUCT:TV" ...

command URL = http://192.168.1.x:8090/nowPlaying

<nowPlaying deviceID="E8EB11B9B723" source="PRODUCT" sourceAccount="TV">
  <ContentItem source="PRODUCT" sourceAccount="TV" isPresetable="false" />
  <art artImageStatus="SHOW_DEFAULT_IMAGE" />
  <playStatus>PLAY_STATE</playStatus>
</nowPlaying>

What do you see on your SoundTouch device when browsing to that URL (change device IP address of course) from a desktop browser?

elmattt commented 6 months ago

hello and thanks for the answer ! i see the same on my st300 ;) i'm looking for another solution then !

thlucas1 commented 6 months ago

Another idea would be to interface with the Fire TV device to see if you can pull a cover art image from it, or maybe get the TV channel (or even network logo) covert art / image. I do see that Fire TV integration is available, supported via Android Debug Bridge integration, though not familiar with that. In a quick read of ADB, there is a Use Screen Capture For Album Art function, but not sure how it works.

Another approach would be to interface with some sort of TV EPG (Electronic Programming Guide) to get a cover art image of the TV show currently playing in your time zone for the channel specified.

Keep in mind that the above ideas are outside the scope of SoundTouchPlus; BUT .... If you could provide an image url, I could add a service to the SoundTouchPlus integration to pass that image url into the MediaPlayerEntity media_image_url property, which should get forwarded on to mini media player.

Hope it helps!

elmattt commented 6 months ago

i already have this option used, but some of the app used on the fire stick won't work with the screencap feature sadly ...

ok found a workaround, i juste add another mini media player card for my fire stick : add this generic camera works also : http://homeassistant.local:8123{{ state_attr('media_player.android_tv', 'entity_picture') }}

thlucas1 commented 6 months ago

I added a new custom service to the integration called update_source_nowplayingstatus, which allows you to specify a source (e.g. "Product (TV)") and set a bunch of NowPlaying attributes that will show up in the mini-media player for that specific source. For most sources the SoundTouch device will communicate the current status back to the media player (e.g. Spotify, TunieIn, Pandora, BlueTooth, AirPlay, etc). But not for the "PRODUCT" type of sources (e.g. TV, HDMI_1, etc). This will allow you to update the NowPlayingStatus for those specific sources if you want. It will require some automations on your end though, as you have to detect when content on the source changes, and call the service with the updates.

The NowPlayingStatus attributes include: album:str, artist:str, artistId:str, artUrl:str, description:str, duration:int, genre:str, playStatus:str, position:int, sessionId:str, stationLocation:str, stationName:str, track:str, trackId.

Example calling the service.

  - service: soundtouchplus.update_source_nowplayingstatus
    data:
      entity_id: media_player.bose_st300
      source_title: 'Product (TV)'
      art_url: "{{ state_attr('media_player.kodi_hearthroom', 'entity_picture') }}"
      station_name: "{{ state_attr('media_player.kodi_hearthroom', 'media_title') }}"
      station_location: Kodi Hearthroom

I am now in the process of adding some blueprints to call the update service automatically to update the media player status as different types of media (e.g. Movies, TVShow, Music) are played on my Kodi media center, which uses the "Product (TV)" source).

Will keep you posted when I have something ready for release.

thlucas1 commented 6 months ago

I just published release v1.0.31 that supports manual updates of the NowPlayingStatus. This will allow you to manually update the Product (TV) source with various information. Check out the SoundTouchPlus project Service Details wiki page for details of attributes that can be set as well as examples.

I tested it using my Kodi media player to push updates to the SoundTouchPlus player when Kodi attribute changes were detected. I also setup a My Home Assistant Blueprints repository for some blueprints related to using this with Kodi.

Check those out and let me know if it helps.

thlucas1 commented 6 months ago

Hi @elmattt - Please let me know if this works for you, and I will close the issue. Thanks.

thlucas1 commented 6 months ago

Have not heard back from the user - closing the issue.