Lovelace - Glance toggle for scenes

His, I’m trying to setup my scenes in a glance view and would like to “activate” when I click on it. (instead of second window giving me the option)

Tried the “tap_action: toggle” but it doesn’t help much (I guess activate isn’t considered a toggle)

Any suggestion or idea to have this working as toggles?

my section in config:

  - title: lumieres
    icon: mdi:lightbulb
    cards:
      - type: glance
        title: Ambiances
        show_state: false
        tap_action: toggle
        show_header_toggle: true
        column_width: 33%
        entities:          
          - scene.haut_lumineux
          - scene.haut_100          
          - scene.haut_relaxe_colorcycle
          - scene.haut_relaxe           
          - scene.haut_dodo
          - scene.haut_dodo_colorcycle  
          - scene.haut_off          
          - scene.soussol_relaxe
          - scene.soussol_off          
          - scene.bureau_full_lights
          - scene.bureau_relaxe         
          - scene.bureau_off 
          - scene.ext_on
          - scene.ext_off

I think this might be related to the “service” parameter but not idea how to apply this to my setup and need here…

Any idea, if it’s not possible, I’ll stop trying…
Pretty sure I need to set it up using the “call service” option and call “scene turn on” but I’m unsure how to format this in my ui-lovelace.yaml…
Thanks in advance!

You need to adjust your entities to have the appropriate attributes. See the entity documentation for glance cards:

  - title: lumieres
    icon: mdi:lightbulb
    cards:
      - type: glance
        title: Ambiances
        show_state: false
        column_width: 33%
        entities:          
          - entity: scene.haut_lumineux
            tap_action: call-service
            service: scene.haut_lumineux
          - scene.haut_100
            tap_action: call-service
            service: scene.haut_100
          - scene.haut_relaxe_colorcycle
            tap_action: call-service
            service: scene.haut_relaxe_colorcycle
          - scene.haut_relaxe
            tap_action: call-service
            service: scene.haut_relaxe
          - scene.haut_dodo
            tap_action: call-service
            service: scene.haut_dodo
          - scene.haut_dodo_colorcycle
            tap_action: call-service
            service: scene.haut_dodo_colorcycle
          - scene.haut_off
            tap_action: call-service
            service: scene.haut_off
          - scene.soussol_relaxe
            tap_action: call-service
            service: scene.soussol_relaxe
          - scene.soussol_off
            tap_action: call-service
            service: scene.soussol_off
          - scene.bureau_full_lights
            tap_action: call-service
            service: scene.bureau_full_lights
          - scene.bureau_relaxe
            tap_action: call-service
            service: scene.bureau_relaxe
          - scene.bureau_off
            tap_action: call-service
            service: scene.bureau_off
          - scene.ext_on
            tap_action: call-service
            service: scene.ext_on
          - scene.ext_off
            tap_action: call-service
            service: scene.ext_off

Thanks, I tried but I keep getting

Mon Oct 15 2018 09:07:03 GMT-0400 (Eastern Daylight Time)

Unable to find service scene/bureau_relaxe

Tries the same in service to test; working form there…

change all the services to scene.turn_on and add entity: before each entity_id:

  - title: lumieres
    icon: mdi:lightbulb
    cards:
      - type: glance
        title: Ambiances
        show_state: false
        column_width: 33%
        entities:          
          - entity: scene.haut_lumineux
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.haut_100
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.haut_relaxe_colorcycle
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.haut_relaxe
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.haut_dodo
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.haut_dodo_colorcycle
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.haut_off
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.soussol_relaxe
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.soussol_off
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.bureau_full_lights
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.bureau_relaxe
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.bureau_off
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.ext_on
            tap_action: call-service
            service: scene.turn_on
          - entity: scene.ext_off
            tap_action: call-service
            service: scene.turn_on
1 Like

YES! thank you so much! It works now.
I actually tried it before but wrote scene.turn.on instead of scene.turn_on :triumph::triumph:

1 Like

Somehow this doe not work for me:

  - title: Lights
    icon: mdi:lightbulb
    cards:        
      - type: glance
        title: Scenes
        show_state: false
        column_width: 33%        
        entities:           
         - entity: scene.away
           tap_action: call-service
           service: scene.turn_on
         - entity: scene.morning
           tap_action: call-service
           service: scene.turn_on
         - entity: scene.sunrise
           tap_action: call-service
           service: scene.turn_on         
         - entity: scene.pre_evening
           tap_action: call-service
           service: scene.turn_on         
         - entity: scene.evening
           tap_action: call-service
           service: scene.turn_on         
         - entity: scene.late_night
           tap_action: call-service
           service: scene.turn_on         
         - entity: scene.late_night_chill
           tap_action: call-service
           service: scene.turn_on
         - entity: scene.netflix
           tap_action: call-service
           service: scene.turn_on         
         - entity: scene.sleep
           tap_action: call-service
           service: scene.turn_on         
         - entity: scene.sportiv    
           tap_action: call-service
           service: scene.turn_on   

image

Nothing happens when pressing the icons. Also there are no errors in my logfile.

