I am having difficulty is understanding how to set/pass an entity_id from a custom:button-card to a script.
I want to create a TV remote on a dashboard that allows the selection of a channel from a button. I have learned and tested all of the twenty three remote codes on a Broadlink RM4. Now I have written separate scripts of each of the four over the air channels the I receive (ABC, CBS, NBS & FOX) and the scripts function on the dashboard by single clicks on the custom:button card. I would prefer to not have each of the scripts duplicated one for each of the Televisions in my home. It would be perferable to have each button card set or pass the entity_id to the script so that one set of scripts could service all of the Televisions and would allow for easier additional Televisions to be added in the future.
Sample of custom:button card
type: custom:button-card
name: ABC
show_name: true
tap_action:
action: call-service
service: script.abc
Sample of script
abc:
sequence:
- action: remote.send_command
metadata: {}
target:
entity_id: remote.ota_remote
data:
delay_secs: 0.4
device: ZapperBox
command: 7
- action: remote.send_command
metadata: {}
target:
entity_id: remote.ota_remote
data:
device: ZapperBox
command: Dot
delay_secs: 0.4
- action: remote.send_command
metadata: {}
target:
entity_id: remote.ota_remote
data:
delay_secs: 0.4
device: ZapperBox
command: 1
alias: ABC
description: ''
Any help would be appreciated. I have searched and read everything I can find and have not discovered the answer, if there is one.
Thanks