Sensors:
sensor:
#Harmony hubs
- platform: template
sensors:
tv_room:
value_template: >
{% if is_state("remote.tv_room", 'on') %}
{{ states.remote.tv_room.attributes.current_activity }}
{% else %}
PowerOff
{% endif %}
friendly_name: 'TV Room'
#Track TV Stats
- platform: history_stats
name: TV Time
entity_id: sensor.tv_room
state: 'Watch Roku'
type: time
start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
Switches:
switch:
#Harmony Activity Switches
- platform: template
switches:
# Power on/off
tv_room_power:
friendly_name: "Harmony Power"
value_template: "{{ is_state('remote.tv_room', 'on') }}"
turn_on:
service: remote.turn_on
entity_id: remote.tv_room
turn_off:
service: remote.turn_off
entity_id: remote.tv_room
icon_template: >-
{% if is_state('remote.tv_room', 'on') %}
mdi:power
{% else %}
mdi:power
{% endif %}
#Watch TV
watch_tv:
friendly_name: "TV"
value_template: "{{ is_state_attr('remote.tv_room', 'current_activity', 'Watch TV') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'Watch TV'
turn_off:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'PowerOff'
icon_template: >-
{% if is_state_attr('remote.tv_room', 'current_activity', 'Watch TV') %}
mdi:television-classic
{% else %}
mdi:television-classic
{% endif %}
#Watch Roku
watch_roku:
friendly_name: "Roku"
value_template: "{{ is_state_attr('remote.tv_room', 'current_activity', 'Watch Roku') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'Watch Roku'
turn_off:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'PowerOff'
icon_template: >-
{% if is_state_attr('remote.tv_room', 'current_activity', 'Watch Roku') %}
mdi:alpha-r-circle
{% else %}
mdi:alpha-r-circle-outline
{% endif %}
#Watch A Movie
watch_a_movie:
friendly_name: "Blu-Ray"
value_template: "{{ is_state_attr('remote.tv_room', 'current_activity', 'Watch a Movie') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'Watch a movie'
turn_off:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'PowerOff'
icon_template: >-
{% if is_state_attr('remote.tv_room', 'current_activity', 'Watch a Movie') %}
mdi:disc-player
{% else %}
mdi:disc-player
{% endif %}
#Listen to Music
listen_to_music:
friendly_name: "Net Music"
value_template: "{{ is_state_attr('remote.tv_room', 'current_activity', 'Listen to Music') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'Listen to Music'
turn_off:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'PowerOff'
icon_template: >-
{% if is_state_attr('remote.tv_room', 'current_activity', 'Listen to Music') %}
mdi:music-note-bluetooth
{% else %}
mdi:music-note-bluetooth-off
{% endif %}
#Listen to Volumio
listen_to_volumio:
friendly_name: "Volumio"
value_template: "{{ is_state_attr('remote.tv_room', 'current_activity', 'Listen to Volumio') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'Listen to Volumio'
turn_off:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'PowerOff'
icon_template: >-
{% if is_state_attr('remote.tv_room', 'current_activity', 'Listen to Volumio') %}
mdi:playlist-music
{% else %}
mdi:playlist-music-outline
{% endif %}
#Play Xbox
play_xbox:
friendly_name: "Xbox One"
value_template: "{{ is_state_attr('remote.tv_room', 'current_activity', 'Play Xbox') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'Play Xbox'
turn_off:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'PowerOff'
icon_template: >-
{% if is_state_attr('remote.tv_room', 'current_activity', 'Play Xbox') %}
mdi:xbox
{% else %}
mdi:xbox-controller-off
{% endif %}
#Watch Fire TV
watch_fire_tv:
friendly_name: "Fire TV"
value_template: "{{ is_state_attr('remote.tv_room', 'current_activity', 'Watch Fire TV') }}"
turn_on:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'Watch Fire TV'
turn_off:
service: remote.turn_on
data:
entity_id: remote.tv_room
activity: 'PowerOff'
icon_template: >-
{% if is_state_attr('remote.tv_room', 'current_activity', 'Watch Fire TV') %}
mdi:amazon
{% else %}
mdi:amazon
{% endif %}
Media player:
media_player:
# Onkyo AV Receiver
- platform: onkyo
host: 192.168.1.13
name: Onkyo TX-NR626
max_volume: 75
sources:
dvd: 'Blu-Ray'
video2: 'Roku'
game: 'Xbox'
pc: 'Volumio'
net: 'Network Music'
fm: 'Radio'
aux: 'Fire TV'
Remote:
# Harmony Hubs
remote:
- platform: harmony
name: TV Room
activity: Watch Roku
Input number/select:
input_select:
#Harmony
tv_room:
name: TV Room
options:
- Select Activity
- Watch TV
- Watch Roku
- Watch a Movie
- Listen to Music
- Play Xbox
- Listen to Volumio
- Watch Fire TV
- PowerOff
initial: Select Activity
input_number:
#TV Room Harmony
harmony_my_volume:
icon: mdi:volume-high
name: Volume
initial: 15
min: 0
max: 75
step: 1
Lovelace button card setup:
- color: black
color_type: icon
entity: media_player.onkyo_tx_nr626
icon: 'mdi:volume-mute'
show_name: false
show_state: false
state:
- color: '#FF3333'
operator: template
value: >
return
states['media_player.onkyo_tx_nr626'].attributes.is_volume_muted
=== true
tap_action:
action: call-service
service: remote.send_command
service_data:
command: Mute
device: 26677735
entity_id: remote.tv_room
type: 'custom:button-card'
- color: black
color_type: icon
icon: 'mdi:volume-plus'
tap_action:
action: call-service
service: remote.send_command
service_data:
command: VolumeUp
delay_secs: 0.25
device: 26677735
entity_id: remote.tv_room
num_repeats: 5
type: 'custom:button-card'
- color: black
color_type: icon
icon: 'mdi:volume-minus'
tap_action:
action: call-service
service: remote.send_command
service_data:
command: VolumeDown
delay_secs: 0.25
device: 26677735
entity_id: remote.tv_room
num_repeats: 5
type: 'custom:button-card'
- color: black
color_type: icon
entity: input_number.harmony_my_volume
icon: 'mdi:volume-low'
label_template: |
return states['input_number.harmony_my_volume'].state;
layout: name_state
show_icon: false
show_label: true
show_name: true
show_state: false
size: 95%
styles:
label:
- color: blue
- font-size: 90%
name:
- color: black
- font-size: 90%
tap_action:
action: more-info
service: null
service_data:
entity_id: input_number.harmony_my_volume
type: 'custom:button-card'