Please look at my post above yours, i shared the the template for the card.
Yes, i read it, i was meaning the whole lovelace yaml regarding all the lights…
EDIT: Ah, sorry, maybe i understand… when configuring a template, then you must only put in the lovelace.yaml the name of the entities… Is it correct?
yes, correct
No reply’s but i already figured it out myself.
Is it possible to template multiple lines?
Or more specifically, can I template this doubletap-action
?
I have a decluttering template that uses browser_mod
in the dbltap_action
which I would like to reuse for entities that do not have a dbltap_action
or use something completely different.
For example…
default:
- tap_action: none
- dbltap_action: none
card:
tap_action:
action: '[[tap_action]]'
dbltap_action:
action: call-service
service: browser_mod.command
service_data:
command: popup
title: >
[[[ return entity.attributes.friendly_name ]]]
card:
type: entities
entities:
- entity: >
[[[ return 'input_select.manually_set_' + entity.entity_id.split('.')[1]; ]]]
deviceID:
- this
Hi.
I am trying to get my lights to start from a brightness level from a input_number but I cant get it to work.
If I write 40, 60 , 200 after brightness it takes that value but not with this code
tap_action:
action: call-service
service: light.toggle
service_data:
entity_id: light.balcony_light
brightness: >
[[[
states['input_number.light_test'].state
]]]
Is it something with int or something? I have tried everything now
EDIT: of course 5 minutes after posting, I noticed the note in the docs that says it supports html formatting so the below works, so I’m answering my own question here for the question I ask below if anyone needs to know how to put a newline in their button label.
name: SWISS <br> CLASSIC
Original post below:
Hey, does anyone know how I can span the label for the button over 2 lines rather than just one? I have some small and simple text-only buttons for playlists but would like to span the name over 2 lines so that I can distinguish between them. For example, in the below I would like to have SWISS CLASSIC be shown as
SWISS
CLASSIC
Rather than SWISS CL… Because it gets truncated. Any idea how to do this?
- type: "custom:button-card"
name: SWISS CLASSIC
styles:
card:
- padding: 12px 0px
- font-size: 14px
tap_action:
action: call-service
service: media_player.play_media
service_data:
entity_id: "media_player.itunes"
media_content_id: "radio-swiss-classic"
media_content_type: "playlist"
Yea, I tried that but unfortunately it’s still a no go. I event thought it wasn’t rendering because of templates but I set a view without them with no luck.
That won’t work. Light.toggle does not accept data.
It does for me just not this:
tap_action:
action: call-service
service: light.toggle
service_data:
entity_id: light.balcony_light
brightness: >
[[[
states['input_number.light_test'].state
]]]
But if I turn on the light and set the light to max in brightness and uses this instead:
tap_action:
action: call-service
service: light.toggle
service_data:
entity_id: light.balcony_light
brightness: 20
the light turns off on first press and on second it turns on with 20 in brightness…
I turn it off, change the brightness to 100 and press the toggle it starts with 100.
So I guess it supports data I cant just get it to get the data from input_number.light_test
If that’s the case you need to terminate the line and add the word return before the states object. This of course is if that field even accepts templates
[[[
return states['input_number.light_test'].state;
]]]
Hi,
Is there a way to minimize each header, i mean when i click on living room it wall maximize.
all the living room entities will fold under the living room header.
instead of scrolling.
I get the return that it needs an int for data…
I have tried
return (int)states['input_number.light_test'].state;
and also
[[[
int test = (int)states['input_number.light_test'].state;
return test;
]]]
But nothing change…
That’s not how it works in javascript.
return Number(states['input_number.light_test'].state);
Haha! You are a life saver as always!
Thx again man!
could you help me create the correct form for the template in JS, I need for a button please. I posted here, but maybe should have done in this thread (which is already so long…)
bottom line:
all of my counter sensors have an entity_id like this: sensor.count_input_selects, sensor.count_groups, sensor.count_input_booleans etc etc.
I need a name template which splits at the first _ and show the rest (which might include yet another _):
so when entity_id is sensor.count_input_booleans, it shows input_booleans
I’ve tried this, which obviously doesnt work as desired showing only input
:
- type: custom:button-card
template: button_body_no_action
entity: sensor.count_input_selects
name: >
[[[ return entity.entity_id.split('_')[1] ]]]
but completely forgot how to split but not leave the second section after a second _ out…
using a hard_coded way now (split at ‘.’ and cut-off 6 characters, but thats not really elegant)
[[[
function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}
var id = entity.entity_id.split('.')[1].slice(6).replace('_',' ');
return capitalizeFirstLetter(id);
]]]
thanks for having a look!
trying to make a button-card like this one
but that shows sensor.current_version
and sensor.latest_version
since i can´t even figure out the shown card (even after checking the code shown on github for an hour) i have a really hard time doing it. could someone help me out?
you mean something like this:
or do you want both sensors on 1 button. The button you show has many more fields to fill, so might not be the most adequate option for your purpose?
i tought about both sensors in 1 button