Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After version 2.5.1, cards with attributes are empty #113

Closed
kosmaluk opened this issue Mar 18, 2024 · 31 comments
Closed

After version 2.5.1, cards with attributes are empty #113

kosmaluk opened this issue Mar 18, 2024 · 31 comments
Assignees
Labels
bug Something isn't working

Comments

@kosmaluk
Copy link

kosmaluk commented Mar 18, 2024

  • HA Version: [e.g. 2024.3.1]
  • Browser chrome, HA apps
  • Card version [e.g. 2.5.1]

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 royto self-assigned this Mar 18, 2024
@royto royto added the bug Something isn't working label Mar 18, 2024
@royto
Copy link
Owner

royto commented Mar 18, 2024

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

@kosmaluk
Copy link
Author

No, i dont have errors in the console

IMG_20240318_135543

@royto
Copy link
Owner

royto commented Mar 20, 2024

@kosmaluk can you try with version 2.5.2 ?

@kosmaluk
Copy link
Author

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
Copy link
Author

Template sensor in 2.5.0

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

@royto
Copy link
Owner

royto commented Mar 22, 2024

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

@kosmaluk
Copy link
Author

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
Copy link
Author

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: - state: '*' attribute: - name: TextLines value: null

@kosmaluk
Copy link
Author

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
Copy link

il77781 commented Mar 22, 2024

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

@kosmaluk
Copy link
Author

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

  • value 0 (zero)
  • null value
  • empty (no value)
    The previous solution which hides the null and empty attributes automatically was correct.
    Let him @royto solve our problem

@il77781
Copy link

il77781 commented Mar 23, 2024

@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
Copy link
Author

@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
Copy link

il77781 commented Mar 23, 2024

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

@kosmaluk
Copy link
Author

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
Copy link

il77781 commented Mar 23, 2024

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

@kosmaluk
Copy link
Author

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
Copy link

il77781 commented Mar 23, 2024

@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
Copy link
Author

@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
Copy link
Owner

royto commented Mar 23, 2024

I will release a new version later that hide null values

@il77781
Copy link

il77781 commented Mar 23, 2024

@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
Copy link
Author

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
Copy link

il77781 commented Mar 23, 2024

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

@kosmaluk
Copy link
Author

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

@royto
Copy link
Owner

royto commented Mar 23, 2024

version 2.5.4 hides attribute if value is null

@il77781
Copy link

il77781 commented Mar 23, 2024

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

@kosmaluk
Copy link
Author

@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
Copy link

il77781 commented Mar 23, 2024

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
Copy link
Author

@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
Copy link
Owner

royto commented Mar 24, 2024

version 2.5.5 hides attribute if value is empty

@kosmaluk
Copy link
Author

Thank you @royto. Now everything works

@royto royto closed this as completed Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants