Logitech harmony Hub LOVELACE UI Fail

ok thank you i read and search but is not really simply

ps : i use home assistant in a QNAP device with directly QPKG i dont have hass.io and is very diffcule to access

It’s on the top of every post on every page inside this forum:

1 Like
SWITCHES.YAML
- platform: template
  switches:
  sfrtv:
    value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'sfrtv') }}"
    turn_on:
      service: remote.turn_on
      data:
        entity_id: remote.lgtv
        activity: 'sfrtv'
    turn_off:
      service: remote.turn_on
      data:
        entity_id: remote.lgtv
        activity: 'PowerOff'
  
  # Android TV
  androidtv:
    value_template: "{{ is_state_attr('remote.lgtv', 'current_activity', 'androidtv') }}"
    turn_on:
      service: remote.turn_on
      data:
        entity_id: remote.lgtv
        activity: 'androidtv'
    turn_off:
      service: remote.turn_on
      data:
        entity_id: remote.lgtv
        activity: 'PowerOff'
ui-lovelace.yaml
resources:
  - url: /local/bignumber-card.js?v=0.0.1
    type: js
  - url: /local/monster-card.js?v=0.0.1
    type: js
  - url: /local/gauge-card.js?v=0.0.1
    type: js
  - url: /local/last-motion-card.js?v=0.0.1
    type: js
  - url: /local/card-tracker.js?v=0.0.1
    type: js
  - url: /local/useful-markdown-card.js?v=0.0.1
    type: js
    
#################################################################
#                                                               #
#                            Accueil                            #
#                                                               #
#################################################################

