Forked-daapd & Podcast Button: media_player.play_media & media_player.select_source

Tags: #<Tag:0x00007fc3fdb6fe18> #<Tag:0x00007fc3fdb6fd28> #<Tag:0x00007fc3fdb6fc60>

Hi
i am using the forked-daapd integration.

To select a forked-daapd playlist i use switches:

  platform: template
  switches:
    multiroom_dlf_switch:
      friendly_name: Multiroom DLF
      value_template: >-
        {% if is_state('media_player.forked_daapd_server','off') %}off
        {% elif is_state('media_player.forked_daapd_server','idle') %}off
        {% elif is_state('media_player.forked_daapd_server','paused') %}off
        {% elif is_state('media_player.forked_daapd_server','playing') %}
        {% if (state_attr('media_player.forked_daapd_server', 'media_album_artist') | regex_match('^.*Deutschlandfunk.*$', ignorecase=TRUE)) %}on
        {% else %}off
        {% endif %}
        {% else %}off
        {% endif %}
      turn_on:
        - service: script.multiroom_stop
        - service: media_player.select_source
          target:
            entity_id: media_player.forked_daapd_server
          data:
            source: "radio_dlf (playlist)"
        - service: media_player.media_play
          target:
            entity_id: media_player.forked_daapd_server
      turn_off:
        - service: script.multiroom_stop

thats running pretty fine.

Now i want to listen to a podcast - controlled by a switch.

  platform: template
  switches:
    multiroom_dlf_news_switch:
      friendly_name: Multiroom DLF Nachrichten
      value_template: >-
        {% if is_state('media_player.forked_daapd_server','off') %}off
        {% elif is_state('media_player.forked_daapd_server','idle') %}off
        {% elif is_state('media_player.forked_daapd_server','paused') %}off
        {% elif is_state('media_player.forked_daapd_server','playing') %}
        {% if (state_attr('media_player.forked_daapd_server', 'media_album_name') | regex_match('^.*Nachrichten.*$', ignorecase=TRUE)) %}on
        {% else %}off
        {% endif %}
        {% else %}off
        {% endif %}
      turn_on:
        - service: script.multiroom_stop
        - service: media_player.play_media
          data_template:
            entity_id: media_player.forked_daapd_server
            media_content_id: >-
              {{ states('sensor.latest_dlf_news') }}
            media_content_type: music
      turn_off:
        - service: script.multiroom_stop

the stream url is provided by a command_line sensor

    platform: command_line
    name: Latest DLF News
    scan_interval: 900
    command: curl -s https://www.deutschlandfunk.de/podcast-nachrichten.1257.de.podcast.xml | egrep -o 'https?://[^"]+mp3' | uniq | head -n 1

Its actually working, i can hear the streams.

BUT:
Each time i enable the podcast, forked-daapd enables ALL available speakers…

is there a way to get around that?

Regards
Clem

I have the exact same problem, in my case I am trying to get a TTS notification to my HomePods:

- id: Notification_Restmuell
  alias: Notification_Restmuell
  initial_state: 'on'
  trigger:
  - platform: time
    at: '20:00:00'
  condition:
  - condition: template
    value_template: '{% if states.calendar.abfall_restmuell.attributes.start_time
      %} {{ now().strftime("%Y-%m-%d") == (as_timestamp(states.calendar.abfall_restmuell.attributes.start_time)
      - (24*3600)) | timestamp_custom("%Y-%m-%d") }} {% else %} False {% endif %}'
  action:
  - service: media_player.turn_on
    target:
      entity_id: media_player.forked_daapd_output_homepod_links
  - service: tts.google_translate_say
    entity_id: media_player.forked_daapd_server
    data:
      message: Morgen wird der Restmüll geleert. Bitte die Tonne raus stellen.

All my forked-daapd speakers are turned on when playing this notification. Doesn’t matter which outputs are configured/activated vie the forked adapt web frontend.

Any hint how to solve this?

@cleem did you ever find a solution? :slight_smile:

@nicx No, not so far.
I wasnt even sure if i described my problem properly.

Do you have the same problems?

@cleem yes I have the same problem :frowning:

i solved it in using forked daapd differently.

You can add rss feed to forked daapd.

Than you need to use CURL once to set the generated rss playlist to load only the latest entry on the

"http://$HOST/api/library/playlists/$ID?query_limit=$QUERY_LIMIT"

after that i can create a switch:

  platform: template
  switches:
    multiroom_dlf_news_switch:
      friendly_name: Multiroom DLF News
      value_template: >-
        {% if is_state('media_player.forked_daapd_server','off') %}off
        {% elif is_state('media_player.forked_daapd_server','idle') %}off
        {% elif is_state('media_player.forked_daapd_server','paused') %}off
        {% elif is_state('media_player.forked_daapd_server','playing') %}

        {% if is_state_attr('media_player.forked_daapd_server', 'media_title','Nachrichten - Deutschlandfunk') %}on
        {% else %}off
        {% endif %}

        {% else %}off
        {% endif %}
      turn_on:
        - service: switch.turn_off
          target:
            entity_id: switch.multiroom_all_rooms_switch

        - service: script.multiroom_stop

        - service: script.multiroom_default_volume

        - service: media_player.clear_playlist
          target:
            entity_id: media_player.forked_daapd_server

        - service: media_player.select_source
          target:
            entity_id: media_player.forked_daapd_server
          data:
            source: "Nachrichten - Deutschlandfunk (playlist)"

        - service: switch.turn_off
          target:
            entity_id: switch.multiroom_all_rooms_switch

        - service: media_player.media_play
          target:
            entity_id: media_player.forked_daapd_server

        - service: media_player.media_seek
          target:
            entity_id: media_player.forked_daapd_server
          data:
            seek_position: 0


      turn_off:
        - service: script.multiroom_stop

i dont like it actually but at least its doing the following

  1. Set daapd to a good state
  2. Disable all speaker
  3. Play the feed

so in my home.app i do the following:

  1. Click on the Podcast button
  2. Select the speaker i want to have it played