benct / lovelace-multiple-entity-row

Show multiple entity states and attributes on entity rows in Home Assistant's Lovelace UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

State dependant icons (motion, door / window sensors) replaced with mdi:bookmark

tomtom13 opened this issue · comments

Hi, after most recent update to HASS, the icons for stuff that has icon dependant of it's state (motion sensors / window & door sensors) stoped showing appropriate icons and shows mdi:bookmark. Saying that the state colour works.

Current system info:
Core 2024.2.0
Supervisor 2024.01.1
Operating System 11.5
Frontend 20240207.0

I have the same issue with cover entities. The issue started occurring for me immediately upon upgrading to Core 2024.2.0.

Core 2024.2.0
Supervisor 2024.01.1
Operating System 11.4
Frontend 20240207.0

Same (or similar) here. Started once updated to HA 2024.2.0 from 2024.1.6. Same with HA 2024.2.1 also.

In more detail as per what I observe:

  • The problem doesn't apply to entities with icons overridden either in their per-entity HA configuration or their per-entity multiple-entity-row configuration (then correctly shown).
  • The problem doesn't apply to primary entities of any multiple-entity-row, affecting only their listed entities, i.e., entities: [{ entity: sensor.foo; icon: true; }]. Wrong icons are shown for the latter even when the same entity is also the primary entity of same row, i.e., the icon is correct at the start of the row but wrong later on the same row.
  • The problem seems to apply regardless of whether the icon of an entity is or is not state-dependent: e.g., all my temperature and humidity sensors listed via multiple-entity-row (bar the above exceptions) currently show up as mdi:eye at the moment, same as all my switches and binary sensors there (ditto) show up as mdi:bookmark.
  • The icon wrongly shown is the one of the domain of the entity (e.g., mdi:eye for sensors) or mdi:bookmark for domains with no icon. What appears somehow ignored is the icon that depends on the device class of the entity.

Core: 2024.2.0 (later 2024.2.1)
Supervisor: 2024.01.1
Frontend: 20240207.0 (later 20240207.1)

Adding a little more context plus a visual to what others have observed.

image

Here you can see a mix and match of icons that show properly, and ones that don't. I hadn't fully figured out the pattern until the previous post. To add to what was mentioned before, with the exception of the window, all of the correctly showing icons in my case are template sensors. The icon changes based on state. The window is a normal Z-wave contact sensor set to show as window

Confirm, leakage sensors also began to appear as bookmarks
Screenshot_20240209-181010

Very similar issue with battery status icons. They have been replaced with mdi:eye.

image

A PR is submitted #331

Very similar issue with battery status icons. They have been replaced with mdi:eye.

image

TBH, this proves that somebody is always watching :D

Some problem :(

Is there a way to test this while waiting for the PR to be merged? I can't find the patched file (index.js) in my local filesystem

Tested it locally (made changes in an obfuscated js file by myself) with no success.
Do not think the added ".hass=${this._hass}" line helps, the changed ha-state-icon object seems to be needed here.
But ofc we should wait for a feedback from the author of the PR.

@ildar170975 I saw your comment on the PR. Where/how did you access the obfuscated file?

@jeremysherriff
The obfuscated file is located in /config/www/community/lovelace-multiple-.... folder.
What I did was:

  1. Remove gz-file.
  2. Open js file in a text editor.
  3. Find the place where this ".hass=${this._hass}" line should be added. Add the line (similarly like already present lines).
  4. Save, clear cache, refresh a page.

Have to do this "brute" update since did not have the generated updated js-file.
But later after reading Dev blog started to doubt about a correctness of added change.

Tested it locally (made changes in an obfuscated js file by myself) with no success. Do not think the added ".hass=${this._hass}" line helps, the changed ha-state-icon object seems to be needed here. But ofc we should wait for a feedback from the author of the PR.

I've also tested the proposed fix locally by overriding the code directly using Chrome dev tools, and it surely fixes the problem as it should. The ha-state-icon component is already in use, just not directly but wrapped via state-badge, so to speak. Responded to the PR comment too.

How to:

  • Load a HA panel that uses multiple-entity-row in Google Chrome, open dev tools.
  • On the Sources tab, search for renderIcon to find the snippet:
key: "renderIcon",
value: function(t, e) {
    return H(ye || (ye = we(['<state-badge\n [...]
  • Start a local override, to which, in front of .overrideIcon="', '"\n, insert .hass="', '"\n and, further along the same line, change t, to t, this._hass,. Be careful with all those commas and quote marks etc, the code editor wants to “help”, which here may be counter-productive.
  • Save, reload and enjoy.

I hope this helps!

  • in front of .overrideIcon="', '"\n, insert .hass="', '"\n and, further along the same line, change t, to t, this._hass,.

Very tricky.
What I did was just adding this line:
image
which seems to be wrong.
In fact, all these is a waste since we cannot get an updated js ))))

Oh, bingo:
image
Seems to be fixed )))))

Order is important, as this is messing with concatenation of text strings within a function.
Adding a text version for easier copy/paste, and pointers to the location of the edits.
I actually edited the file in the HA filesystem, but forcing the browser to flush the original file from cache was harder than it should have been, so I recommend using the local override file as described above.

Relevant part of original line:

<state-badge\n            class="icon-small"\n            .stateObj="','"\n            .overrideIcon="','"\n            .stateColor="','"\n        ></state-badge>'])),t,!0===e.icon

Alter to:

<state-badge\n            class="icon-small"\n            .stateObj="','"\n            .hass="','"\n            .overrideIcon="','"\n            .stateColor="','"\n        ></state-badge>'])),t,this._hass,!0===e.icon
---------------------------------------------------------------------------------------^^^^^^^^^^^^^---------------------------------------------------------------------------------------------^^^^^^^^^^^

If you do use a local override file, you'll need to remember to remove that override once the update has been released.

I think I might be not the only person wondering,
BUT
assuming that this PR would be berged this very instant - how quickly we would be blessed with a release that includes it ?

Not seeing any activity from @benct since December...

So ... is that repo dead ? Should we fork it ?

I'll merge the PR and try to get a new version released as soon as possible.

heeeeeeyyyy ! lost person found ! thanks a lot bud !

Should be fixed with version 4.5.1.

FYI - works like a charm ! Thanks again.