name: Deki's Home
views:
- icon: mdi:home
  title: Accueil
  id: home
  cards:

    # - type: picture-elements
    #   image: /local/hatheme3.jpg
    #   elements:
    #     - type: state-label
    #       entity: sensor.time
    #       style:
    #         top: 8%
    #         left: 10%
    #         color: rgb(249, 251, 255)
    #         text-shadow: 2px 2px DarkSlateGrey
    #         font-family: Trebuchet MS
    #         font-weight: bold
    #         pointer-events: none
    #         text-rendering: optimizeLegibility
    #         -moz-osx-font-smoothing: grayscale
    #         font-smoothing: antialiased
    #         -webkit-font-smoothing: antialiased
            
    #     - type: state-icon
    #       entity: sensor.outside_temp
    #       style:
    #         top: 7.8%
    #         left: 80%
    #         pointer-events: none
    #         max-width: 24px
    #         max-height: 24px
    #         color: rgb(249, 251, 255)
            
    #     - type: state-label
    #       entity: sensor.outside_temp
    #       style:
    #         top: 8%
    #         left: 90%
    #         color: rgb(249, 251, 255)
    #         font-family: Trebuchet MS
    #         font-weight: bold
    #         text-shadow: 2px 2px DarkSlateGrey
    #         text-rendering: optimizeLegibility
    #         -moz-osx-font-smoothing: grayscale
    #         font-smoothing: antialiased
    #         -webkit-font-smoothing: antialiased
            
    #     - type: state-label
    #       entity: sensor.time_of_day
    #       style:
    #         top: 40%
    #         left: 50%
    #         color: rgb(249, 251, 255)
    #         font-size: 200%
    #         pointer-events: none
    #         text-shadow: 2px 2px DarkSlateGrey
    #         font-family: Trebuchet MS
    #         font-style: oblique
    #         font-weight: 400
    #         text-rendering: optimizeLegibility
    #         -moz-osx-font-smoothing: grayscale
    #         font-smoothing: antialiased
    #         -webkit-font-smoothing: antialiased
            
    #     - type: state-label
    #       entity: sensor.outside_alerts
    #       style:
    #         top: 52%
    #         left: 50%
    #         color: rgb(249, 251, 255)
    #         font-family: Trebuchet MS
    #         font-style: oblique
    #         text-shadow: 2px 2px DarkSlateGrey
    #         font-size: 120%
    #         pointer-events: none
    #         font-weight: 400
    #         text-rendering: optimizeLegibility
    #         -moz-osx-font-smoothing: grayscale
    #         font-smoothing: antialiased
    #         -webkit-font-smoothing: antialiased


    - type: picture-glance
      title: Garage
      image:
      camera_image: camera.garage
      entities:
        - camera.garage
        - camera.enable_motion_detection
        - light.garden_light
        - binary_sensor.front_door

    - type: picture-glance
      title: Veranda
      image:
      navigation_path: /lovelace/kitchen
      camera_image: camera.veranda
      entities:
        - camera.veranda
        - binary_sensor.motion_kitchen
        - input_select.dishwasher_status
        - climate.kitchen

    - type: picture-glance
      title: Salle
      image:
      navigation_path: /lovelace/living_room
      camera_image: camera.salon
      entities:
        - camera.salon
        - binary_sensor.motion_living_room
        - group.living_room_lights
        - switch.living_room_scentsy_relay

    - type: picture-glance
      title: Salon
      image:
      navigation_path: /lovelace/front_room
      camera_image: camera.salon_2
      entities:
        - camera.salon_2
        - binary_sensor.motion_front_room
        - light.front_room_main_light
        
    - type: picture-glance
      image: https://home-assistant-lovelace-gallery.netlify.com/images/living_room.png
      title: Salon
      navigation_path: /lovelace/front_room
      entities:
        - binary_sensor.motion_bedroom
        - switch.power_bedroom_humidifier
        - switch.scentsy_bedroom
        - light.bedroom_main_light
        
    - type: picture-glance
      image: https://www.meubis.be/files/cache/small/files/lester-20sfeer-58ad86b1c1e87.JPG
      title: Salle
      navigation_path: /lovelace/living_room
      entities:
        - binary_sensor.motion_bedroom
        - switch.power_bedroom_humidifier
        - switch.scentsy_bedroom
        - light.bedroom_main_light
        
    - type: picture-glance
      image: https://home-assistant-lovelace-gallery.netlify.com/images/kitchen.png
      title: Cuisine
      navigation_path: /lovelace/kitchen
      entities:
        - binary_sensor.motion_bedroom
        - switch.power_bedroom_humidifier
        - switch.scentsy_bedroom
        - light.bedroom_main_light  

    - type: picture-glance
      image: https://images2.roomstogo.com/is/image/roomstogo/br_rm_belmar_black_pan~Belmar-Black-5-Pc-Queen-Bedroom.jpeg
      title: Chambre
      navigation_path: /lovelace/bedroom
      entities:
        - binary_sensor.motion_bedroom
        - switch.power_bedroom_humidifier
        - switch.scentsy_bedroom
        - light.bedroom_main_light

# "zones"
# outdoor
# kitchen
# living Room
# front Room
# bedroom
# spare Room
# Circulation areas


    - type: glance
      title: Lumière Maison
      entities:
        - entity: light.yeelight_color2_7c49ebb72dd2
          name: Salon
        - entity: light.yeelight_color2_7c49ebb7ff82
          name: Salle
        - entity: light.yeelight_color2_7c49ebb73a90
          name: Cuisine

          
          
          
          
#################################################################
#                                                               #
#                            Salon                              #
#                                                               #
#################################################################


           

- icon: mdi:television
  title: Salon
  id: front_room
  cards:
    - type: vertical-stack
      cards:
        - type: picture-entity
          title: Salon Camera
          entity: camera.salon_2
          camera-image: camera.salon_2
          show_info: false
    - type: entities
      entities: 
        - switch.wemo_switch
    - type: entities
      title: Yeelight
      entities:
        - light.yeelight_color2_7c49ebb72dd2
    - type: picture
      image: https://cdn.shopify.com/s/files/1/1547/6351/files/returns-2014.jpg
      navigation_path: /lovelace/home/

