Hy Mathias
I started to develop my lovelace with a menu in the sidebar.
I have a yam file for each lovelace panel and one sidebar.yaml file for the menu which is called by each file.
Now, I would like to change the item menu style according to the current dashboard. Do you have any idea for a condition on the current lovelace ? Or maybe my way is not the best and I need to change the grid and have a conditional card like you mentioned it ?
Thanks for your help
hi @Mattias_Persson So that the weather card takes up more space in height. Do I have to put together a grid and customize it?
Thanks
The weather card is not designed with a square layout in mind. Can you conceptualize how you would fill that space without stretching the card?
You could make your own with button card [example]
or add the weather card to the sidebar
Use the icon:
config variable instead (not custom field). if you must use <ha-icon>
you can add a css variable
custom_fields:
icon: |
<ha-icon icon="hue:play-bar" style="color:var(--button-card-light-color);"></ha-icon>
You can use this template by @Mariusthvdb for current view as a condition in sidebar yaml
[[[ return window.location.pathname.split('lovelace/')[1]; ]]]
I’m using this layout
swipe-card
→ horizontal-stack → conditional
→ grid
some people tried (which I didn’t test)
swipe-card
→ grid
→ grid
which cut off the bottom part and the reason I added height: 100%
working example
- type: grid
title: Media
view_layout:
grid-area: media
columns: 1
cards:
- type: custom:swipe-card
start_card: 1
parameters:
roundLengths: true
effect: coverflow
speed: 650
spaceBetween: 20
threshold: 7
coverflowEffect:
rotate: 80
depth: 300
cards:
- type: grid
columns: 2
cards:
- type: custom:button-card
entity: media_player.vardagsrum
name: Vardagsrum
template:
- media
- icon_apple_tv
- type: custom:button-card
name: Sovrum
entity: media_player.sovrum
template:
- media
- icon_apple_tv
- type: custom:button-card
entity: media_player.spotify
name: Spotify
template:
- media
- icon_spotify
- type: custom:button-card
entity: media_player.kok
name: Nest Mini
template:
- media
- icon_nest_mini
- type: grid
columns: 2
cards:
- type: custom:button-card
entity: media_player.vardagsrum
name: Vardagsrum
template:
- media
- icon_apple_tv
- type: custom:button-card
name: Sovrum
entity: media_player.sovrum
template:
- media
- icon_apple_tv
- type: custom:button-card
entity: media_player.spotify
name: Spotify
template:
- media
- icon_spotify
- type: custom:button-card
entity: media_player.kok
name: Nest Mini
template:
- media
- icon_nest_mini
There’s this basic guide at least. You’re welcome to make a video
Have you tried putting custom:thermostat-dark-card
by itself and not inside custom:button-card
?
I bet my templates are messing with your bottom right icons. Can you post how you’ve set those up?
Yeah, and to add to that I don’t think that markdown is inherently bad but styling it is a nightmare.
The nice thing about button card is that if one doesn’t want to convert all jinja templates to javascript, incorporating existing template sensors works fine too.
The easiest way would be to swap out the svg
on = a.svg
off = b.svg
custom_fields:
icon: >
[[[
if (entity.state == 'on') {
return `
<svg viewBox="0 0 50 50">
<rect width="40" height="40" fill="blue" />
</svg>
`;
}
if (entity.state == 'off') {
return `
<svg viewBox="0 0 50 50">
<circle cx="20" cy="20" r="20" fill="red" />
</svg>
`;
}
]]]
I would probably just conditionally display the “light” path though
Do you have these sensors working?
- sensor.hass_version_latest_beta
- sensor.hass_version_latest
- sensor.hass_release_notes_rc
- sensor.hass_release_notes
Thanks, @anon36468094 assisted and everything went ok. for now my lovelace is like below, improving every day… your design is awesome.
Yes. equal
thanks for getting back to me.
in fact I haven’t, other than on the entity itself, the button-cards are very plain, and only use your templates as posted.
I’ve also carefully checked if I dont use any templates with the same name myself, which happened in another spot
Just checked, and Firefox looks identical to Safari. Only Chrome shows the animated icons…
wait: I had edited the base:
template and commented some code that I didnt use (screensaver, galaxy etc) but apparently commented too much. now looking like:
which is much better. Interesting to learn once again that not all browsers are equal…