Last active
March 23, 2019 22:31
-
-
Save xbmcnut/31132db324e9032710bb4ac6c165100e to your computer and use it in GitHub Desktop.
Package to control my Harmony Hub system. Switches are added to Cloud config for Google and Alexa control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################### | |
## Customize | |
################################### | |
homeassistant: | |
customize: | |
switch.kodi: | |
hidden: false | |
icon: mdi:movie-roll | |
switch.magic_tv: | |
hidden: false | |
icon: mdi:television-box | |
switch.sky: | |
hidden: false | |
icon: mdi:satellite-uplink | |
switch.tv: | |
hidden: false | |
icon: mdi:television-classic | |
remote.poaka_lounge: | |
hidden: true | |
################################### | |
## Automations | |
################################### | |
# This automation is to update the input_select when the Harmony's | |
# activity was changed from somewhere else, e.g. using its physical remote. | |
automation: | |
- alias: Update Harmony input_select | |
hide_entity: True | |
trigger: | |
platform: state | |
entity_id: remote.poaka_lounge | |
condition: | |
condition: template | |
value_template: "{{ trigger.to_state.attributes.current_activity in state_attr('input_select.harmony', 'options') }}" | |
action: | |
service: input_select.select_option | |
data_template: | |
entity_id: input_select.harmony | |
option: "{{ state_attr('remote.poaka_lounge', 'current_activity') }}" | |
- alias: Set Harmony activity using input_select | |
hide_entity: True | |
trigger: | |
platform: state | |
entity_id: input_select.harmony | |
action: | |
service: remote.turn_on | |
entity_id: remote.poaka_lounge | |
data_template: | |
activity: > | |
{% if is_state("input_select.harmony", "Watch Sky") %} | |
28651596 | |
{% elif is_state("input_select.harmony", "Watch Kodi") %} | |
28651595 | |
{% elif is_state("input_select.harmony", "Watch Sky Upstairs") %} | |
28651594 | |
{% elif is_state("input_select.harmony", "Watch TV") %} | |
28651593 | |
{% elif is_state("input_select.harmony", "Watch Magic TV") %} | |
28651597 | |
{% else %} | |
-1 | |
{% endif %} | |
################################## | |
# Group | |
################################## | |
group: | |
harmony_remote: | |
name: Harmony Remote | |
entities: | |
- remote.poaka_lounge | |
- input_select.harmony | |
- switch.kodi | |
- switch.magic_tv | |
- switch.sky | |
- switch.tv | |
#### INPUTS #### | |
################ | |
input_select: | |
harmony: | |
name: Harmony | |
options: | |
- PowerOff | |
- Watch Kodi | |
- Watch Magic TV | |
- Watch Sky | |
- Watch Sky Upstairs | |
- Watch TV | |
icon: mdi:monitor | |
#### SWITCHES #### | |
################## | |
switch: | |
- platform: template | |
switches: | |
kodi: | |
friendly_name: "Watch Kodi" | |
value_template: "{{ is_state_attr('remote.poaka_lounge', 'current_activity', 'Watch Kodi') }}" | |
turn_on: | |
service: remote.turn_on | |
entity_id: remote.poaka_lounge | |
data: | |
activity: '28651595' | |
turn_off: | |
service: remote.turn_off | |
entity_id: remote.poaka_lounge | |
- platform: template | |
switches: | |
magic_tv: | |
friendly_name: "Watch Magic TV" | |
value_template: "{{ is_state_attr('remote.poaka_lounge', 'current_activity', 'Watch Magic TV') }}" | |
turn_on: | |
service: remote.turn_on | |
entity_id: remote.poaka_lounge | |
data: | |
activity: '28651597' | |
turn_off: | |
service: remote.turn_off | |
entity_id: remote.poaka_lounge | |
- platform: template | |
switches: | |
sky: | |
friendly_name: "Watch Sky" | |
value_template: "{{ is_state_attr('remote.poaka_lounge', 'current_activity', 'Watch Sky') }}" | |
turn_on: | |
service: remote.turn_on | |
entity_id: remote.poaka_lounge | |
data: | |
activity: '28651596' | |
turn_off: | |
service: remote.turn_off | |
entity_id: remote.poaka_lounge | |
- platform: template | |
switches: | |
tv: | |
friendly_name: "Watch TV" | |
value_template: "{{ is_state_attr('remote.poaka_lounge', 'current_activity', 'Watch TV') }}" | |
turn_on: | |
service: remote.turn_on | |
entity_id: remote.poaka_lounge | |
data: | |
activity: '28651593' | |
turn_off: | |
service: remote.turn_off | |
entity_id: remote.poaka_lounge |
Changed first automation to the following to prevent the error below which was preventing the hassio component from loading after the upgrade to 0.90.0:
2019-03-23 14:59:15 WARNING (MainThread) [homeassistant.components.input_select] Invalid option: None (possible options: PowerOff, Watch Kodi, Watch Magic TV, Watch Sky, Watch TV)
automation:
- alias: Update Harmony input_select
hide_entity: True
trigger:
platform: state
entity_id: remote.poaka_lounge
condition:
condition: template
value_template: "{{ trigger.to_state.attributes.current_activity in state_attr('input_select.harmony', 'options') }}"
action:
service: input_select.select_option
data_template:
entity_id: input_select.harmony
option: "{{ state_attr('remote.poaka_lounge', 'current_activity') }}"
Thanks again to @petro here https://community.home-assistant.io/t/trying-to-get-harmony-working/69198/15
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Changed
"{{ states.remote.poaka_lounge.attributes.current_activity == 'Watch Kodi' }}"
to"{{ is_state_attr('remote.poaka_lounge', 'current_activity', 'Watch Kodi') }}"
along with three other entities andoption: "{{ states.remote.poaka_lounge.attributes.current_activity }}"
tooption: "{{ state_attr('remote.poaka_lounge', 'current_activity') }}"
Thanks to @petro here https://community.home-assistant.io/t/trying-to-get-harmony-working/69198/12