Skip to content

Instantly share code, notes, and snippets.

@matfra
Created December 21, 2020 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matfra/dc55f401dd826ad4cd723ac011577c67 to your computer and use it in GitHub Desktop.
Save matfra/dc55f401dd826ad4cd723ac011577c67 to your computer and use it in GitHub Desktop.
Sample of automation.yaml file for custom keypad in home-assistant
# Sample of automations.yaml
- id: '202003301005'
alias: keypad_tv_on
description: Turn on TV
trigger:
- payload: 2
platform: mqtt
topic: keypad
condition: []
action:
- entity_id: media_player.LGwebOSTV
service: media_player.turn_on
- id: '202003301006'
alias: keypad_tv_off
description: Turn off TV
trigger:
- payload: 1
platform: mqtt
topic: keypad
condition: []
action:
- entity_id: media_player.LGwebOSTV
service: media_player.turn_off
- id: '202003301007'
alias: keypad_tv_hdmi1
description: Switch TV to hdmi 1
trigger:
- payload: 0
platform: mqtt
topic: keypad
condition: []
action:
- service: media_player.select_source
data_template:
entity_id: media_player.LGwebOSTV
source: PC
- id: '202003301008'
alias: keypad_tv_hdmi2
description: Switch TV to HDMI2
trigger:
- payload: 7
platform: mqtt
topic: keypad
condition: []
action:
- service: media_player.select_source
data_template:
entity_id: media_player.LGwebOSTV
source: MBP
- id: '202003301009'
alias: keypad_tv_bottom_right
description: Switch TV to Youtube
trigger:
- payload: 8
platform: mqtt
topic: keypad
condition: []
action:
- service: media_player.select_source
data_template:
entity_id: media_player.LGwebOSTV
source: Netflix
- id: '202003301010'
alias: keypad_top_right
description: Keypad turns on the Hektar
trigger:
- payload: 4
platform: mqtt
topic: keypad
condition: []
action:
- service: switch.turn_on
entity_id: switch.hektar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment