LoveLace Glance Toggle

Im trying to get the toggle to work on some lights but instead of just turning them on and off it is bringing up the box where you can change brightness and color. What am I missing?

- type: glance
            title: Lights
            column_width: 'calc(100% / 4)'
            entities:
              - entity: light.living_room
                name: Liv Room
                icon: mdi:lightbulb-outline
                service: light.toggle
              - entity: light.kitchen
                name: Kitchen
                icon: mdi:lightbulb-outline
                service: light.toggle
              - entity: light.strips
                name: Strips
                icon: mdi:lightbulb-outline
                service: light.toggle
              - entity: light.basement_lights
                name: Basement
                icon: mdi:lightbulb-outline
                service: light.toggle
              - entity: light.front_lights
                name: Front
                icon: mdi:lightbulb-outline
                service: light.toggle
              - entity: light.bedroom
                name: Bedroom
                icon: mdi:lightbulb-outline
                service: light.toggle
              - entity: light.office
                name: Office
                icon: mdi:lightbulb-outline
                service: light.toggle
              - entity: light.family_room
                name: Fam Room
                icon: mdi:lightbulb-outline
                service: light.toggle

Should be
‘tap_action: toggle’

You don’t need the service line in there

1 Like

I thought i tried that! guess not, its working now thanks for the quick help

No problem… it’s easy to get caught up in our yaml and we miss the simple stuff I have done it a million times myself… another set of eyes always helps.

Hope you dont mind me using your thread but I was about to create a new thread with the same topic…

I would lika a way to toggle a light with a short press and bring upp the more_info on a long press. Is that possible?

check latest changelog :slight_smile:

I’m having trouble getting this to work in 0.81.1.

          - type: glance
            title: Media
            show_state: false
            entities:
              - entity: switch.switch_subwoofer
                tap_action: toogle

This generates the card properly but clicking the icon does not do anything. Any ideas?

It should work, are you clearing the cache when you reload the interface?

uhm, you mistyped toogle

3 Likes

:man_facepalming:

2 Likes

It is possible to hide icon in a Glance card?

I am trying to hide the icon for HDMI 2 and show only the text.

Are you sure you mean glance card here? Those look like Entity Button Cards.

anyways, if it’s glance…

show_name attribute.

Assuming these are entity-button cards, just give them a non-existent icon e.g. icon: mdi:no_icon_here

1 Like

I’m trying to have a glance panel full of toggle-able icons, but it keeps coming up with this error. Thoughts?

Did you read the docs at all? You don’t have a correct format for tap_action. Word of advice, don’t copy year old code from the forums. Consult the current documentation as yaml format may change over time.

I agree, Petro, but copy pasting the example at the bottom of the page you linked, from the docs that is, even gives the same error:
image
I understand the confusion…

  1. Its not an error it’s a warning. It’s yellow, that means warning. An error would produce a red box on the right.
  2. You can click the buttons in the preview to verify that the action is being taken into account.
  3. Your warning is not the same warning as the guy above. May look similar, but it’s different:

His warning:

Expected a value of type ‘{entity,name,icon} | entity-d’ for ‘entities.0.tap_action’ but recieved “toggle”.

Your warning:

Expected a value of type ‘{entity,name,icon} | entity-d’ for ‘entities.0.tap_action’ but recieved {“action”:“toggle”}.

His warning is wrong format, but the code would still work because it would omit toggle.

Your warning is misplaced and I would consider it a bug. I created an issue so the devs are aware.

error, warning, potato, potahto :smiley:

You’re right, and thanks for raising the issue ticket (could you link it here?)
I agree it is a bug, as I can’t get the switch to toggle with the lovelace yaml above.

I have also tried with this code, which does work for the automation, but not for the lamp…

type: glance
title: Testing
entities:
  - entity: switch.bedlamp
    tap_action:
      action: call-service
      service: switch.toggle
      service-data:
        entity_id: switch.bedlamp
  - entity: automation.turn_off_evening_lights
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.turn_off_evening_lights

The warning is

Expected a value of type {entity,name,icon} | entity-id for entities.0.tap_action but received {"action":"call-service","service":"switch.toggle","service-data":{"entity_id":"switch.bedlamp"}}.

When clicked, I get a popup saying

Failed to call service switch/toggle. must contain at least one of entity_id, area_id

I must be missing something obvious as I am undoubtedly not the first to try this…

You’re over configuring the first glace item. At most you need tap_action: action: toggle. Even then, by default it should be toggleable with just the entity_id.

type: glance
title: Testing
entities:
  - entity: switch.bedlamp
    tap_action:
      action: toggle
  - entity: automation.turn_off_evening_lights
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.turn_off_evening_lights

It should even work like this:

type: glance
title: Testing
entities:
  - entity: switch.bedlamp
  - entity: automation.turn_off_evening_lights
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.turn_off_evening_lights

Edit, and the reason your service isn’t working is because you have a - in your field name for service-data. Should be an underscore. You have it correct in your automation tap action, but not your bedlamp tap action.

type: glance
title: Testing
entities:
  - entity: switch.bedlamp
    tap_action:
      action: call-service
      service: switch.toggle
      service_data:
        entity_id: switch.bedlamp
  - entity: automation.turn_off_evening_lights
    tap_action:
      action: call-service
      service: automation.trigger
      service_data:
        entity_id: automation.turn_off_evening_lights
1 Like