So, based on my EPG post here
EPG (Electronic Program Guide) … who wants it in HA? - Share your Projects! / Dashboards & Frontend - Home Assistant Community (home-assistant.io)
I have updated this to show the current and next show on the button that changes the channel to a YouTubeTV channel.
decluttering_templates:
remote:
card:
type: picture-elements
view_layout:
grid-area: main
elements:
- type: service-button
service: remote.send_command
service_data:
command: power
entity_id: remote.[[roku_location]]
style:
top: 6%
left: 50%
- type: service-button
service: remote.send_command
service_data:
command: back
entity_id: remote.[[roku_location]]
style:
top: 14%
left: 31%
- type: service-button
service: remote.send_command
service_data:
command: home
entity_id: remote.[[roku_location]]
style:
top: 14%
left: 70%
- type: service-button
service: remote.send_command
service_data:
command: up
entity_id: remote.[[roku_location]]
style:
top: 22%
left: 50%
- type: service-button
service: remote.send_command
service_data:
command: left
entity_id: remote.[[roku_location]]
style:
top: 29%
left: 24%
- type: service-button
service: remote.send_command
service_data:
command: select
entity_id: remote.[[roku_location]]
style:
top: 29%
left: 50%
- type: service-button
service: remote.send_command
service_data:
command: right
entity_id: remote.[[roku_location]]
style:
top: 29%
left: 76%
- type: service-button
service: remote.send_command
service_data:
command: down
entity_id: remote.[[roku_location]]
style:
top: 39%
left: 50%
- type: service-button
service: remote.send_command
service_data:
command: replay
entity_id: remote.[[roku_location]]
style:
top: 46%
left: 32%
- type: service-button
service: remote.send_command
service_data:
command: info
entity_id: remote.[[roku_location]]
style:
top: 46%
left: 70%
- type: service-button
service: remote.send_command
service_data:
command: reverse
entity_id: remote.[[roku_location]]
style:
top: 53%
left: 26%
- type: service-button
service: remote.send_command
service_data:
command: play
entity_id: remote.[[roku_location]]
style:
top: 53%
left: 50%
- type: service-button
service: remote.send_command
service_data:
command: forward
entity_id: remote.[[roku_location]]
style:
top: 53%
left: 75%
- type: service-button
service: media_player.select_source
service_data:
source: YouTube TV
entity_id: media_player.[[roku_location]]
style:
top: 64%
left: 50%
- type: service-button
service: media_player.select_source
service_data:
source: MLB
entity_id: media_player.[[roku_location]]
style:
top: 70%
left: 50%
- type: service-button
service: media_player.select_source
service_data:
source: Plex - Free Movies & TV
entity_id: media_player.[[roku_location]]
style:
top: 77%
left: 50%
- type: service-button
service: media_player.select_source
service_data:
source: Prime Video
entity_id: media_player.[[roku_location]]
style:
top: 84%
left: 50%
image: /local/images/rokunew.png?v=1
options:
default:
- volume: 'no'
- find_remote: 'no'
card:
type: vertical-stack
cards:
- type: custom:state-switch
entity: '{% if ''yes'' == ''[[volume]]'' %} yes {% else %} no {% endif %}'
states:
'yes':
type: horizontal-stack
cards:
- type: button
icon: mdi:volume-minus
icon_height: 20px
show_icon: true
name: Decrease
show_name: false
tap_action:
action: call-service
service: remote.send_command
data:
command: volume_down
target:
entity_id: remote.[[roku_location]]
- type: button
icon: mdi:volume-plus
icon_height: 20px
show_icon: true
name: Increase
show_name: false
tap_action:
action: call-service
service: remote.send_command
data:
command: volume_up
target:
entity_id: remote.[[roku_location]]
- type: button
icon: mdi:volume-mute
icon_height: 20px
show_icon: true
name: Mute
show_name: false
tap_action:
action: call-service
service: remote.send_command
data:
command: volume_mute
target:
entity_id: remote.[[roku_location]]
- type: button
show_icon: false
name: Cameras
show_name: true
tap_action:
action: call-service
service: rest_command.[[roku_location]]_cameras
- type: custom:state-switch
entity: '{% if ''yes'' == ''[[find_remote]]'' %} yes {% else %} no {% endif %}'
states:
'yes':
type: button
show_icon: false
name: Find Remote
show_name: true
tap_action:
action: call-service
service: remote.send_command
target:
entity_id: remote.[[roku_location]]
data:
command:
- find_remote
- type: markdown
content: >
Current App <img src = '{{
state_attr('media_player.[[roku_location]]', 'entity_picture') }}'
height='60' width='150'></img>
theme: no_border
- type: custom:auto-entities
card:
type: custom:layout-card
view_layout:
grid-area: sidebar
layout_type: custom:grid-layout
layout:
grid-template-columns: auto
grid-template-rows: 1fr 1fr 1fr
card_param: cards
filter:
template: >
{%- set ns = namespace(buttons=[]) -%}
{%- for channel in states.sensor.epg_info.attributes.programs | sort(attribute='channel_name') -%}
{%- set program = channel.programs | selectattr('stop', 'gt', as_timestamp(now())) | list -%}
{%- set ns.buttons = ns.buttons + [{"channel": channel.channel_name | lower() | replace(' ', ''), "current_program": program[0].title, "current_start": program[0].start | timestamp_custom('%-I:%M%p'), "next_program": program[1].title, "next_start": program[1].start | timestamp_custom('%-I:%M%p')}] -%}
{%- endfor -%}
{%- set channels = [
['abc','vQPizFnl33s'],
['amc','TMr6pjcOURI'],
['bbcamerica','AW1cFldgulo'],
] -%}
{%- for (network, channel_id) in channels %}
{%- set this_channel = ns.buttons | selectattr('channel', 'eq', network) | list | first -%}
{%- if this_channel is defined -%}
{{
{"type": "custom:decluttering-card",
"template": "youtubetv_channel",
"variables":
[
{"roku_location": "[[roku_location]]"},
{"network": network},
{"channel_id": channel_id},
{"current_start": this_channel.current_start},
{"current_program": this_channel.current_program},
{"next_start": this_channel.next_start},
{"next_program": this_channel.next_program},
]
}
}},
{%- else -%}
{{
{"type": "custom:decluttering-card",
"template": "youtubetv_channel",
"variables":
[
{"roku_location": "[[roku_location]]"},
{"network": network},
{"channel_id": channel_id},
]
}
}},
{%- endif -%}
{%- endfor -%}
youtubetv_channel:
default:
- current_start: ''
- current_program: ''
- next_start: ''
- next_program: ''
card:
type: custom:button-card
card_size: 4
styles:
name:
- justify-self: start
- padding-left: 5px
- font-size: 10px
- font-weight: bold
label:
- justify-self: start
- padding-left: 5px
- font-size: 10px
- font-weight: bold
show_entity_picture: true
entity_picture: /local/images/channels/[[network]].webp
show_name: true
name: '[[current_start]] [[current_program]]'
show_label: true
label: '[[next_start]] [[next_program]]'
tap_action:
action: call-service
service: media_player.play_media
target:
entity_id: media_player.[[roku_location]]
data:
media_content_id: 195316
media_content_type: app
extra:
content_id: '[[channel_id]]'
media_type: live
views:
- title: Livingroom
theme: Backend-selected
type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 230px 180px
grid-template-rows: auto
grid-template-areas: |
"main sidebar"
path: livingroom_remote
subview: false
badges: []
cards:
- type: custom:decluttering-card
template: remote
variables:
- roku_location: livingroom
- type: custom:decluttering-card
template: options
variables:
- roku_location: livingroom
- volume: 'yes'
- find_remote: 'yes'
- title: Basement
theme: Backend-selected
type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 230px 180px
grid-template-rows: auto
grid-template-areas: |
"main sidebar"
path: basement_remote
subview: false
badges: []
cards:
- type: custom:decluttering-card
template: remote
variables:
- roku_location: basement
- type: custom:decluttering-card
template: options
variables:
- roku_location: basement
And, it looks like
The code above is missing the EPG coding even though the picture shows it. I wanted to leave all of that code and questions in the other thread.