Forked-daapd and media player services

Great, I’ll check that out thanks.

Can’t it be added to the official integration?

@uvjustin is/was working on it to support TTS and manage content_id. I don’t know what is the status.

@uvjustin I definitely think this topic is worth reviving!

I ran into the same issue initially described by @davidlb , that is when calling .play_media causes activation of all zones, volume set to 80%. I realise this is not the original issue posted by @squirtbrnr, but in any case has been discussed in this thread in detail.

Now, I realize that @davidlb used his “quick and dirty” (his words :slight_smile: ) hack as a fork which he published, for which I am grateful, since this serves to solve the bug :+1:

However! why isn’t your own branch, which offers a more comprehensive solution (and also a browse_media functionality :exploding_head:) incorporated into core??

Personally, I’m not looking for browse-media functionality since my use of OwnTone is via pipe and stream URIs. So I guess if splitting this into two separate PRs would expedite its incorporation into core, it’s worth a thought. All in all, this would be very useful, and at least all the people involved in this thread would be interested in it!

Thank you for this great component :clap:

Sorry all, due to various reasons I was not able to keep up with this component. I’ve recently taken a look at it again and will try to update it over the coming month.

3 Likes

I’ve pushed a few changes to the following branch: uvjustin/home-assistant at update-forked-daapd (github.com). You can download the files from homeassistant/components/forked_daapd and place them in your local custom_components/forked_daapd folder. The initial changes include supporting the announce/enqueue service calls and updating the media browser functionality. Please try it out when you get a chance, and feel free to provide some feedback so I can further improve the component.

1 Like

I’ve tested the update as a custom_component as suggested.
For TTS the experience is pretty much in sync with this discussion thread, however for other Browse Media options (i.e. Radio streams) overriding the current owntone output on/off and volume settings is probably not what the average user would like to see.

Thanks for testing it out and leaving a comment.
Are you sure you’re using the update-forked-daapd branch? It should not be doing anything with the volume for the other browse media options - it only does that for the options that use the ATTR_MEDIA_ANNOUNCE flag such as TTS.

Just verified it with an .mp3 file residing in ‘/media’. On pressing Play in the media browser all 6 players defined in owntone are turned on and the volume cranked up. The kids love it :smiley:

I see. I realized that for some reason putting the folder in custom_components doesn’t override the integration. I think this is probably what you are seeing.
If you are brave enough, can you replace the contents of the original /usr/src/homeassistant/homeassistant/components/forked_daapd folder with the files from my branch? That should work. You will be able to tell that it worked by opening up the media browser with your Owntone instance selected as an output - in addition to the other media sources available, you should also see a bunch of folders with Owntone’s own media listed there.

This one has been solved here.
Adding the version tag to manifest.json helps loads the custom_component correctly. I can see the owntone folders in Browse Media. I’ll test the audio functionality in ~1h :sleeping_bed: :sleeping:

Oooh yes :slight_smile:

Thanks, I will update the manifest.json with a version for use as a custom component.

Added experimental Spotify browsing support if the Spotify component is installed.
Note that I won’t merge this feature anytime soon as a proper implementation requires changes to the Spotify component.

The changes I’ve made to update the media browsing functionality have been pulled into the HA 2022.10 beta and will be in HA starting from 2022.10 onwards.
I will make some changes to change the volume setting behavior when I have some time, but since I haven’t seen much feedback here regarding my recent changes except from @ddppddpp, I am not going to make this a priority.

2 Likes

I’ve just upgraded to latest version and I wanted to thank you @uvjustin for the good work! It now works as expected :slight_smile:

Anyone know how to prevent the Owntone integration from auto connecting to all available speakers with playing from the HA media player? This only happens when playing something from HA to the Owntone server so I think it’s an integration issue.

How did you achieve this interface?

a vertical stack card and also some conditionals.
I did it with the visual editor but here’s the yml code.


type: vertical-stack
cards:
  - type: media-control
    entity: media_player.forked_daapd_server
  - type: entities
    entities:
      - entity: switch.livingroom_speaker
        name: Домашно кино
        icon: mdi:surround-sound-5-1-2
    show_header_toggle: false
  - type: conditional
    conditions:
      - entity: switch.livingroom_speaker
        state: 'on'
    card:
      type: entities
      entities:
        - entity: input_number.livingroom_volume_slider
          name: Volume
          icon: none
      show_header_toggle: false
  - type: entities
    entities:
      - entity: switch.stereo_speaker
        icon: mdi:surround-sound-2-0
        name: Стерео
    show_header_toggle: false
  - type: conditional
    conditions:
      - entity: switch.stereo_speaker
        state: 'on'
    card:
      type: entities
      entities:
        - entity: input_number.stereo_volume_slider
          name: Volume
          icon: none
      show_header_toggle: false
  - type: entities
    entities:
      - entity: switch.kitchen_speaker
        icon: mdi:radio
        name: Кухня
    show_header_toggle: false
  - type: conditional
    conditions:
      - entity: switch.kitchen_speaker
        state: 'on'
    card:
      type: entities
      entities:
        - entity: input_number.kitchen_volume_slider
          name: Volume
          icon: none
      show_header_toggle: false
  - type: entities
    entities:
      - entity: switch.study_speaker
        icon: mdi:surround-sound-2-1
        name: Кабинет
    show_header_toggle: false
  - type: conditional
    conditions:
      - entity: switch.study_speaker
        state: 'on'
    card:
      type: entities
      entities:
        - entity: input_number.study_volume_slider
          icon: none
          name: Volume
      show_header_toggle: false
  - type: entities
    entities:
      - entity: switch.nursery_speaker
        icon: mdi:speaker
        name: Детска
    show_header_toggle: false
  - type: conditional
    conditions:
      - entity: switch.nursery_speaker
        state: 'on'
    card:
      type: entities
      entities:
        - entity: input_number.nursery_volume_slider
          icon: none
          name: Volume
      show_header_toggle: false
  - type: entities
    entities:
      - entity: switch.bedroom_speaker
        icon: mdi:surround-sound-2-1
        name: Спалня
    show_header_toggle: false
  - type: conditional
    conditions:
      - entity: switch.bedroom_speaker
        state: 'on'
    card:
      type: entities
      entities:
        - entity: input_number.bedroom_volume_slider
          icon: none
          name: Volume
      show_header_toggle: false
  - type: entities
    entities: []
    footer:
      type: buttons
      entities:
        - entity: switch.start_forkeddaapd
          icon: mdi:play
        - entity: switch.stop_forkeddaapd
          icon: mdi:stop
        - entity: switch.restrart_forkeddaapd
          icon: mdi:restart
        - entity: switch.start_multiroom_audio
          icon: mdi:play
        - entity: switch.stop_multiroom_audio
          icon: mdi:stop
        - entity: switch.restart_multiroom_audio
          icon: mdi:restart

hi @uvjustin , I am running into some issues when I use TTS through the HA media player. What happens when I send a TTS all the speakers are connected and they all play the TTS. I see a few posts up that this was fixed, is this expected behavior? Is there anyway around it?