Calling a service from the developer tools works but not from the button

I want to create a button that calls a service and passes some data with the state of some other entity and I’m very confused. When I call it from the developer tools it works. But when I pass this config to be called when I press a button it doesn’t.

Here’s the service config:

service: babybuddy.add_diaper_change
      target:
        entity_id: sensor.baby
      service_data:
        color: '{{ states("select.baby_buddy_diaper_color") }}'
        type: '{{ states("select.baby_buddy_diaper_type") }}'

When I use this in a button it says the color and type must be a valid option from the select. For some reason the template is not rendering the correct value… Does anyone have a clue on what’s wrong here?

Templates are not supported in most cards. If you need templated logic, set the logic up as a script then have the card’s action call that script.

2 Likes

Okay… That’s probably the case… Its weird that the docs lead me to believe that this would work.