Harmony Hub Activity

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: