Skip to content

Instantly share code, notes, and snippets.

@DavidDeSloovere
Created February 8, 2020 08:14
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 DavidDeSloovere/669fc055a2eba713534fb59ba9919d19 to your computer and use it in GitHub Desktop.
Save DavidDeSloovere/669fc055a2eba713534fb59ba9919d19 to your computer and use it in GitHub Desktop.
Home Assistant automation for Magic Cards
- alias: Play Station from Magic Cards
trigger:
- platform: event
event_type: magic_card_scanned
event_data:
card_type: station
action:
# - service: notify.group_deef
# data_template:
# title: "Magic Cards {{ trigger.event.data.card_code }}"
# message: "Station Card URI was {{ trigger.event.data.card_uri }}"
- service: system_log.write
data_template:
message: "Station Card URI was {{ trigger.event.data.card_uri }}"
level: info
logger: custom.magic_cards
# 2019-08-16 16:26:52 INFO (MainThread) [custom.magic_cards] Station Card URI was kitchen|VRT Studio Brussel 94.5 (Modern Rock)
- service: media_player.select_source
data_template:
entity_id: "media_player.{{ trigger.event.data.card_uri.split('|')[0] }}"
source: "{{ trigger.event.data.card_uri.split('|')[1] }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment