This "null" is a string, it should be else return null;
That’s because of the padding of the card. By default it’s a %age of the width (and you’ve also set it to a %age, which is based on the width), so set it to something static and you’ll be good to go.
Thank you for your reply! I made the change you’ve helpfully suggested but it doesn’t seem to have solved the problem yet. I am still digging to understand why it isn’t working as I hope.
In case a visual is helpful –
Motion:
No Motion.
The icon changes as it should but the color does not. If I refresh the browser, it appears gray as it should.
This is the card mod selector I tried but doesn’t appear to work.
style:
.: |
#root > * {
margin: 0px !important;
}
Side note: Did you ask this question on reddit? If so, I replied there but it’s easier to markdown here so hopefully this might point you in the correct direction.
This card is amazing. I wish I had gotten on board sooner. I was looking for a replacement for my light tiles cards and a way to make core glance cards more compact and clearer. Fits the bill perfectly. Such a powerful card once you get the hang of the internal layout. I might replace core switches next.
I’ve got styles: height, width set using CSS vh, vw and I now have very nice custom:button-card overlays on a picture-elements card using entity-pictures and tap actions. (I tried percent for them, but it rendered a button about 1x1 px irrespective of the %). So, “Ready to Arm”, numbers, the temperature, and “Ready” are button-cards overlaid on picture-elements base.
However, the button-card overlays don’t scale correctly with changing screen-size. I created the view at 80% zoom in Firefox. Change to 100% and the overlays shrink, relatively. They seem to have kept their original h/width as the underlying image scaled up to fit the screen-size. (Note that I’m selectively using lovelace-gen macros in this view for the numeric buttons, FWIW).
Even worse on the phone where the overlays shrank dramatically relative to the base image. Both “panel” and non-panel views do this.
Is the HA vw/wh scaling not aware of the HA “viewport”? Is the HA viewport some special thing? Is the %'s not working related to this?
Or, can I access viewport parameters and do my own arithmetic scaling in JS of the button-card overlays for different screen layouts?
I’d like not to create special views for all my devices…
How do I get the names to vertically justify to the bottom of the cards (just above the card padding) without using top padding in the name (that causes problems on smaller displays)?
Relevant bits of config:
switch_button:
aspect_ratio: 4/3
layout: icon_state
show_label: false
styles:
card:
- border-radius: 10px
- padding: 3px 3px 3px 3px
- margin: 0% 0% 0% 0%
- '--paper-card-background-color': 'rgba(0, 0, 0, 0)'
grid:
- grid-template-rows: 33% auto 0
- grid-template-columns: 33% auto
name:
- justify-self: centre
- font-size: 14px
- padding: 0px 0px 0px 0px
- color: var(--primary-text-color)
- white-space: normal
- vertical-align: baseline # does not work, neither does 'bottom'
I’ve tried custom grid layouts like "i s" "n n" but it has the same problem, name always centred vertically.
Hey guys, i feel like im missing something, I’m trying to get some sort of recognition that I tapped a button on the mobile app, for example if i hit a button in the web UI, i get a quick darkening of the button and a nice but quick animation, then the ‘light’ turns on and the state changes forcing a color change of the button to yellow, but sometimes there are delays and so on the mobile app I will tap a button, but it wont look like anything has happened for a second or two, and then things start moving. Does anyone know how to get a quick animation on tap that works on the mobile app?