royto / logbook-card

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

After version 2.5.1, cards with attributes are empty #113

Closed kosmaluk closed 7 months ago

kosmaluk commented 7 months ago

Card configuration

type: custom:logbook-card
show:
  end_date: false
  start_date: true
  separator: true
  duration: true
separator_style:
  color: '#3D3D3B'
entity:
  - sensor.notify_last_redmi_all_attr
title: ''
attributes:
  - value: Tytul
    label: Tytuł:-
    type: text
  - value: Tresc
    label: Treść:-
    type: text
  - value: TextLines
    label: Line:-
    type: text
  - value: Messages
    label: Mess:-
    type: text
custom_logs: true
no_event: Brak
hours_to_show: 24
collapse: 0

After updating to version 2.5.1, all items stopped being displayed in some tabs (they are empty). After analyzing the problem, I found out that it was caused by a change in version 2.5.1. I don't know exactly what it is about, but it concerns attributes. Some cards display attributes and some do not. Those that do not display often have "empty" or "null" attributes. Adding one such attribute that has the value "empty" or "null" in the history causes the card to display nothing. If I remove the entire "attributes" section, the card displays correctly, i.e. it shows the entity states (without attributes)

This is card correctly (wer 2.5.0) IMG20240318124023

This is card afrer ver 2.5.1 IMG20240318124206

This is card after remove "attribute" section IMG20240318124246

royto commented 7 months ago

Do you have errors in the console (F12 in your browser to access developper tools) ?

kosmaluk commented 7 months ago

No, i dont have errors in the console

IMG_20240318_135543

royto commented 7 months ago

@kosmaluk can you try with version 2.5.2 ?

kosmaluk commented 7 months ago

2.5.2 the card based on the template sensor does not work - empty. But the original sensor works

Template sensor Screenshot_2024-03-20-21-22-08-66_c3a231c25ed346e59462e84656a70e50

Oryginał last_notification sensor Screenshot_2024-03-20-21-27-07-06_c3a231c25ed346e59462e84656a70e50

kosmaluk commented 7 months ago

Template sensor in 2.5.0

Screenshot_2024-03-20-21-35-00-79_c3a231c25ed346e59462e84656a70e50

royto commented 7 months ago

@kosmaluk can you test with version 2.5.3 ? It should fix the issue

kosmaluk commented 7 months ago

this version works, but why does it display empty and null attributes? the earlier version deleted them automatically, and now how to hide them?

IMG_20240322_232417

Screenshot_2024-03-22-23-22-39-90_c3a231c25ed346e59462e84656a70e50

kosmaluk commented 7 months ago

this change is unnecessary. It blows away the entire view of all the cards. Why would anyone need empty or null attributes? I don't know how to hide it now, and even if it's possible, it's a lot of pointless work on many cards. I've already tried it and it doesn't work for me:

`hidden_state:

kosmaluk commented 7 months ago

if you solved error 112 (Jump down The entity attribute is not displayed on the card, if its value is zero #112) the content shows that the author meant the value "zero" and not empty attributes or null. Its 'idn' attribute has a value of 0, so I think this change goes too far

il77781 commented 7 months ago

@kosmaluk, I'm sorry that solving my problem has created problems for you... I definitely didn't want that...

kosmaluk commented 7 months ago

@il77781 I think you should specify what you wanted to achieve - attribute from:

il77781 commented 7 months ago

@kosmaluk, I was talking about displaying an attribute whose value is exactly zero (not null and not no value), as you wrote above... Before that, it was like this: the attribute is not zero - it was displayed, as soon as it became zero - it disappeared from the card... It is important for me to see exactly the value of the attribute, and it does not matter whether it is zero or not - it is important to see it in any case. Of course, if the attribute is null or empty (no value), I don't need to see it... Probably, for some specific tasks it may be necessary to display attributes in the null or empty (no value) state - perhaps for these purposes it would be nice to leave the possibility of displaying them.

kosmaluk commented 7 months ago

@il77781
so I was right. You need an attribute that has a value - value 0 (zero). So the thigh change is too far. If it's supposed to stay that way, there should be a function to hide them. I tried to hide according to the documentation but it doesn't work with null and empty

il77781 commented 7 months ago

I hope @royto finds a way to fix the situation.

kosmaluk commented 7 months ago

I tested to hide these attributes but it doesn't work. The "empty" value works, but hides the entire item, not just the attribute. The value "null" shows a processing error and dumps the card. Screenshot_2024-03-23-08-40-44-63_c3a231c25ed346e59462e84656a70e50

il77781 commented 7 months ago

Yes, it is unclear why the hidden_state does not work...

kosmaluk commented 7 months ago

the hiden_state function will not work for this because it hides the entire object and not the attribute itself. @royto must limit this change for you only to the attribute value =0 (zero) and roll back the remaining changes. Unless he finds another solution

il77781 commented 7 months ago

@kosmaluk, do you want it to be like this: the attribute that you specified in the card settings should be displayed only if it is not null (none) and not empty (no value)? Right?

kosmaluk commented 7 months ago

@il77781 just like that

My card 2.5.0 (automaticaly hiden this state null and empty) Screenshot_2024-03-23-10-09-01-15_c3a231c25ed346e59462e84656a70e50

This is my card on 2.5.3 316182363-89eb2e7d-3d87-4f87-8db4-efd1b5c3f13a

royto commented 7 months ago

I will release a new version later that hide null values

il77781 commented 7 months ago

@kosmaluk, Yes, I understand you... But I also don't need anything that is at odds with your requirements! After all, the value 0 is not null (none) and not empty (no value) - although, it seems to me, null (none) and empty (no value) are generally the same thing... But in any case, this does not correspond to the attribute state having the value 0...

kosmaluk commented 7 months ago

the empty attribute does not display anything but appears as an item. attribute "null" displays the value "null". @royto wrote that he would do it later. Thanks

il77781 commented 7 months ago

@kosmaluk, In your example, it turns out that empty is Mess_W and Mess_I? Don't you want to see them either?

kosmaluk commented 7 months ago

@il77781 Exactly. They weren't visible before this change and I wish they were

royto commented 7 months ago

version 2.5.4 hides attribute if value is null

il77781 commented 7 months ago

For me 2.5.4 works as expected! Thank you, @royto!

kosmaluk commented 7 months ago

@royto for me it no longer shows "null" attributes, but still shows "empty" attributes. Please correct this one more. Thanks

Screenshot_2024-03-23-20-23-50-13_c3a231c25ed346e59462e84656a70e50

il77781 commented 7 months ago

Probably, the absolutely ideal case would be in which the visibility of attributes in one state or another could be selected in the card settings...

kosmaluk commented 7 months ago

@il77781 Such a function would need to have an opposite function to hide only the attribute for a specific state. But I don't need any of those. All I need is to restore the state from version 2.5.0, i.e. automatic hiding of attributes with the status "null" and "empty". Basically, version 2.5.0 already fully satisfies me, but I don't want to exclude the possibility of new updates (and the current update is ruining my cards)

royto commented 7 months ago

version 2.5.5 hides attribute if value is empty

kosmaluk commented 7 months ago

Thank you @royto. Now everything works