royto / logbook-card

Logbook card for Home Assistant UI Lovelace
GNU General Public License v3.0
198 stars 9 forks source link

Some Enhancements if you have time #57

Closed SteffenM-DE closed 1 year ago

SteffenM-DE commented 1 year ago

Hi,

great work for showing nice history of an entity.

I have some point with enhacemends if you like:

Thanks you, Steffen

royto commented 1 year ago

Hi @SteffenM-DE

Here is the result: image

If yes, you can style it with card mod by adding this:

card_mod:
  style: |
    .item-content .duration {
      display: block;
      float: none;
    }
SteffenM-DE commented 1 year ago

Hi,

thank you for the comments and the solutions with Card-mod.

The point with line break I try to describe a little bit more:

I using a template to build a string from differnet entitiys and attributes, so I have a longer string in the template state. If I use this entity the state is showing at the main row of your sample it is 'Sous l'horizon'. If it is very long your card using two lines but breaks the line anywhere. With the manuel line break like other crads (Mushroom) I can make the line break on a special position.

I hope now it's clear whats my wish abaout.

Thanks.

royto commented 1 year ago

Can you provide me a screenshot ? How do you achieve that with mushrooms cards for example ?

SteffenM-DE commented 1 year ago

In Mushroom we can have a "\n" in a state and this is a line break so we can create a line break on a special position:

Screen_20221201-103223

In the scrennshot you can see your card and my long state coming from a template starting with 'Eingehnd'. The first row have no line break but the second have after the arrow showing the called number. So if I creat the tempate state for the logbook entity I want to add a line break (\n) to have always a line break bevor the arrow. So all rows show the same construction.

I hope now it's clear. Thank you very much.

royto commented 1 year ago

Can you show how do you do to have multiline state ...

I tried but did not succeed to have it working ...

With this configuration

template:
  - sensor:
      - name: "test"
        unique_id: "9a00a4af-5319-4208-a72e-cdb33622c7f3"
        state: >-
          {{ "Multi \n
          line
          text" }}
          {{ "2" }}

I got this ...

image

royto commented 1 year ago

Can you test using this configuration ?

card_mod:
  style: |
    .state {
        white-space: pre-wrap;
    }

If it is working i'll add as default style for the card

SteffenM-DE commented 1 year ago

white-space: pre-wrap; did not work complet. I can add \n but sometimes it breaks the line if there is no \n and no reason to must break the line.

So I think Mushroom translate the \n to a linebreak so the user can decide where to break the line. Here is the example:

Screen_20221202-111723

royto commented 1 year ago

Can you show me what it render on the logbook card and what you expect?

SteffenM-DE commented 1 year ago

Like the Mushroom scrennshot, I add \n in the template state and I want to render it as fixed line break inside the state.

Logbook look like that: Screen_20221203-112132

But I have add a \n befor the small arrow to have a line break at this position, that it looks this way. Because if there are numbers the line a longer and breaks on a ugly place ansd so I have a uniformly view with always a lin breka befor the target is shown:

Unbekannt ► Geschäft

SteffenM-DE commented 1 year ago

Thank you, is working now.