There is one other thing I can’t get to work, and that was done with style_template in Custom UI. I can make it change button style based on the state of the entity it is related to, but I can’t find a way to specify some other unrelated entity.
This is an example from Custom UI and how it worked there:
Is it possible to use a attribute as an entity? My ecobee will show as auto all the time whether its on or off but the operation attr will show idle,cool or heat.
Thanks for all the hard work, this is working well for quickly building remotes for my home theater system. I have 2 suggestions that would make this perfect. I’m not sure of the limitations of the platform, so it’s possible that these are not possible, but it’s worth a shot.
Allow the event to be fired on a mouse or finger down event instead of a click. I think this would make navigating menus feel a lot more responsive.
Allow the service to be repeated after a short delay while held down in the same way holding a key on a remote would (For volume control, menu control, etc)
After reading through all the documentation again I figured out where the error is:
Where the tutorial in the beginning of this thread indicates “Include the card code in your `ui-lovelace-card.yaml” it actually should write “Include the card code in your ui-lovelace.yaml”
A small and subtle difference, but by including the code in ui-lovelace.yaml I managed to get it to work
I’ve got the same error as Torbenan, with same config…
I have this error in the log: 2018-09-17 20:16:31 ERROR (MainThread) [frontend.js.latest.201809030] https://home.merklen.fr/local/custom_ui/button-card.js:1:8 Uncaught SyntaxError: Unexpected token {
Thanks a million for this, it’s my main light switch board now
One question I have: how do I get it working when my internet is down? There was a storm here today, and my internet was out for the morning and the button-cards were the red blocks instead.
I guess it’s from the import:
import {
LitElement, html,
} from 'https://unpkg.com/@polymer/lit-element@^0.5.2/lit-element.js?module';
What workaround could I use for this?
Many thanks again! I wouldn’t have my HA set-up without it
Thanks for sharing this @kuuji Happened to me as well, couldn’t get it to work, any solution to it ?
I’ve placed the custom card in its correct place and I’ve been using other lovelace custom cards with success
I also wanted this so I just added ${state.attributes.unit_of_measurement} in the <div> after ${state.state}. Would be nice to have it as a config value in the main card.
Is there a way to have the button set variables for a script? I can only get it to toggle a script but how to set it up to include variables in the homeassistant.toggle?
Also how do I create custom icons or entity-pictures for my buttons? I saw a screenshot earlier where someone had the Netflix logo etc. inside their buttons?