Implement available pds with folder integration

This commit is contained in:
2020-03-27 19:00:17 +02:00
parent 57d9368dd4
commit 97c29e270c
3 changed files with 11 additions and 11 deletions
+2
View File
@@ -6,6 +6,8 @@ homeassistant:
unit_system: metric
time_zone: Europe/Sofia
packages: !include_dir_named packages
whitelist_external_dirs:
- /config/www/audio/youtube/pds
#
# ─── HOME ASSISTANT COMPONENTS ENABLED ──────────────────────────────────────────
+2 -2
View File
@@ -40,7 +40,7 @@ cards:
- type: custom:config-template-card
entities:
- sensor.philip_defranco
- sensor.available_pds
- sensor.pds
card:
type: vertical-stack
cards:
@@ -58,4 +58,4 @@ cards:
- type: custom:text-element
text: "Available:"
- type: custom:text-element
text: "${states['sensor.available_pds'].state.split(',')}"
text: "${states['sensor.pds'].attributes.file_list.join('<br />')}"
+7 -9
View File
@@ -1,14 +1,8 @@
sensor:
- platform: youtube
channel_id: UClFSU9_bUb4Rc6OYfTt5SPw
- platform: command_line
name: Available PDS
command: ls -1 /config/www/audio/youtube/pds | grep mp3 | paste -sd "," -
scan_interval: 30
- platform: command_line
name: Available Youtube clips
command: ls -1 /config/www/audio/youtube | grep mp3 | paste -sd "," -
scan_interval: 30
- platform: folder
folder: /config/www/audio/youtube/pds
input_text:
youtube_download_url:
@@ -31,7 +25,11 @@ script:
- service: media_player.play_media
data_template:
entity_id: media_player.master_bedroom
media_content_id: "{{ states('sensor.sarah_url') }}/local/audio/youtube/pds/{{ states('sensor.available_pds').split(',') | last }}"
media_content_id: >
{% set last_pds = state_attr('sensor.pds', 'file_list') | sort | last %}
{{ states('sensor.sarah_url') }}/local/audio/youtube/pds/{{ last_pds.split('/') | last }}
media_content_type: "music"
youtube_download_selected: