Harmony Hub Activity

Thanks petro!!
That was very helpful!!
Based on your code I changed my code:

In my switches.yaml I added this:

- platform: template
  switches:
    # TV - Theater
    theater_tv:
      friendly_name: TV
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'


    # Play PS4
    ps4:
      friendly_name: PS4
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'PS4') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PS4'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'


    # Watch Apple TV
    appletv:
      friendly_name: Apple TV
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'Apple TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'Apple TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'


    # AC in Theater
    theater_ac:
      friendly_name: AC
      value_template: "{{ is_state_attr('remote.theater', 'current_activity', 'AC') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'AC'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.theater
          activity: 'PowerOff'

To make it look something like this at the frontend:

Thank You Very Much!!

1 Like

To add a channel you can do something like this…
In my scripts.yaml file I have this to change channel (suppose I want to change the channel to 708)

#################################################################
## Tata Sky Fav Channels
#################################################################
    ts_natgeo:
    alias: National Geographic
    sequence:
      - service: remote.send_command
        data:
          command:
            - 7
            - 0
            - 8
          device: 13005117
          delay_secs: 0.6

  ts_sonylive:
    alias: Sony Live
    sequence:
      - service: remote.send_command
        data:
          command:
            - 4
            - 8
            - 3
          device: 13005117
          delay_secs: 0.6

It looks like this in frontend:

I’ll add channel icons to this shortly.
Can I change EXECUTE to something else???
I don’t know of any other way of sending commands in sequence to change channels.
Looking for a better way to do this myself.
It would be great if somebody could chip in with a more elegant/practical solution.

Thanks!

1 Like

Your scripts are missing an entity_id for the remote.send_command service. As soon as you get a second remote, your stuff is going to break. To be honest, I’m surprised it even works without the entity_id.

As for the word execute, changing that isn’t possible without using a custom UI.

1 Like

It doesn’t work like that and creating complete remotes seems a huge backwards step from what Harmony does itself.

The idea of the HA integration is to pick specific controls you want to include in automations, getting it set up is all explained in the supporting threads/docs so suggest you read them and then ask specific questions.

Oh… That’s really helpful…
Us newcomers make these silly mistakes without knowing it.
A little explanation goes a long way.
This forum is a godsend!

Thank You So Much!!

1 Like

so, i have try a lot of solution but… not working…
i have sucessfully add just 1 activity but not all…

in my configuration.yaml :

remote:

  • platform: harmony
    name: tvlg
    host: 192.68.1.86

in my switches.yaml

Regarde la TV

    Regarde la TV:
      value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'Regarde la TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'Regarde la TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'PowerOff'
    
    # Android TV
    Android TV:
      value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'Android TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'Android TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'PowerOff'

and in my harmony_harmony_hub.conf :

Activities
31547838 - Regarder la TV
32707809 - Android Tv
-1 - PowerOff

