bokub / rgb-light-card

💡 A Lovelace custom card for RGB lights
MIT License
412 stars 24 forks source link

Can't send data with call-service? #49

Closed dennisbrouwer91 closed 2 years ago

dennisbrouwer91 commented 3 years ago

Hi,

I'm trying to link the different colors that I have to scripts, and send the color to the script as a variable. But when I try this I get the message that the "data" part is not allowed. I tried putting it everywhere, but I can't get the var to go to the service.

type: entities
show_header_toggle: false
entities:
  - type: custom:rgb-light-card
    entity: light.eetkamer
    colors:
      - type: call-service
        service: script.turn_on
        service_data:
          entity_id: script.woonkamer_color
          color: blue
        icon_color: '#90b2ec'
      - type: call-service
        service: script.turn_on
        service_data:
          entity_id: script.woonkamer_color
          mycolor: pink
        icon_color: '#FF3374'
      - type: call-service
        service: script.turn_on
        service_data:
          entity_id: script.woonkamer_color
          data:
            color: green
        icon_color: '#8AFF33'
title: Eetkamer lampen
state_color: true

Anyone with advice?

LordGaav commented 2 years ago

This worked in my case for a select item exposed by WLED. The trick is not using a nested data key:

  - type: call-service
    service: select.select_option
    service_data:
      entity_id: select.wled_preset
      option: Solid
    label: Solid
bokub commented 2 years ago

Hello,

It looks like there is nothing else to do there, so I'll close this issue. You can re-open it if you need help.