Skip to content

Instantly share code, notes, and snippets.

@panagiotisTB
Created December 13, 2024 00:13
Show Gist options
  • Save panagiotisTB/766fd51d6fac0a5d3d5684fbc470a6a5 to your computer and use it in GitHub Desktop.
Save panagiotisTB/766fd51d6fac0a5d3d5684fbc470a6a5 to your computer and use it in GitHub Desktop.
blueprint:
name: HomeKit TV Events with Hisense Commands
description: >
A script that allows you to set actions for events fired by a HomeKit TV, integrated
with Hisense TV Python commands. Simplified and readable for easy customization.
domain: automation
source_url: https://gist.github.com/iSteve-O/0a55d004d8dd516cfcefabc7f3f1ae54
input:
input_entity:
name: TV Entity
description: HomeKit TV Media Player
selector:
entity:
domain: media_player
device_class:
- tv
- receiver
up_action:
name: Up Action
description: Action for pressing the up button on the HomeKit remote.
default: []
selector:
action: {}
down_action:
name: Down Action
description: Action for pressing the down button on the HomeKit remote.
default: []
selector:
action: {}
right_action:
name: Right Action
description: Action for pressing the right button on the HomeKit remote.
default: []
selector:
action: {}
left_action:
name: Left Action
description: Action for pressing the left button on the HomeKit remote.
default: []
selector:
action: {}
select_action:
name: Select Action
description: Action for pressing the select button on the HomeKit remote.
default: []
selector:
action: {}
back_action:
name: Back Action
description: Action for pressing the back button on the HomeKit remote.
default: []
selector:
action: {}
playpause_action:
name: Play/Pause Action
description: Action for pressing the Play/Pause button on the HomeKit remote.
default: []
selector:
action: {}
rewind_action:
name: Rewind Action
description: Action for pressing the Rewind button on the HomeKit remote.
default: []
selector:
action: {}
fast_forward_action:
name: Fast Forward Action
description: Action for pressing the Fast Forward button on the HomeKit remote.
default: []
selector:
action: {}
variables:
entity_id: !input input_entity
mode: parallel
trigger:
- platform: event
event_type: homekit_tv_remote_key_pressed
event_data:
entity_id: !input input_entity
action:
choose:
- conditions: '{{ trigger.event.data.key_name == "arrow_up" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_UP"
- conditions: '{{ trigger.event.data.key_name == "arrow_down" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_DOWN"
- conditions: '{{ trigger.event.data.key_name == "arrow_left" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_LEFT"
- conditions: '{{ trigger.event.data.key_name == "arrow_right" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_RIGHT"
- conditions: '{{ trigger.event.data.key_name == "select" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_OK"
- conditions: '{{ trigger.event.data.key_name == "back" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_RETURNS"
- conditions: '{{ trigger.event.data.key_name == "play_pause" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_PLAY"
- conditions: '{{ trigger.event.data.key_name == "rewind" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_BACK"
- conditions: '{{ trigger.event.data.key_name == "fast_forward" }}'
sequence:
- service: shell_command.send_key
data:
parameter: "KEY_FORWARDS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment