Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
3.0 kB
9
Indexable
Never
alias: Libratone Rai Radio 2
description: If libratone is play music it will stop.
trigger:
  - platform: tag
    tag_id: 4b36f79a-42a2-4eeb-8c29-fb0587976b6b
condition: []
action:
  - if:
      - condition: or
        conditions:
          - condition: device
            device_id: fab8f10a3d9e147223caf68b48fee1cf
            domain: media_player
            entity_id: e3b1c8da563af8b1560be2c53c73b062
            type: is_paused
          - condition: device
            device_id: fab8f10a3d9e147223caf68b48fee1cf
            domain: media_player
            entity_id: e3b1c8da563af8b1560be2c53c73b062
            type: is_idle
    then:
      - service: media_player.play_media
        target:
          entity_id: media_player.libratonezipp
        data:
          media_content_id: >-
            media-source://tts/google_translate?message=Playing+Rai+Radio+2&language=it
          media_content_type: provider
        metadata:
          title: Playing Rai Radio 2
          thumbnail: https://brands.home-assistant.io/_/google_translate/logo.png
          media_class: app
          children_media_class: null
          navigateIds:
            - {}
            - media_content_type: app
              media_content_id: media-source://tts
            - media_content_type: provider
              media_content_id: >-
                media-source://tts/google_translate?message=Playing+Rai+Radio+2&language=it
      - delay: 2
      - service: media_player.play_media
        target:
          entity_id: media_player.libratonezipp
        data:
          media_content_id: media-source://radio_browser/96181819-0601-11e8-ae97-52543be04c81
          media_content_type: audio/mpeg
        metadata:
          title: Rai Radio 2
          thumbnail: ""
          media_class: music
          children_media_class: null
          navigateIds:
            - {}
            - media_content_type: app
              media_content_id: media-source://radio_browser
            - media_content_type: music
              media_content_id: media-source://radio_browser/country/IT
    else:
      - service: media_player.play_media
        target:
          entity_id: media_player.libratonezipp
        data:
          media_content_id: >-
            media-source://tts/google_translate?message=Stop+Rai+Radio+2&language=it
          media_content_type: provider
        metadata:
          title: Stop Rai Radio 2
          thumbnail: https://brands.home-assistant.io/_/google_translate/logo.png
          media_class: app
          children_media_class: null
          navigateIds:
            - {}
            - media_content_type: app
              media_content_id: media-source://tts
            - media_content_type: provider
              media_content_id: >-
                media-source://tts/google_translate?message=Stop+Rai+Radio+2&language=it
      - delay: 3
      - service: media_player.media_pause
        data: {}
        target:
          entity_id: media_player.libratonezipp
mode: single
Leave a Comment