hi
I’m trying to play around with the youtube sensor and it works. I get a sensor with information about video and everything 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…
petro
(Petro)
June 24, 2019, 5:21pm
2
You can’t use templates in the services page. Only real values.
ludeeus
(Ludeeus)
June 24, 2019, 5:24pm
3
That’s not the issue.
{
"title": "Sample notification",
"message": "{{ 3+6 }}"
}
update
Looks like that only works for persistent_notification.create
RobDYI
June 24, 2019, 5:30pm
4
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 have seen a lot of topics about youtube search and having the results play on a media player but couldn’t find a complete project. I created this python script that will take a search topic as an input and put the url from the first search result from youtube video into a input_text. I then get HA to automate the playing of the url on the media player when the input text changes. I used media extractor to play the urls on the media player.
shell_command:
youtube: /Library/Frameworks/Pyt…
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…