One button for two entities using script will not change button color state

Hello everyone. I am on latest HA and I have an aqara zigbee relay with two channels.
I need one simple button on the dashboard that will toggle both channels ON and OFF.

The only way I managed to solve it was by creating a script using the service “Switch: Toggle” and for Targets I used the two entities “lumini fata garaj l1” and “lumini fata garaj l2”

Now I have my button running the script but the problem is, the icon “mdi:lightbulb-on-10” will not turn Yellow (or gold) when the LEDs are ON. It tries to switch to yellow but it remains blue. I really need to know if the lights are turned on or off.

Thank you for your time.

Please post the configuration for the card you are using. In the card editor click on “Show Code Editor” on the bottom left then copy/paste the configuration so we can see what is going on.

From what you have said I would guess you might have the script set as the entity for the card instead of one of the switches.

type: grid
cards:
  - type: grid
    cards:
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
        entity: scene.good_night
      - type: button
        tap_action:
          action: toggle
        entity: scene.arrive_home
        show_icon: true
      - type: button
        tap_action:
          action: toggle
        entity: scene.leave_home
      - type: button
        tap_action:
          action: toggle
        entity: scene.act_alarm_out
    columns: 4
    square: false
    type: grid
    cards:
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
        entity: switch.bucatarie_priza_banda_led
        name: LED Bucatarie
        icon: mdi:lightbulb-on-10
        show_state: false
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
        entity: switch.out_bme_lux_pir_usa_l8
        name: LED Intrare
        icon: mdi:lightbulb-on-10
      - show_name: true
        show_icon: true
        type: button
        entity: script.led_garaj_1_2
        name: LED Garaj
        icon: mdi:lightbulb-on-10
        show_state: false
        tap_action:
          action: toggle
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: toggle
        entity: script.led_gard_1_2
        name: LED Gard
        icon: mdi:lightbulb-on-10
        show_state: false
    columns: 4
columns: 1
square: false

As I mentioned, the issue is that you have the script as the entity for the button. Scripts are only “on” very briefly, which is why you were seeing it flash yellow then go back to blue. You need to set the entity to one of your switch entities, and change the action to a service call.

      - show_name: true
        show_icon: true
        type: button
        entity: #YOUR_SWITCH_ENTITY#
        name: LED Garaj
        icon: mdi:lightbulb-on-10
        show_state: false
        tap_action:
          action: call-service
          service: script.led_garaj_1_2
          target: {}
      - show_name: true
        show_icon: true
        type: button
        tap_action:
          action: call-service
          service: script.led_gard_1_2
          target: {}
        entity: #YOUR_SWITCH_ENTITY#
        name: LED Gard
        icon: mdi:lightbulb-on-10
        show_state: false```

If you absolutely need to know that both switches are on, you should combine them in a switch group in the Settings > Devices & Services > Helpers menu with the “All Entities” option turned on.

Thank you. I read about creating a group but never did it before so now with your guidance I did just that and now it is all working as needed.

Wish you the best !