besides all of the above, there are some navigations set in the hold action to paths I use in my config. So you need to adjust those too (or delete that if you don’t want to navigate away)
Don’t get me wrong, but you explain pretty difficult. That’s why I still haven’t figured out how to configure afvalwijzer like I asked you how I wanted it…
this has nothing to do with afvalwijzer perse.
this is nothing more than a button card styling. Wrapped in a template, so I can use these throughout my dashboards
EDIT : So I was so focused on doing this in YML than I didnt think of the obvious, modifying the picture as a png with low alpha Working great, thanks for the addons !
Hello ! is their a way to have a semi-transparent background-image in a template as a container ?
@D34DC3N73R I might be a bit late to the party here, sorry but realised I have a solution for you.
So you aren’t able to use the js templates under the triggers_update property unfortunately, however there is a workaround. If you define a custom field as a card within a button-card template then ALL properties of that card definition can use templates! Not only that but it will still automatically update when it’s entity updates regardless of the state of the parent. That said, I have two other entities that need to update the card in mine so…
You can see in that example that I’m even populating the entity with a js template!
Also all the code for my templates is on Github so feel free to grab anything from there that’ll help. OR better still, load up my templates so you don’t have to redo it yourself. However I completely get it if you already have a whole eco-system going. Just grab the bits you need.
Hope this helps. Let me know if you have any questions about the code.
Unfortunately the problem is not into the quotes. I’m using Raw editor and it automatically removes the quotes and second - name variable works perfectly.
As far as I know you can’t use the entity as a variable (or it’s not meant to at least). Variables are well, variables. So things that you can alter regardless of the entity. Things like name, icon, label etc. Which is why your card shows that error: it can’t return an entity. I believe the templates support the same variable as the javascript template option: GitHub - custom-cards/button-card: ❇️ Lovelace button-card for home assistant.
You need to declare the entity in the card itself, not as a variable. So like this:
I would like to use a button card that displays the state of my window contact sensor and if and only if the window is open, displays the time since it has been opened below the state.
I first tried the show_last_state option but first of all, it displays the information always and not depending on the state and secondly I want to have the format of the output slightly different.
So I tried to realize this using the label of the button card which was successful except the fact that the value was not updated. Is there any way to have the label being refreshed, say every minute?
Here is my button card configuration (I’m using a template as I want to apply this to multiple button cards):
type: custom:button-card
name: Küche
entity: binary_sensor.kitchen_window
icon: mdi:window-closed-variant
template: my_template
button_card_templates:
my_template:
color_type: card
show_name: true
show_icon: true
show_state: true
show_label: true
state:
- id: state_on
value: 'on'
color: var(--accent-color)
label: >
[[[
let diff = Date.now() - new Date(entity.last_changed);
if (diff < 60000)
{
return "Weniger als eine Minute";
}
else if (diff < 3600000)
{
let since = Math.floor(diff / 60000);
return "Seit " + since + " " + ((since == 1) ? "Minute" : "Minuten");
}
else
{
let since = Math.floor(diff / 3600000);
return "Seit " + since + " " + ((since == 1) ? "Stunde" : "Stunden");
}
]]]
- id: state_off
value: 'off'
color: var(--ha-card-background)
Hi,
I’m trying to build a customer button-card template, where I have nested custom:button-card elements and want to use a second template to customize the nested buttons. Is it possible?
note still the triggers_update is still required and it is hard-coded. Button-card uses templates and can not use variables inside those, as it would mean it had to update on all state changes. It did so before, and was taken out because it could bring down the instance… so triggers_update was introduced
Thanks. It looks like - “main” entity - cannot be controlled by variable. This is not a big issue - as it’s easy to add entity with name - instead of variable - as the variable can be used in nested custom:button-card. To give more idea what I’m trying to achieve - I have TADO TVR’s on all my regurgitators - now I want to build a template for card - that can be easily reproduced for all of them - keeping most important parameters visible. So into the template - I’m defining all elements and then into the dashboard / card configuration with just few variables (and entity) - I’m specifying “custom” elements. I want also to add few buttons where I can preform few operations on the TVR - like temp +/- and On/Off. Here is the very draft version of the card (please ignore colors, as I just put few of them to see that they are working, but final design of the card will be on the next stage):
and yes, the main card entity can be used for that, and should be chosen wisely. I have some buttons using another entity for exactly those templating purposes.
Since the button-card is endlessly customizable, there always is an option somewhere
nice - far away - I need to play a bit with sizes and etc. Colors are terrible
Complex - if it’s not complex - it’s not so interesting
The main goals that I have for the moment, before stating the polishing design is to see if I can use template also for the buttons below - as at the moment have 4 buttons and all parameters are in all of them and its very annoying to change 4 times all of the components…
Other problem is that Tado is a bit complex as integration - from one side - there is a climate control - where half of attributes are available and second - a lot of sensors (and binary_sernsors) - where the rest of attributes are publish - so I need a lot of variables to pass them to the card. But in general - I’m really happy with the custom:button-card and plan to use it a lot into the new redesign of the dashbaord.
your card just might be able to help me out… though I am a button-card user for a long time, and have it make up half of my Frontend, I dont have many cards with embedded cards/entities.
Which probably might be what I need currently: I have a set of bigger cards representing my Rooms, and they are in a stack or swiper, depending on device(width). Clicking any of these takes me to the view of that room in the path.
Those cards have an background image entity_picture of the zone, and can be greyed if a main entity is off. Also they can have a top border turn red if motion is detected:
What Id love to add is a significant area at the bottom, just like the real Area card, (or the picture-entity card) and have control of what I show there, mostly a single temp entity state, and a humidity entity state.
I am not using the Area card, because that is way to dangerous with clicking it, and no way to control that.
this is a single instance of a room, using the above template:
I’d envision adding some variables there for the temp and humidity entities, which then need to be placed in side the card through the template in the blurred section at the bottom of the card.