So you are very close, The guy in that post uses picture-elements to make that nice remote. He then uses icon elements using template switches:

  - type: picture-elements
    image: /local/someimage.jpg
    elements:
      - type: icon
        icon: mdi:android
        tap_action: toggle
        entity: switch.androidtv
        style:
          top: 10%
          left: 10%
      - type: icon
        icon: mdi:television
        tap_action: toggle
        entity: switch.lgtv
        style:
          top: 10%
          left: 90%

You’ll have to play around with the style positions and add the image you want.

so i have add code.
I have uploaded all image in www/icons/media_icons/

add code in my ui-lovelace.yaml

- type: picture-elements
image: /local/icons/media_icons/LHarmonyBG.jpg
elements:
  - type: icon
    icon: mdi:android
    tap_action: toggle
    entity: switch.androidtv
    style:
      top: 10%
      left: 10%
  - type: icon
    icon: mdi:television
    tap_action: toggle
    entity: switch.lgtv
    style:
      top: 10%
      left: 90%

and i got this error :

Lovelace

while parsing a block collection in “/share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/ui-lovelace.yaml”, line 224, column 5 expected <block end>, but found ‘?’ in “/share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/ui-lovelace.yaml”, line 240, column 5

line 224 is :
- type: vertical-stack
line 240 is :
image: /local/icons/media_icons/LHarmonyBG.jpg

Do you have a file in that location?

When you specifiy /local/, that is refering to config/www directory.

So your folder structure should have a www folder inside the config folder.

Quick question, if you enable the home assistant skill in alexa, can you use alexa to turn off these “switches”

Yes, template switches act like a hardware switch:

This is my configuration for Harmony template switches (and a few others):

  - platform: template
    switches:
        # ZONE 1 MEDIA SWITCH
        zone_1:
          value_template: "{{ is_state('media_player.yamaha_receiver', 'on') }}"
          turn_on:
            service: media_player.turn_on
            entity_id: media_player.yamaha_receiver
          turn_off:
            service: media_player.turn_off
            entity_id: media_player.yamaha_receiver
              
        # ZONE 2 MEDIA SWITCH
        zone_2:
          value_template: "{{ is_state('media_player.yamaha_receiver_zone_2', 'on') }}"
          turn_on:
            service: media_player.turn_on
            entity_id: media_player.yamaha_receiver_zone_2
          turn_off:
            service: media_player.turn_off
            entity_id: media_player.yamaha_receiver_zone_2
        
        # XBOX HARMONY ACTIVITY
        xbox_one:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Xbox One') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'Xbox One'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'
        
        # PLAYSTATION HARMONY ACTIVITY
        ps4:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'PS4') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PS4'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'
        
        # WII U HARMONY ACTIVITY
        wii_u:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Wii U') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'Wii U'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'
        
        # PC HARMONY ACTIVITY
        pc:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'PC') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PC'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'
        
        # SWITCH HARMONY ACTIVITY
        switch:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'Switch') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'Switch'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'
        
        # TV HARMONY ACTIVITY
        tv:
          value_template: "{{ is_state_attr('remote.living_room', 'current_activity', 'TV') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'TV'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.living_room
              activity: 'PowerOff'
        
        # AUDIO 1, USED FOR ECHO AND MUSIC ZONE 1
        audio_1:
          value_template: "{{ is_state_attr('media_player.yamaha_receiver', 'source', 'Echo') and is_state('switch.floating_outlet_switch', 'on') }}"
          turn_on:
            - service: switch.turn_on
              entity_id: switch.floating_outlet_switch
            - service: media_player.turn_on
              entity_id: media_player.yamaha_receiver
            - service: media_player.select_source
              data:
                entity_id: media_player.yamaha_receiver
                source: Echo
            - service: media_player.volume_set
              data:
                entity_id: media_player.yamaha_receiver
                volume_level: 0.7
          turn_off:
            - service: switch.turn_off
              entity_id: switch.floating_outlet_switch
            - service: media_player.turn_off
              entity_id: media_player.yamaha_receiver

        # AUDIO 2, USED FOR ECHO AND MUSIC ZONE 2
        audio_2:
          value_template: "{{ is_state_attr('media_player.yamaha_receiver_zone_2', 'source', 'Echo') and is_state('switch.floating_outlet_switch', 'on') }}"
          turn_on:
            - service: switch.turn_on
              entity_id: switch.floating_outlet_switch
            - service: media_player.turn_on
              entity_id: media_player.yamaha_receiver_zone_2
            - service: media_player.select_source
              data:
                entity_id: media_player.yamaha_receiver_zone_2
                source: Echo
            - service: media_player.volume_set
              data:
                entity_id: media_player.yamaha_receiver_zone_2
                volume_level: 0.7
          turn_off:
            - service: switch.turn_off
              entity_id: switch.floating_outlet_switch
            - service: media_player.turn_off
              entity_id: media_player.yamaha_receiver_zone_2

