Using custom component: youtube sensor

hi

I’m trying to play around with the youtube sensor and it works. I get a sensor with information about video and everything :slight_smile: but then I try to use it for playing. Just testing for now so I i’m on the services page in home-assistant and select media_extractor.play_media as an service then I have

{
  "entity_id": "media_player.soverom_chromecast",
  "media_content_id": "{{states.sensor.squirmy_and_grubs.attributes['url']}}",
  "media_content_type": "video"
} 

in the data field but it doesn’t work. If I put the url directly in the media_content_id field it works… But I want the url from the sensor…

You can’t use templates in the services page. Only real values.

That’s not the issue.

{
  "title": "Sample notification",
  "message": "{{ 3+6 }}"
}

image

update
Looks like that only works for persistent_notification.create

I am not sure if this helps but this is how I play youtube urls stored in input.text.

##########################################################################################
##########################################################################################
automation music:
  alias: music
  trigger:
    - platform: state
      entity_id: input_text.youtube
  action:
    - service:  media_player.media_stop
    - service:  media_player.volume_set
      data:
        entity_id: media_player.speaker
        volume_level: 1
    - service: media_extractor.play_media
      data_template:
        entity_id: media_player.speaker
        media_content_id: "{{  states.input_text.youtube.state }}"
        media_content_type: 'music'
##########################################################################################
##########################################################################################

I got it working by creating a script…

'1555698511664':
  alias: Play latest from Squirmy and grubs
  sequence:
  - service: media_extractor.play_media
    entity_id:
     - media_player.livingroom
    data_template:
        media_content_id: "{{state_attr('sensor.squirmy_and_grubs', 'url'| string)}}"
        media_content_type: video/youtube

and it works. My new problem now is that I want to use the entity_picture as an button…