Lovelace: Button card

I’m not sure how to return anything in javascript (at least in button card, anyway) without it being in quotes based on all the examples provided in the repo.

Either way, I read that return false means ‘do not return anything’.

Definitely not. Do you have a source for that? Maybe you’re confusing the truthy and falsy values in YAML with this.

Regarding you original problem: Did you try changing'false' to false and 'true' to true?

Just this should do:

"[[[ return Number(window.innerWidth) > 1179); ]]]"

EDIT: show_name and show_state doesn’t support templating (see the docs).

1 Like

Hi Pieter,

thanks for your reply - appreciated.

No, not confusing with YAML - I definitely read it whilst researching Javascript on stackoverflow or w3schools, but cannot find it now - maybe I misinterpreted the text. Thanks for correcting me.

thanks!

Well, that’s embarrassing, but I can see how I missed it. It doesn’t actually state that it doesn’t support templating, but all the options that do support tempting, explicitly state it. Thanks for pointing that out!

1 Like