I’m working on an automation for switching an HDMI switcher. I have a broadlink RM Mini 3 to control it.
I set up an input_selector
for the choices and then an automation to use the switch.broadlink_send_packet
service on change. The problem is, this service expects a list of packets, not just a string. And the data_template seems to be returning a string no matter what.
I’ve tried a million combos in the data template, but none of them seem to work. Here’s what I have configured currently, and the resulting log from the automation and resulting log of a good working service call. They look the same, but I think the service call from the automation is using a string not an actual list.
Thanks so much if anyone can help me out with this!
Config
input_select:
rack_hdmi_switcher:
name: Rack HDMI Switcher
options:
- Fire TV 4K
- Apple TV
- Shield
- Fire TV
icon: mdi:video-input-hdmi
automation:
- alias: Select Input
trigger:
- platform: state
entity_id: input_select.rack_hdmi_switcher
action:
service: switch.broadlink_send_packet_192_168_1_184
data_template:
packet: >
{% if is_state("input_select.rack_hdmi_switcher", "Fire TV 4K") %}
{{ ['JgBOAJWTFBESEhMREzcTERMSEhITERMSEhITERM3ExETEhISExETNxM2EzcTNhITEhITERMSEhITERMSEhITNxM2EzcTNhMABkuVkxM3EwANBQAAAAAAAAAAAAA=='] }}
{%-elif is_state("input_select.rack_hdmi_switcher", "Apple TV") %}
{{ ['JgBOAJWTExETEhISEzcSEhMRExISEhMRExISEhM2ExISEhMRExITERM3ExETERM3ExETEhISEzYTEhM2EzcTERM3EzYTNxMABkuVkxM2EwANBQAAAAAAAAAAAAA=='] }}
{%-elif is_state("input_select.rack_hdmi_switcher", "Shield") %}
{{ ['JgBOAJWTExISEhMREzcTERMRExITERMRExITERM3EhITERMSEhITNxISExETNxM2ExITERMRExISNxM3EhITERM3EzYTNxMABkuVkRU2EwANBQAAAAAAAAAAAAA=='] }}
{%-elif is_state("input_select.rack_hdmi_switcher", "Fire TV") %}
{{ ['JgBWAJWTExISEhMREzcTERMSEhITERMSEhITERM3ExETEhISExETNxM2EzcTNhM3ExETEhISExETEhISExETEhI3EzcTNhMABkuVjhg3EwAMM5WTEzYTAA0FAAA=='] }}
{%-elif is_state("input_select.rack_hdmi_switcher", "Input 5") %}
{{ ['JgBOAJSUEhITERQREjcTEhISExETEhISExEUERI3ExEUERISExETEhMREzcSNxM3ExETERMSEzYTNxMRExISEhM2EzcTNhMABkyUkxM3EwANBQAAAAAAAAAAAAA=='] }}
{% else %}
none
{% endif %}
Log
2018-02-08 12:36:08 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=switch, service=broadlink_send_packet_192_168_1_184, service_data=packet=[‘JgBOAJWTFBESEhMREzcTERMSEhITERMSEhITERM3ExETEhISExETNxM2EzcTNhITEhITERMSEhITERMSEhITNxM2EzcTNhMABkuVkxM3EwANBQAAAAAAAAAAAAA==’], service_call_id=139788500585664-31>
Log of a good working service call
2018-02-08 04:07:19 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=switch, service=broadlink_send_packet_192_168_1_184, service_data=packet=[‘JgBOAJWTExISEhMREzcTERMRExITERMRExITERM3EhITERMSEhITNxISExETNxM2ExITERMRExISNxM3EhITERM3EzYTNxMABkuVkRU2EwANBQAAAAAAAAAAAAA==’], service_call_id=140610925919424-42>