Olen / lovelace-flower-card

Lovelace Flower Card to match the custom plant integration
https://github.com/Olen/homeassistant-plant/
177 stars 29 forks source link

Missing units of measurement #120

Closed Zipp0KMS closed 5 months ago

Zipp0KMS commented 5 months ago

There are no units behind the values. The DLI Icon is not displayed.

Screenshot_20240411-221104

Olen commented 5 months ago

Units are hidden if the card is to narrow. The dli icon is fixed in the latest beta

Zipp0KMS commented 5 months ago

Thanks for the quick reply! How do I get the card full width? It's just been added to my mobile dashboard

Olen commented 5 months ago

On mobile I believe the screen realestate is to small, so it will hide the units.
You can always just click on one of the measurements to see the units if you need to.

Zipp0KMS commented 5 months ago

Can you set the minimum screen size lower? At my screenshot is enough space to show the units.

Olen commented 5 months ago

If I remember correctly, the minimum width to display the units is 600px. Smaller screens that that will look ugly and horrible as the units take up far too much space.

You will soon learn what the units are anyway. It's not like they change on a regular basis. Humidity and moisture is in "%", temperature is whatever you have selected as your temperature unit ("°C" og "°F"). Illumination is "lx", conductivity is "µS/cm" and DLI is "mol/d⋅m²" Adding all this to the card on small screens is really just a waste of space.

Zipp0KMS commented 5 months ago

I know the units. My resolution is 1080x2211 on the Pixel 7. Nevertheless, the units are not visible.Maybe it's good to add a manual option to hide the units to give the user the choice.

Screenshot_20240412-171352

Olen commented 5 months ago

It's the size of the card, not the size of the screen that determines whether units are displayed or not. Make the card wider, and the units will show up.

Zipp0KMS commented 5 months ago

I spread the card with Card Mod to 1000px. no change.

Olen commented 5 months ago

Please inspect it with the developer tools or something. I just verified that in the app here, the cards do not display the units in portrait mode, but turning the phone 90 degrees, with the app in landscape mode, the units appear.

Zipp0KMS commented 5 months ago

Right. Units are not displayed in portrait format, but in landscape format. How can I fix it?

Olen commented 5 months ago

It is only the width of the card that determines if units are shown. If the card is to narrow, they are hidden. The fix is to ensure that the card is wide enough in portrait mode. Look at the css for the exact values.

Zipp0KMS commented 5 months ago

I added the card directly to the empty dashboard without using a horizontal stack or anything like that. I increased the width to 1000px with card_mod. Still, it doesn't work. Am I the only one who doesn't see the units in the mobile portrait?

Olen commented 5 months ago

So here is from the developer-tools in Chrome. As you can see, as soon as the width goes below 601, the units are hidden. And as you also can see, the card does not look very pretty when it is 601 pixels wide. Watch the conductivity bar (top right), and how it must be resized to fit the units inside the card. So in all honesty, this minimum size for showing units should maybe be even bigger...

Screencast from 2024-04-15 07-47-39.webm

There is no other magic than a css statement:

@media (max-width: 600px) {
  .header > .unit {
    display: none;
  }
}

How you make the card more than 600 pixels wide on your device in portrait mode is unfortunately nothing I can help you with.

Zipp0KMS commented 5 months ago

Yes, I see what you mean and I understand what you want. Soil moisture seems to be the problem. It doesn't look nice.

Maybe you could implement my suggestion: Could you have the minimum screen width adjusted by the user in the card configuration? For example, I don't use a soil moisture sensor and could therefore make my card more individual.

Olen commented 5 months ago

Please create a PR and I will consider it when I see how you intend to implement this.

Zipp0KMS commented 5 months ago

Thank you for your efforts!