Hello! How are you?
I’ve searched on this forum but hadn’t got any good answer to this specific case.
I’m using a picture-element card with a Roku Remote.
What I want to do: run a different service based on who is clicking the button. Initialy I’ve tried to insert template bellow the service section, but it didn’t worked.
Any Clues? The complete code is at it follows, but this specific part is at the end of the script.
type: picture-elements
view_layout:
grid-area: main
image: /local/rokuremote_new.png?v=1
elements:
- type: service-button
service: remote.send_command
service_data:
command: power
entity_id: remote.roku_4k
style:
top: 6%
left: 50% - type: service-button
service: remote.send_command
service_data:
command: back
entity_id: remote.roku_4k
style:
top: 14%
left: 31% - type: service-button
service: remote.send_command
service_data:
command: home
entity_id: remote.roku_4k
style:
top: 14%
left: 70% - type: service-button
service: remote.send_command
service_data:
command: up
entity_id: remote.roku_4k
style:
top: 22%
left: 50% - type: service-button
service: remote.send_command
service_data:
command: left
entity_id: remote.roku_4k
style:
top: 29%
left: 24% - type: service-button
service: remote.send_command
service_data:
command: select
entity_id: remote.roku_4k
style:
top: 29%
left: 50% - type: service-button
service: remote.send_command
service_data:
command: right
entity_id: remote.roku_4k
style:
top: 29%
left: 76% - type: service-button
service: remote.send_command
service_data:
command: down
entity_id: remote.roku_4k
style:
top: 39%
left: 50% - type: service-button
service: remote.send_command
service_data:
command: replay
entity_id: remote.roku_4k
style:
top: 46%
left: 32% - type: service-button
service: remote.send_command
service_data:
command: info
entity_id: remote.roku_4k
style:
top: 46%
left: 70% - type: service-button
service: remote.send_command
service_data:
command: reverse
entity_id: remote.roku_4k
style:
top: 53%
left: 26% - type: service-button
service: remote.send_command
service_data:
command: play
entity_id: remote.roku_4k
style:
top: 53%
left: 50% - type: service-button
service: remote.send_command
service_data:
command: forward
entity_id: remote.roku_4k
style:
top: 53%
left: 75% - type: service-button
service: media_player.select_source
service_data:
source: Netflix
entity_id: media_player.roku_4k
style:
top: 64%
left: 50% - type: service-button
service: media_player.select_source
service_data:
source: HBO Max
entity_id: media_player.roku_4k
style:
top: 70%
left: 50% - type: service-button
service: media_player.select_source
service_data:
source: Star Plus
entity_id: media_player.roku_4k
style:
top: 77%
left: 50% - type: service-button
service: media_player.select_source
service_data:
source: YouTube
entity_id: media_player.roku_4k
style:
top: 84%
left: 50% - type: service-button
service: |
{% if is_state_attr(‘person.arthur_attili’, ‘id’, ‘arthur_attili’) %}
notify.mobile_app_tutu_s20
{% set notificacao_push = {
“title”: “Test 1”,
“message”: “Message Test 1”
} %}
{% else %}
notify.mobile_app_carol_s20
{% set notification_push = {
“title”: “Test 2”,
“message”: “Message Test 2”
} %}
{% endif %}
service_data:
message:
{{notification_push.message}}
title:
{{notification_push.title}}
style:
top: 93%
left: 50%