And in lovelace, I use a conditional card with a picture-glance card and a few entity cards. Here’s that config:

views:
  - icon: mdi:television
    title: Entertainment
    id: entertainment
    cards:
      - type: vertical-stack
        cards:
          - type: picture-glance
            title: Harmony
            entities:
              - switch.xbox_one
              - switch.ps4
              - switch.wii_u
              - switch.pc
              - switch.switch
              - switch.tv
            state_image:
              "PowerOff": /local/images/power_off.png
              "Xbox One": /local/images/xbox_one_logo.png
              "PS4": /local/images/playstation_logo.png
              "Wii U": /local/images/wiiu_logo.png
              "PC": /local/images/windows_logo.png
              "Switch": /local/images/nintendo_switch_logo.png
              "TV": /local/images/sony_logo.png
            entity: sensor.harmony_activity
          - type: entity-filter
            entities:
              - sensor.redacted
              - sensor.xbox_current
            state_filter:
              - 'Online'
              - 'Home'
              - 'Netflix'
            show_empty: false
      - type: vertical-stack
        cards: 
          - type: picture-glance
            title: Yamaha Receiver
            entities:
              - switch.zone_1
              - switch.audio_1
              - switch.zone_2
              - switch.audio_2
            image: /local/images/rxv677.png
          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: 'on'
              - entity: switch.zone_2
                state: 'on'
            card:
              type: entities
              entities:
                - entity: input_number.yamaha_receiver
                  name: Zone 1 Volume
                - entity: input_number.yamaha_receiver_zone_2
                  name: Zone 2 Volume
          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: 'on'
              - entity: switch.zone_2
                state: 'off'
            card:
              type: entities
              entities:
                - entity: input_number.yamaha_receiver
                  name: Volume
          - type: conditional
            conditions:
              - entity: switch.zone_1
                state: 'off'
              - entity: switch.zone_2
                state: 'on'
            card:
              type: entities
              entities:
                - entity: input_number.yamaha_receiver_zone_2
                  name: Volume

And this is what it ends up looking like:

Powered Off

Xbox On

PlayStation On & Receiver Zone 2 On

2 Likes

some resultat with www

image: /local/www/icons/media_icons/LHarmonyBG.jpg

Lovelace

while parsing a block collection in “/share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/ui-lovelace.yaml”, line 224, column 5 expected <block end>, but found ‘?’ in “/share/CACHEDEV1_DATA/.qpkg/Home-Assistant/CONFIG_DIR/ui-lovelace.yaml”, line 240, column 5

ps: i love your interface for power switch

after i have try just

- type: entitites
  title: Harmony
  entities:
    - switch.androidtv
    - switch.lgtv

interface work but this part dont work i have card error in HA :

Picture0002

:man_facepalming:

Your folder structure has the www, not the path you write in the image.

For example:

file location in home assistant OS:

config/www/icons/media_icons/LHarmonyBG.jpg

then your yaml would location would be:

image: /local/icons/media_icons/LHarmonyBG.jpg

spelling error

- type: entities

thank you Petro HA accepte code but error after :

i go try your config :slight_smile:

The errors are saying unknown card type.

Look at your spacing, it appears as if your elements are at the card indentation level. See how elements says ‘null’? null means empty.

