Button-Cards calling scripts - card is always with state on, need to change this

just for the fun of it, I wonder it this would work (never tried it but it would seem possible) and make the layout even more meaningful?

          [[[ var bri = states['light.stue_finnsnes'].attributes.brightness;
             return 'hsl(' + bri + ',65%,50%)';
          ]]]

Hi @Mariusthvdb Tried several of those - they do work quite good :slight_smile:
Button-card are soooo powerful.

Next task might be add buttons for different scenes that are part of Philips Hue hub - shouldn’t be to difficult

No it shouldn’t, but even more reason to get those buttons smaller!

have those for you, and posted them somewhere here on the community already :wink:

@Mariusthvdb YAY! That’s exactly what I was looking for; can you share the code ?

try this: Hue scenes mimicked in Ha (and on Buttons, was Tiles) and scroll down.

I did some further tweaking, but it should get you on your way

@Mariusthvdb Would you mind share your images ?

no I wouldn’t :wink:

arctic clear concentrate dimmed energize nightlight off-dark off

savanna spring tropical

They are a bit mixed quality, since I had to make them myself, and not all ‘official’ scenes were available on the net…

1 Like

@Mariusthvdb

Thx bud :slight_smile:

I’ve had a look at the code you had in the other thread, either something is missing or …?
The declutter template for ‘set_hue_scene’ - could you please share this?

Also, you have a call for script ‘script.tiles_set_hue_scene’ but this should be for script ‘set_hue_scene’ ?

decluttering is al there: Hue scenes mimicked in Ha (and on Buttons, was Tiles) - #27 by Mariusthvdb

  set_hue_scene:
    alias: 'Set Hue scene'
    sequence:
      service: hue.hue_activate_scene
      data_template:
        group_name: >
          {{ states('input_select.hue_groups')}}
        scene_name: >
          {{ states('input_select.hue_scenes')}}

  set_hue_scene_direct:
    alias: 'Set Hue scene direct'
    sequence:
      service: hue.hue_activate_scene
      data_template:
        group_name: >
          {{ groupname }}
        scene_name: >
          {{ scenename }}

  tiles_set_hue_scene:
    alias: 'Tiles set Hue scene'
    sequence: 
      service: input_select.select_option
      entity_id: input_select.hue_scenes
      data_template: 
        option: >
          {{ option }}

@Mariusthvdb

I can’t identify the declutter card template ‘set_hue_scene’

      - type: custom:decluttering-card
        template: set_hue_scene
        variables:

sure you can, you already pointed me to the fact it calls the script.tiles_set_hue_scene :wink:

daahhhh; you could have included the template name :rofl: :rofl:

sorry, but it is a separate file, so the name isn’t in the code.
Ive edited the original post to include it now, and added the tiles_set_hue script (which of course is a legacy name, since I don’t use Tiles anymore).

@Mariusthvdb

Currently rebooting HA, but status:

  • Scenes are listed without images
  • Scenes are working by selecting and pressing execute (but assume I could make it ‘one-click’?)

Had to learn decluttering card at the same time after you pointed me to the other post :upside_down_face: Personally, I’ve been using ‘anchors’ up until now.

Btw; do you have Telegram?

its one click in my setup (tap) as the decluttering card uses the tap_action: call-service (and overrides the button_template (which I also use for other cases…)

not sure about the picture, it has been some time since I set those up… maybe a folder incorrectly pointed to?

I’m using your code, and have put the images in /local/hue_scenes/

its one click in my setup (tap) as the decluttering card uses the tap_action: call-service (and overrides the button_template (which I also use for other cases…)

Which of the three scripts you sent me are you calling to get it in one tap on the scene (not using the execute-button) ?

Here’s my code:

DECLUTTER

decluttering_templates:

  button_picture_script_small:
    size: 70%
    show_state: false
    show_label: false
    show_name: true
    show_entity_picture: true
    color_type: card
    aspect_ratio: 1/1
    tap_action:
      action: none
      haptic: light
    hold_action:
      action: more-info
      haptic: success
    color: '#555B65'
    styles:
      name:
        - padding-left: 3px
        - font-weight: bold
        - font-family: Helvetica
        - font-size: 13px
        - color: 'lightgrey'

  set_hue_scene:
    card:
      type: custom:button-card
      template: button_picture_script_small
      entity_picture: '[[entity_picture]]'
      name: '[[name]]'
      tap_action:
        action: call-service
        service: script.execute_set_hue_scene
        service_data:
          option: '[[option]]'
      state:
        - operator: template
          value: >
            [[[
            return states['input_select.hue_scenes'].state == '[[option]]'
            ]]]
          color: '[[color]]'
          styles:
            name:
              - color: '#555B65'

Snippet of lovelace card:

      - type: vertical-stack
        cards:

          - type: horizontal-stack
            cards:

              - type: custom:decluttering-card
                template: set_hue_scene
                variables:
                  - option: Arctic aurora
                  - entity_picture: '/local/hue/scenes/arctic.png'
                  - name: Arctic
                  - color: '#00d0a0'

              - type: custom:decluttering-card
                template: set_hue_scene
                variables:
                  - option: Savanna sunset
                  - entity_picture: '/local/hue_scenes/savanna.png'
                  - name: Savanna
                  - color: '#ff7935'

              - type: custom:decluttering-card
                template: set_hue_scene
                variables:
                  - option: Tropical twilight
                  - entity_picture: '/local/hue_scenes/tropical.png'
                  - name: Tropic
                  - color: '#a03aa3'

And screenshot of images:

in my original decluttering template I use the script.tiles_set_hue_scene and it is posted on the original thread. You have now renamed that I think, but that is of no consequence of course, as long as you rename the backend accordingly.

btw I noticed you added the button card template button_picture_script_small: to the decluttering templates. I wouldn’t know if that causes issues, but it should be a button_card_template.

it could well be that because you reference these incorrectly, it doesn’t use the show_entity_picture: true of that button_card_template.

Yes, I changed the name of the script.

What I’ve done was re-building a clean button-card from the declutter templates and tested - now images are working great !

Though, with your script I still have to select the scene then press Execute…?