would you be prepared to consider adding the config template to the button card itself, or at least allow the option? rationale, keeping all relevant code together in 1 file and be able to import that easily and robustly in maintenance:
my views look like:
title: Test
icon: mdi:test-tube
path: test
cards:
- type: custom:compact-custom-header
- !include /config/lovelace/tiles/tiles_family.yaml
- !include /config/lovelace/tiles/tiles_input_select_scene.yaml
- !include /config/lovelace/buttons/buttons_lights.yaml
Inside the javascript code, you'll have access to those variables:
* entity: The current entity object, if the entity is defined in the card
* states: An object with all the states of all the entities (equivalent to hass.states)
* user: The user object (equivalent to hass.user)
* hass: The complete hass object
So you can access the entity state with entity.state
Define your config template in the main lovelace configuration and then use it in your button-card.
thought you implied that to be needed in the ui-lovelace.yaml⌠I take it now you mean the main setup for the card itself? Which would be perfect, thanks!
seeking some more help please. I am trying to get a shallower but wider button to show Icon and label next to each other, centered on the button.
Just like this:
Iâve reached this:
but am lost for now which of the possible options I should change, would you please have a look? (to be precise: I want the icon, name and state centered in horizontal and vertical centerâŚ
btw for now Ive âguessedâ the width of the top button to be 3 times a single button with something extra, but what would be the precise way of calculating that? Which variable is defining the space between buttons?
i wish that when states[âsensor.riscoincendioâ].state; is iqual to value A then the card is RED. when value is B is green. when Value is C is yellowâŚand other values
how can i do this?
I understand.
I thought these anchors could only be used in the file they are declared in. Since I try to use my views with !includes this would be in a button_lights.yaml file, and only configuring sets of Lights buttonsâŚ
No issues with switches⌠Might have to think it over, because I am not sure I need the brightness on all buttons, especially the count buttons. Unless there would be an override setting, or maybe use the same trick with the transparent color
no way to override, just make an anchor for count buttons and an anchor for light % buttons. Thatâs all I do. Still cuts the config down. And next version will have this templating crap so you can just use a template instead of an anchor. Iâd guess that templates can merge better than anchors because you wonât get that double config attribute error in your logs with templates. Is that correct to assume @RomRider?
using layout: icon_name_state, what else do I need to set to have these centered vertically and horizontally?
in Lovelace: Button card posted few posts above, Iâve shared my config, and probably should leave out some extra settings I copied from the other buttons. Sofar, I find it rather difficult to accomplish such a simple goal⌠duh. what am I not seeingâŚ