Lovelace Raw config editor f'ing with quotes

Trying not to be frustrated here but I’m struggling to get a variable passed to a script from a button card. Although the syntax works in developer tools the raw config editor is changing it and I haven’t figured it out yet. Please ignore the difference in sensors…shouldn’t matter and at this point I’m just testing.


This syntax works.

This is what I used on the card and it still displays like that until you go to code editor then…

I’ve tried rearranging, eliminating and escaping but still nothing. Works like a charm from dev tools. Any help would greatly appreciated. Peace.

So after calming down a bit I starting searching for others who had problems sending variables to scripts from lovelace instead of the problems with the raw editor and found the solution thanks to petro. It seems as though templates can’t be used in the way I was trying to within lovelace and instead are kind of “built” by sending just the entity used in the template with no quotes, no brackets etc. Also note using service_data instead of data. Using the above as examples it should be configured as such:

action: call-service
service: script.river_activity_tts_google_say
service_data:
  message: sensor.inside_temp

In the script the variable is set up so that the data passed to it fills in the template if that makes sense. For example script.river_activity_tts_google_say utilizes the tts.google_translate_say service as such:

sequence:
  - service: tts.google_translate_say
    data:
      entity_id: media_player.vlc_telnet
      message: "{{ states(message) }}"

Works like a charm! I got the info from the following post:

Thanks to petro and this awesome community! Peace.

BTW…How do I change the “Solved by” so petro gets his props?

What you did is fine

Right on thanks.

1 Like