Device Commands
53413622 - Lecteur multimédia Tanix
PowerToggle
Mute
VolumeDown
VolumeUp
DirectionDown
DirectionLeft
DirectionRight
DirectionUp
OK
Return
Menu
Home
Mouse
51830162 - Logitech Z-5500
PowerToggle
Mute
VolumeDown
VolumeUp
VolumeCenterDown
VolumeCenterUp
Settings
Effect
InputCoax
InputDirect
InputOptical
InputStereo1
InputStereo2
InputStereo3
SubWooferDown
SubWooferUp
SurroundDown
SurroundUp
Test
51830149 - Enregistreur numérique SFR
PowerToggle
0
1
2
3
4
5
6
7
8
9
Mute
VolumeDown
VolumeUp
ChannelPrev
ChannelDown
ChannelUp
DirectionDown
DirectionLeft
DirectionRight
DirectionUp
OK
Stop
Play
Rewind
Pause
FastForward
Record
Menu
Guide
Info
Exit
VOD
51830092 - TV LG
PowerOff
PowerOn
PowerToggle
0
1
2
3
4
5
6
7
8
9
Mute
VolumeDown
VolumeUp
ChannelPrev
ChannelDown
ChannelUp
DirectionDown
DirectionLeft
DirectionRight
DirectionUp
OK
Stop
Play
Rewind
Pause
FastForward
Record
Subtitle
Back
Teletext
Favorite
List
LiveTv
Green
Red
Blue
Yellow
Guide
Info
PageDown
PageUp
Exit
Aspect
Settings
3D
App/*
Input
InputAv1
InputAv2
InputComponent1
InputHdmi1
InputHdmi2
InputHdmi3
InputHdmi4
InputTv
MyApps
Q.Menu
SimpLink
Smart
T.Opt
Tv/Radio

Picture0001

where is my error ???

when i add activity in configuration.yaml i have just possibility to turn on / off this activity

your switches are miss spelled and they need to be case sensative: In your first switch: Regarder la TV is missing the r at the end. In your second switch: Android TV the v in TV need to be lowercase.

    Regarde la TV:
      value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'Regarder la TV') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'Regarder la TV'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'PowerOff'
    
    # Android TV
    Android TV:
      value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'Android Tv') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'Android Tv'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'PowerOff'
1 Like

thank you i have corrected switches.yaml
but same result :frowning:

i just view harmony hub but 0 activity

Picture0001

Are you placing them in the switch category inside your configuration.yaml? Are you looking in the switches group on the default view in the Home Assistant interface?

1 Like

i have placed file switches.yaml in CONFIG_DIR folder
and in configuration.yaml when include ```
switch: !include switches.yaml

i have error in confirguration : 
Invalid config for [switch]: required key not provided @ data['platform']. Got None. (See /share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/configuration.yaml, line 102). Please check the docs at https://home-assistant.io/components/switch/

and when i add platform - template i have this error : 
Invalid config for [switch.template]: [Regarder la TV] is an invalid option for [switch.template]. Check: switch.template->switches->Regarder la TV. (See ?, line ?). Please check the docs at https://home-assistant.io/components/switch.template/

You’re missing the -platform.

Your switches file contents should look like this:

  - platform: template
    switches:
      Regarde la TV:
        value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'Regarder la TV') }}"
        turn_on:
          service: remote.turn_on
          data:
            entity_id: remote.lgtv
            activity: 'Regarder la TV'
        turn_off:
          service: remote.turn_on
          data:
            entity_id: remote.lgtv
            activity: 'PowerOff'
      
      # Android TV
      Android TV:
        value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'Android Tv') }}"
        turn_on:
          service: remote.turn_on
          data:
            entity_id: remote.lgtv
            activity: 'Android Tv'
        turn_off:
          service: remote.turn_on
          data:
            entity_id: remote.lgtv
            activity: 'PowerOff'
1 Like

seconde error :

Invalid config for [switch.template]: [Regarder la TV] is an invalid option for [switch.template]. Check: switch.template->switches->Regarder la TV. (See ?, line ?). Please check the docs at https://home-assistant.io/components/switch.template/

bah, you need to follow the yaml rules. No capitals, no spaces for section keys

1 Like

ok i try :slight_smile:

new error… i’m damn !!!

Error loading /share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/configuration.yaml: mapping values are not allowed here
in “/share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/switches.yaml”, line 2, column 13

  • platform: template
    switches:
    tv:
    value_template: “{{ is_state_attr(‘remote.lgtv’, ‘current_activity’, ‘tv’) }}”
    turn_on:
    service: remote.turn_on
    data:
    entity_id: remote.lgtv
    activity: ‘tv’
    turn_off:
    service: remote.turn_on
    data:
    entity_id: remote.lgtv
    activity: ‘PowerOff’

    # Android TV
    android:
      value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'android') }}"
      turn_on:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'android'
      turn_off:
        service: remote.turn_on
        data:
          entity_id: remote.lgtv
          activity: 'PowerOff'
    

YYYYYYYYYEEEEEEEEEEEESSSSSSSSSSSSS

is gooooddd :slight_smile: it’s just a space before “switch”

work fine nowwwwwwwwwwwww

thank you very very very very much :slight_smile:

1 Like

new question, now it’s possible to add specifique commande to activity :

exemple : activity TV : Volume + / Volume - and any channel ?

second : in activity ANDROID (is for android tv box) is possibile to controle ? left, right, down , up , ok volume + / volume - ?

Thank you :slight_smile:

what are you using for lovelace?q

Currently, I use something different. The images in this post are documented here.

Thanks for this advice! Works great!! :smiley: