mirror of
https://github.com/GeorgeSG/sarah.git
synced 2026-09-06 18:08:45 +00:00
Add twitch controls. Improve TV and Shield
This commit is contained in:
@@ -4,6 +4,71 @@ panel: false
|
|||||||
icon: mdi:youtube
|
icon: mdi:youtube
|
||||||
badges: []
|
badges: []
|
||||||
cards:
|
cards:
|
||||||
|
- type: vertical-stack
|
||||||
|
cards:
|
||||||
|
- type: custom:button-card
|
||||||
|
template: small
|
||||||
|
entity: script.tv_fireplace
|
||||||
|
name: Fireplace
|
||||||
|
- type: custom:config-template-card
|
||||||
|
entities:
|
||||||
|
- sensor.day9tv
|
||||||
|
- sensor.lirik
|
||||||
|
- sensor.cohhcarnage
|
||||||
|
- sensor.sacriel
|
||||||
|
card:
|
||||||
|
type: vertical-stack
|
||||||
|
title: Twitch
|
||||||
|
cards:
|
||||||
|
- type: horizontal-stack
|
||||||
|
cards:
|
||||||
|
- type: picture-entity
|
||||||
|
entity: sensor.day9tv
|
||||||
|
image: ${states['sensor.day9tv'].attributes.entity_picture}
|
||||||
|
state_filter:
|
||||||
|
"online": brightness(110%)
|
||||||
|
"offline": brightness(50%) saturate(0)
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.tv_twitch
|
||||||
|
service_data:
|
||||||
|
channel: day9tv
|
||||||
|
- type: picture-entity
|
||||||
|
entity: sensor.lirik
|
||||||
|
image: ${states['sensor.lirik'].attributes.entity_picture}
|
||||||
|
state_filter:
|
||||||
|
"online": brightness(110%)
|
||||||
|
"offline": brightness(50%) saturate(0)
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.tv_twitch
|
||||||
|
service_data:
|
||||||
|
channel: lirik
|
||||||
|
- type: horizontal-stack
|
||||||
|
cards:
|
||||||
|
- type: picture-entity
|
||||||
|
entity: sensor.cohhcarnage
|
||||||
|
image: ${states['sensor.cohhcarnage'].attributes.entity_picture}
|
||||||
|
state_filter:
|
||||||
|
"online": brightness(110%)
|
||||||
|
"offline": brightness(50%) saturate(0)
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.tv_twitch
|
||||||
|
service_data:
|
||||||
|
channel: cohhcarnage
|
||||||
|
- type: picture-entity
|
||||||
|
entity: sensor.sacriel
|
||||||
|
image: ${states['sensor.sacriel'].attributes.entity_picture}
|
||||||
|
state_filter:
|
||||||
|
"online": brightness(110%)
|
||||||
|
"offline": brightness(50%) saturate(0)
|
||||||
|
tap_action:
|
||||||
|
action: call-service
|
||||||
|
service: script.tv_twitch
|
||||||
|
service_data:
|
||||||
|
channel: sacriel
|
||||||
|
|
||||||
- type: vertical-stack
|
- type: vertical-stack
|
||||||
cards:
|
cards:
|
||||||
- type: entities
|
- type: entities
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ cards:
|
|||||||
show_header_toggle: false
|
show_header_toggle: false
|
||||||
entities:
|
entities:
|
||||||
- automation.youtube_download_latest_pds
|
- automation.youtube_download_latest_pds
|
||||||
|
- automation.tv_join_beam_to_sonos_group_when_off
|
||||||
|
|
||||||
- type: custom:fold-entity-row
|
- type: custom:fold-entity-row
|
||||||
head:
|
head:
|
||||||
|
|||||||
@@ -1,36 +1,8 @@
|
|||||||
# https://www.home-assistant.io/integrations/sonos
|
|
||||||
sonos:
|
|
||||||
media_player:
|
|
||||||
hosts: !secret sonos_hosts
|
|
||||||
|
|
||||||
# https://www.home-assistant.io/integrations/spotify
|
# https://www.home-assistant.io/integrations/spotify
|
||||||
spotify:
|
spotify:
|
||||||
client_id: !secret spotify_client_id
|
client_id: !secret spotify_client_id
|
||||||
client_secret: !secret spotify_client_secret
|
client_secret: !secret spotify_client_secret
|
||||||
|
|
||||||
group:
|
|
||||||
all_sonos:
|
|
||||||
name: All Sonos
|
|
||||||
entities:
|
|
||||||
- media_player.master_bedroom
|
|
||||||
- media_player.living_room
|
|
||||||
- media_player.kitchen
|
|
||||||
- media_player.bathroom
|
|
||||||
|
|
||||||
binary_sensor:
|
|
||||||
- platform: template
|
|
||||||
sensors:
|
|
||||||
sonos_recoverable:
|
|
||||||
friendly_name: Sonos recoverable
|
|
||||||
entity_id: media_player.master_bedroom
|
|
||||||
value_template: >-
|
|
||||||
{% if state_attr('media_player.master_bedroom', 'media_content_id').startswith('x-sonos-spotify:spotify')
|
|
||||||
or state_attr('media_player.master_bedroom', 'media_content_id').startswith('x-sonosapi-hls-static') %}
|
|
||||||
True
|
|
||||||
{% else %}
|
|
||||||
False
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
music_play:
|
music_play:
|
||||||
alias: Music · Play
|
alias: Music · Play
|
||||||
@@ -49,14 +21,6 @@ script:
|
|||||||
entity_id: media_player.master_bedroom
|
entity_id: media_player.master_bedroom
|
||||||
source: "{{ playlist | default('Evening Chill') }}"
|
source: "{{ playlist | default('Evening Chill') }}"
|
||||||
|
|
||||||
music_join_sonoses:
|
|
||||||
alias: Music · Join Sonoses
|
|
||||||
sequence:
|
|
||||||
- service: sonos.join
|
|
||||||
entity_id: group.all_sonos
|
|
||||||
data_template:
|
|
||||||
master: media_player.master_bedroom
|
|
||||||
|
|
||||||
automation:
|
automation:
|
||||||
- alias: Music · Play/Pause on Magic Cube Knock
|
- alias: Music · Play/Pause on Magic Cube Knock
|
||||||
trigger:
|
trigger:
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# https://www.home-assistant.io/integrations/sonos
|
||||||
|
sonos:
|
||||||
|
media_player:
|
||||||
|
hosts: !secret sonos_hosts
|
||||||
|
|
||||||
|
group:
|
||||||
|
all_sonos:
|
||||||
|
name: All Sonos
|
||||||
|
entities:
|
||||||
|
- media_player.master_bedroom
|
||||||
|
- media_player.living_room
|
||||||
|
- media_player.kitchen
|
||||||
|
- media_player.bathroom
|
||||||
|
|
||||||
|
binary_sensor:
|
||||||
|
- platform: template
|
||||||
|
sensors:
|
||||||
|
sonos_recoverable:
|
||||||
|
friendly_name: Sonos recoverable
|
||||||
|
entity_id: media_player.master_bedroom
|
||||||
|
value_template: >-
|
||||||
|
{% if state_attr('media_player.master_bedroom', 'media_content_id').startswith('x-sonos-spotify:spotify')
|
||||||
|
or state_attr('media_player.master_bedroom', 'media_content_id').startswith('x-sonosapi-hls-static') %}
|
||||||
|
True
|
||||||
|
{% else %}
|
||||||
|
False
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
script:
|
||||||
|
music_join_sonoses:
|
||||||
|
alias: Music · Join Sonoses
|
||||||
|
sequence:
|
||||||
|
- service: sonos.join
|
||||||
|
entity_id: group.all_sonos
|
||||||
|
data_template:
|
||||||
|
master: media_player.master_bedroom
|
||||||
|
|
||||||
|
homeassistant:
|
||||||
|
customize:
|
||||||
|
media_player.master_bedroom:
|
||||||
|
icon: mdi:speaker
|
||||||
|
media_player.living_room:
|
||||||
|
icon: mdi:speaker
|
||||||
|
media_player.kitchen:
|
||||||
|
icon: mdi:speaker
|
||||||
|
media_player.bathroom:
|
||||||
|
icon: mdi:speaker
|
||||||
@@ -6,12 +6,6 @@ webostv:
|
|||||||
service: wake_on_lan.send_magic_packet
|
service: wake_on_lan.send_magic_packet
|
||||||
data:
|
data:
|
||||||
mac: !secret living_room_tv_mac
|
mac: !secret living_room_tv_mac
|
||||||
# customize:
|
|
||||||
# sources:
|
|
||||||
# - livetv
|
|
||||||
# - youtube
|
|
||||||
# - makotv
|
|
||||||
# - netflix
|
|
||||||
|
|
||||||
media_player:
|
media_player:
|
||||||
- platform: androidtv
|
- platform: androidtv
|
||||||
@@ -19,24 +13,26 @@ media_player:
|
|||||||
host: !secret nvidia_shield_host
|
host: !secret nvidia_shield_host
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
tv_twitch:
|
||||||
|
icon: mdi:twitch
|
||||||
|
alias: TV · Start Twitch stream
|
||||||
|
sequence:
|
||||||
|
- service: script.tv_prepare_for_playback
|
||||||
|
- service: androidtv.adb_command
|
||||||
|
entity_id: media_player.nvidia_shield
|
||||||
|
data_template:
|
||||||
|
command: "am start -a android.intent.action.VIEW -d twitch://stream/{{ channel }}"
|
||||||
|
|
||||||
tv_fireplace:
|
tv_fireplace:
|
||||||
icon: mdi:fireplace
|
icon: mdi:fireplace
|
||||||
alias: TV · Fireplace
|
alias: TV · Fireplace
|
||||||
sequence:
|
sequence:
|
||||||
- service: sonos.unjoin
|
- service: script.tv_prepare_for_playback
|
||||||
data:
|
data:
|
||||||
entity_id: media_player.living_room
|
|
||||||
- service: media_player.select_source
|
|
||||||
data:
|
|
||||||
entity_id: media_player.living_room
|
|
||||||
source: TV
|
|
||||||
- service: media_player.volume_set
|
|
||||||
data:
|
|
||||||
entity_id: media_player.living_room
|
|
||||||
volume_level: 0.08
|
volume_level: 0.08
|
||||||
- service: media_extractor.play_media
|
- service: media_extractor.play_media
|
||||||
data:
|
|
||||||
entity_id: media_player.shield
|
entity_id: media_player.shield
|
||||||
|
data:
|
||||||
media_content_id: "https://www.youtube.com/watch?v=AWKzr6n0ea0"
|
media_content_id: "https://www.youtube.com/watch?v=AWKzr6n0ea0"
|
||||||
media_content_type: video/youtube
|
media_content_type: video/youtube
|
||||||
|
|
||||||
@@ -44,7 +40,44 @@ script:
|
|||||||
alias: Play the latest PDS
|
alias: Play the latest PDS
|
||||||
sequence:
|
sequence:
|
||||||
- service: media_extractor.play_media
|
- service: media_extractor.play_media
|
||||||
data_template:
|
|
||||||
entity_id: media_player.shield
|
entity_id: media_player.shield
|
||||||
|
data_template:
|
||||||
media_content_id: "{{ state_attr('sensor.philip_defranco', 'url') }}"
|
media_content_id: "{{ state_attr('sensor.philip_defranco', 'url') }}"
|
||||||
media_content_type: video/youtube
|
media_content_type: video/youtube
|
||||||
|
|
||||||
|
tv_prepare_for_playback:
|
||||||
|
alias: TV · Prepare for playback
|
||||||
|
sequence:
|
||||||
|
- service: sonos.unjoin
|
||||||
|
entity_id: media_player.living_room
|
||||||
|
- service: media_player.select_source
|
||||||
|
entity_id: media_player.living_room
|
||||||
|
data:
|
||||||
|
source: TV
|
||||||
|
- service: media_player.volume_set
|
||||||
|
entity_id: media_player.living_room
|
||||||
|
data_template:
|
||||||
|
volume_level: "{{ volume_level | default(0.3) }}"
|
||||||
|
- service: media_player.turn_on
|
||||||
|
entity_id: media_player.nvidia_shield
|
||||||
|
|
||||||
|
automation:
|
||||||
|
- alias: TV · Join Beam to Sonos group when off
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: media_player.living_room_tv
|
||||||
|
to: "off"
|
||||||
|
action:
|
||||||
|
- service: sonos.join
|
||||||
|
data:
|
||||||
|
master: media_player.master_bedroom
|
||||||
|
entity_id: media_player.living_room
|
||||||
|
|
||||||
|
homeassistant:
|
||||||
|
customize:
|
||||||
|
media_player.living_room_tv:
|
||||||
|
icon: mdi:television
|
||||||
|
friendly_name: LG TV
|
||||||
|
media_player.nvidia_shield:
|
||||||
|
icon: mdi:television-ambient-light
|
||||||
|
friendly_name: Nvidia Shield
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
sensor:
|
||||||
|
- platform: twitch
|
||||||
|
client_id: !secret twitch_client_id
|
||||||
|
channels:
|
||||||
|
- LIRIK
|
||||||
|
- day9tv
|
||||||
|
- cohhcarnage
|
||||||
|
- sacriel
|
||||||
@@ -69,7 +69,7 @@ script:
|
|||||||
entity_id: input_boolean.sarah_talking
|
entity_id: input_boolean.sarah_talking
|
||||||
# Don't shout :)
|
# Don't shout :)
|
||||||
- service: media_player.volume_set
|
- service: media_player.volume_set
|
||||||
entity_id: group.all_sonos
|
entity_id: media_player.master_bedroom
|
||||||
data_template:
|
data_template:
|
||||||
volume_level: >-
|
volume_level: >-
|
||||||
{% if now().strftime('%H')|int < 6 and now().strftime('%H')|int > 0 %}
|
{% if now().strftime('%H')|int < 6 and now().strftime('%H')|int > 0 %}
|
||||||
|
|||||||
@@ -98,3 +98,5 @@ tile_password: pass
|
|||||||
|
|
||||||
tuya_username: email
|
tuya_username: email
|
||||||
tuya_password: pass
|
tuya_password: pass
|
||||||
|
|
||||||
|
twitch_client_id: client-id
|
||||||
|
|||||||
Reference in New Issue
Block a user