Hmm weird, seems like tap_action: toggle is not working AT ALL for me…

      - type: glance
        title: All lights
        entities:           
         - entity: light.bathroom
           tap_action: toggle
         - entity: light.bedroom
           tap_action: toggle
         - entity: light.bedroom_lightstrip
           tap_action: toggle
         - entity: light.diner_table
           tap_action: toggle
         - entity: light.hall_way
           tap_action: toggle
         - entity: light.kitchen
           tap_action: toggle
         - entity: light.livingroom_all
           tap_action: toggle
         - entity: light.bedroom_all
           tap_action: toggle
         - entity: light.livingroom_lamp
           tap_action: toggle
         - entity: light.livingroom_lightstrip
           tap_action: toggle
         - entity: light.livingroom_table
           tap_action: toggle
         - entity: light.office_lightstrip
           tap_action: toggle
         - entity: light.pc
           tap_action: toggle
         - entity: light.table_c
           tap_action: toggle
         - entity: light.table_l
           tap_action: toggle
         - entity: light.table_r
           tap_action: toggle
         - entity: switch.table_lamps
           tap_action: toggle
         - entity: switch.tv_lamp
           tap_action: toggle  

Zero response

If it helps, my tap_action looks like:

tap_action: 
  action: toggle

I just found it indeed, thanks :slight_smile:

so:

tap_action: toggle

becomes:

           tap_action:
             action: toggle 

This however is NOT working:

        entities:           
         - entity: scene.away
           tap_action:
             action: call-service
             service: scene.turn_on
         - entity: scene.morning
           tap_action:
             action: call-service
             service: scene.turn_on   
         ........................

All my light go crazy when I try to execute a scene. It looks like it tries to activate all the scenes at once (cool party effect though ;))

It could be you still need to specify which scene to turn on in the service.
I just did an experiment using lights instead of scene.
The following worked fine.

      - entity: light.foyer_table_lamp
        tap_action: 
          action: call-service
          service: light.toggle
          service_data:
            entity_id: light.foyer_table_lamp

However if I removed “service_data” (comment out last 2 lines)
and thus didn’t specify which light to toggle, I got
strange behaviors like other lights being toggled.

1 Like

I tried the following:

    cards:        
      - type: glance
        title: Scenes
        show_state: false
        column_width: 33%        
        entities:           
         - entity: scene.away
           tap_action:
             action: call-service
             service: scene.turn_on
             scene: scene.away
         - entity: scene.morning
           tap_action:
             action: call-service
             service: scene.turn_on
             scene: scene.morning
    cards:        
      - type: glance
        title: Scenes
        show_state: false
        column_width: 33%        
        entities:           
         - entity: scene.away
           tap_action:
             action: call-service
             service: light.toggle
             service_data: 
               entity_id: scene.away
         - entity: scene.morning
           tap_action:
             action: call-service
             service: light.toggle
             service_data:
               entity_id: scene.morning

Both did not work. However, this finally works:

    cards:        
      - type: glance
        title: Scenes
        show_state: false
        column_width: 33%        
        entities:           
         - entity: scene.away
           tap_action:
             action: call-service
             service: scene.turn_on
             service_data: 
               entity_id: scene.away
         - entity: scene.morning
           tap_action:
             action: call-service
             service: scene.turn_on
             service_data: 
               entity_id: scene.morning
10 Likes

Another interresting syntax.

Just saved me a headache, thanks!

1 Like

I think this is really awkward. That you need to provide the scene again in service_data feels unnecessary, and there should be a better way, since this should be a pretty common thing to do.

One way to solve it would be to make turn_on one of the predefined actions in https://www.home-assistant.io/lovelace/actions/#action so that you could just write:

type: glance
entities:
  - entity: scene.movie_time
    tap_action: turn_on

But even better would be to make the `toggle´ action just do the right thing. Didn’t use to do that until recently?

1 Like

totally agree, this is overcomplicated and a toggle should just activate a scene by default. perhaps you should create a feature request on github :wink:

scene doesn’t have a toggle service, nor do scenes have a state or a turn_off service. Making toggle impossible. so to elaborate:

In order to toggle, you need to know the state of a scene. I.e. Scenes need on/off state. This alone is a topic up for discussion because what dictates a scene being on. Is it that all the lights are on? Or is it that all the lights and their settings are met? Next, you’d need a turn_off service. But what happens when you turn off a scene? Are we assuming we just turn off what was turned on? Are users going to have to build the ‘scene’ being off?

Every time this is brought up in a Feature Request or a WTH, it’s met with technical difficulties that no one wants to agree on. This is why tap_actions are the way they are.

And for what it’s worth, the configuration that is a ‘solution’ that I posted years ago is no longer valid. Currently, this is the shortest way to turn on a scene through a glance card:

EDIT: REMOVED BAD INFO

This is the quickest way

      - type: glance
        title: Scenes 
        entities:           
         - entity: scene.xxx
           tap_action:
             action: call-service
             service: scene.turn_on
             service_data:
               entity_id: scene.xxx
3 Likes

Worked for me, too. Thx. What I do not understand that the top most configuration works for some of the Home Assistant users but not for others like me.

I understand that both versions are supposed to be identical, but the second version works for me while the first one does not :confused:
Thanks for providing both!

For me also only the second version works … might have changed some behavior again?