work with :

- type: entities
  title: Harmony Hub
  entities:
    - switch.sfrtv
    - switch.androidtv

but is not lovely lol

again 100000x thank you for your precious help !!!

I would have hoped to have a more beautiful graphic with images of funds and at least I can play on the sound but shame

at least I can turn on and turn off the tv

hello Petro,
New question now if i need send commande via protocol remote.send_command

could you help me please ?
Exemple remote.send_command for VolumeUp and VolumeDown for activity:51830162 (it’s the home cinema)

I have this in my scripts.yaml

### Living room volume up (Denon)
lr_volume_up:
  alias: Volume Up
  sequence:
    - service: remote.send_command
      data:
        entity_id: remote.YOUR_HARMONY
        device: XXXXXXXX # Device ID number
        command:
          - VolumeUp

### Living room volume down (Denon)
lr_volume_down:
  alias: Volume Down
  sequence:
    - service: remote.send_command
      data:
        entity_id: remote.YOUR_HARMONY
        device: XXXXXXXX # Device ID number
        command:
          - VolumeDown

### Living room volume mute (Denon)
lr_volume_mute:
  alias: Volume Mute
  sequence:
    - service: remote.send_command
      data:
        entity_id: remote.YOUR_HARMONY
        device: XXXXXXXX # Device ID number
        command:
          - Mute

thank you i try your script :=)

Hi there,

I’m trying to implement template switches for my Harmony activities, but I’m having a bit of trouble. When I restarted HA after updating my config with the switches none of the new template switches appear as entities. I’m not getting any errors in the UI or the log about failure to setup switch.template or anything like that. Can anyone take a look at my config snippet and point me in the right direction? Note: I haven’t even tried to bring the switches into Lovelace, since the aren’t showing up as entities yet…

  - platform: template
    .
	.
	redacted template sensors here
    .
    .	
          
#Harmony Activities
    switches:
    Sling TV:
          value_template: "{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Watch Sling TV') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'Watch Sling TV'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'PowerOff'
              
    ESPN:
          value_template: "{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Watch ESPN') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'Watch ESPN'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'PowerOff'
              
    Baseball:
          value_template: "{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Watch Baseball') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'Watch Baseball'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'PowerOff'
              
    DVD:
          value_template: "{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Watch a DVD') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'Watch a DVD'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'PowerOff'
              
    Chromecast:
          value_template: "{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Watch Chromecast') }}"
          turn_on:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'Watch Chromecast'
          turn_off:
            service: remote.turn_on
            data:
              entity_id: remote.harmony_hub
              activity: 'PowerOff'

Thanks.

  1. Your indentation on each switch is wrong.
  2. You are capitalizing the object_id of the switch. If you want to name your switches, us the friendly_name attribute, that’s what it’s for.
  3. You also use a space in your object_id, that will cause yaml to mess up upon loading. Use underscores and lowercase for ALL object_ids.
  4. You have some extra spaces on all lines under the object_id. Generally, you want to keep 2 spaces per indent

example:

first_indent:
  second_indent:
    third_indent:
      fourth_indent:  Each indent is 2 spaces in from the other indents.

Take a look at the fixed Sling TV switch and apply the changes to the others:

  - platform: template
    .
	.
	redacted template sensors here
    .
    .	
          
#Harmony Activities
    switches:
      sling_tv: #<--------------OBJECT_ID
        friendly_name: Sling TV
        value_template: "{{ is_state_attr('remote.harmony_hub', 'current_activity', 'Watch Sling TV') }}"
        turn_on:
          service: remote.turn_on
          data:
            entity_id: remote.harmony_hub
            activity: 'Watch Sling TV'
        turn_off:
          service: remote.turn_on
          data:
            entity_id: remote.harmony_hub
            activity: 'PowerOff'

Also, for further explanation:

switch.sling_tv # entity_id for your switch
\____/ \______/
   ^       ^
   |       |
domain     |
           |
        object_id
1 Like