Frontend: Trying to dim group lights throws a TypeError

Created on 18 Jul 2018  路  28Comments  路  Source: home-assistant/frontend

Home Assistant release with the issue:
0.73.2 // 0.74

Last working Home Assistant release (if known):
Not sure (maybe(!) 0.72 // 0.71)

Browser and Operating System:
Windows 10 (1803) and Chrome 67.0.3396.99 (64-Bit)

Description of problem:
In previous versions of Home Assistant you could click on the header of a group only consisting of lights and then dim or change the color of all the lights in the group. This is no longer possible and throws an error. (The color wheel and brightness slider don't appear anymore.)
image

Javascript errors shown in the web inspector (if applicable):

http://zhass.io:8123/frontend_latest/b8e8990946547661bcfb.chunk.js:618:268 Uncaught TypeError: Cannot read property 'length' of undefined

Additional information:
Issue https://github.com/home-assistant/home-assistant/issues/15513 was created in the home assistant issue tracker.

All 28 comments

The lights group top part would have to contain sub lights that had that feature, if there was one light that didn't it would not appear.

It seems like it's no longer appearing for anything, even groups that only have the same capability. at least that's what I'm experiencing with my lifx and other dimmable groups.

Thanks,
Alan

I've noticed this too and was going to raise an issue, but found this one so will support / follow this one instead.

This is still an issue in 0.74, and is also present in the Lovelace version of the UI.

This is a really frustrating bug for those of use who have multiple bulbs in a room and need to be able to control the brightness/colour of them (but still need individual light control so can't use light group, and don't want to/can't specify rooms in Hue) so hopefully someone can figure out why this has broken. (I've tried looking through the code to determine where the issue is myself but with no luck).

This issue also affects uniform groups of other types of devices. I'm observing this with cover type devices (formerly a combined slider was available to set cover position, now it does not appear any more for the same group, device capabilities unchanged). Was working on 0.70.0, broken on 0.74.0. The same TypeError mentioned above is raised:

http://192.168.1.220:8123/frontend_latest/9c70f781d9a3bcaf521c.chunk.js:618:268 Uncaught TypeError: Cannot read property 'length' of undefined

Version: home-assistant-frontend==20180720.0

Edit: Did some initial investigation after setting up the frontend development according to the manual:

Tried to failsafe the ValueError in https://github.com/home-assistant/home-assistant-polymer/blob/97f548a9f1b25904bf93ec969e8a9489a14aff7d/src/dialogs/more-info/controls/more-info-group.js#L60 by checking for undefined entIds before running the for-loop hoping this might be a low-hanging fruit:

if (typeof entIds !== "undefined") {
 for (var i = 0; i < entIds.length; i++) {
    var state = hass.states[entIds[i]];
    if (state) {
      states.push(state);
    }
  }
}

It wasn't, I'm getting the following (Browser-)console output (when opening the control for group.treppenhaus on the GUI), which leaves me beyond what I can quickly debug. I'm hoping somebody with experience in this code area just needs to take a quick look:

Object { type: "config/entity_registry/get", entity_id: "group.treppenhaus" }
app.js:48011:19
Error 
Object { message: "Entity not found", code: 3 }
app.js:272:19

No obviously related output on the terminal running hass --debug

I'll update if I get to work on it again, but I likely won't find the time to dig into this more soon.

Edit2 The answer seems to come from here https://github.com/home-assistant/home-assistant/blob/a6880c452f20419c16c6d7f03c6f58a1b5a0bf1f/homeassistant/components/config/entity_registry.py#L52 -- That file saw a lot of change with the switch to 0.72 which coincides with when the feature seems to have stopped working: https://github.com/home-assistant/home-assistant/commit/a6880c452f20419c16c6d7f03c6f58a1b5a0bf1f#diff-a8344d9f2a718727578faabdaf30714b

Edit3 It works with 0.71.0 -- that would be consistent with the refactoring in 0.72 as the cause of this.

Same issue for me with Yeelights

frontend_latest/b8e8990946547661bcfb.chunk.js:618:268 Uncaught TypeError: Cannot read property 'length' of undefined

Definitely a problem. Thanks ahead to anyone who solves it.

Hi @balloob , based on the comments above the issue may have been introduced with a change you migrated? If you've not seen this issue already could you take a look at it, it affects LoveLace too, but I've not been able to unpick the code to understand where the issue originates. Thanks in advance!

I re-ran in debugging mode and put a breakpoint on https://github.com/home-assistant/home-assistant/blob/a6880c452f20419c16c6d7f03c6f58a1b5a0bf1f/homeassistant/components/config/entity_registry.py#L52 -- the line is only ever executed when running with the if (typeof entIds !== "undefined") { I introduced to prevent the original javascript error. So I can't say for sure that line or the corresponding change is at fault.

this might be related, says it will be corrected in the next beta however they mention languages, I'm using English with the same issue. will wait and see.

I barely check the "legacy" UI since lovelace released, until last night I was testing 0.76.0b2 beta. I just hit the same issue with a very simple setup

# groups.yaml
climate:
  name: Climate
  entities:
    - climate.living_room

Browser console log:

more-info-group.js:60 
Uncaught TypeError: Cannot read property 'length' of undefined
    at HTMLElement.computeStates (more-info-group.js:60)
    at D (property-effects.js:815)
    at Object.E [as fn] (property-effects.js:432)
    at x (property-effects.js:159)
    at w (property-effects.js:125)
    at property-effects.js:409
    at HTMLElement._propertiesChanged (property-effects.js:405)
    at HTMLElement._flushProperties (properties-changed.js:335)
    at HTMLElement._flushProperties (property-effects.js:1555)
    at HTMLElement.ready (property-effects.js:1660)

On Home Assistant 0.76.0:

Uncaught TypeError: Cannot read property 'length' of undefined
    at HTMLElement.computeStates (more-info-group.js:60)
    at D (property-effects.js:815)
    at Object.E [as fn] (property-effects.js:432)
    at x (property-effects.js:159)
    at w (property-effects.js:125)
    at property-effects.js:409
    at HTMLElement._propertiesChanged (property-effects.js:405)
    at HTMLElement._flushProperties (properties-changed.js:335)
    at HTMLElement._flushProperties (property-effects.js:1555)
    at HTMLElement.ready (property-effects.js:1660)
http://hass.io:8128/frontend_latest/df03c3bc2add9d4f4eab.chunk.js:618:268 Uncaught TypeError: Cannot read property 'length' of undefined

yes I am not sure why this was closed?

I can confirmed my issue has been fixed. Can you make sure you are running on latest frontend? Try Ctrl+F5 force refresh.

It still doesn't work. Although it was mentioned that the issue has to do something with climate (groups)?
I actually don't have anything like that and I'm just opening the "more-info" dialog on a group full of lights (no lovelace).

They are sharing the same more-info-group.js code base.

As you log showed, the exception was thrown at frontend_latest/df03c3bc2add9d4f4eab.chunk.js. However, I cannot find this js file in the 0.76 frontend

pi@hassbian:/srv/homeassistant/lib/python3.5/site-packages/hass_frontend $ ll d*.js
-rw-r--r-- 1 homeassistant homeassistant 17225 Aug 17 14:19 d49e145c6f4386e42e11.chunk.js
-rw-r--r-- 1 homeassistant homeassistant   230 Aug 17 14:19 d8010a429cf327564ff0.chunk.js
-rw-r--r-- 1 homeassistant homeassistant 14513 Aug 17 14:19 d92ef4603b52b7f51cde.chunk.js

Mhm, that's weird. Restarted Home Assistant and also did a "Force Refresh" like you asked for.
https://i.imgur.com/yL5T1W7.png
Same issue is also present in the latest version of Firefox (otherwise in Chrome) (for me atleast). (Never used Hass there before).

It's still not fixed for me either. groups of lights that use to be dimmable no longer have that option still. full ui refresh and browser cache cleared.

this should be reopened.

edit edit: i have the same file @TheJulianJES is referencing and same error. I suspect it has to do with our groups. do you have a group for color or dimmable lights? That's why you aren't seeing the error but we are.

root@ha02:/usr/share/hassio/homeassistant/deps/lib/python3.6/site-packages/hass_frontend# ls df03c3bc2add9d4f4eab* -lh
-rw-r--r-- 1 root root 91K Aug 6 06:08 df03c3bc2add9d4f4eab.chunk.js
-rw-r--r-- 1 root root 21K Aug 6 06:08 df03c3bc2add9d4f4eab.chunk.js.gz
-rw-r--r-- 1 root root 1023 Aug 6 06:08 df03c3bc2add9d4f4eab.chunk.js.LICENSE
-rw-r--r-- 1 root root 199K Aug 6 06:08 df03c3bc2add9d4f4eab.chunk.js.map

@mealan you are not on 0.76. The file you showed was created on Aug 6, and 0.76 just released yesterday.

Same problem, no dimmable options for group lights and I鈥檓 running 0.76

@awarecan ohhhh, i'm pretty sure i know what version i'm on :)

Home Assistant
0.76.0

edit: all files in that directory are from august 6, and yes i updated to 0.76.0 this morning before replying

@awarecan or @balloob how does this get reopened? same issue with 76.1

@mealan I am sure your front end is not on 0.76, please check clean your config/deps folder and try again.

Same issue here. I'm on 0.76.1

@eemmeeuuffcc this issue has been fixed on 0.76. If you still have problem, please open a new issue and post all detail information

Might be getting closer, however not there yet.
removed /deps folder that had the hass_frontend subfolder
rebooted
loaded page a new version of the front end is available, clicked refresh

clicked light group (still no dimming or color options)
same error
frontend_latest/df03c3bc2add9d4f4eab.chunk.js:618:268 Uncaught TypeError: Cannot read property 'length' of undefined
however, now I can't find that file either after looking, so it was in the HASS_frontend folder under deps.
now I'm not sure what component would be looking for that exact version or file name.

Thanks for your assistance.

edit: after a full browser cache clear I'm no longer that frontend error, however the dimmable lights option and color aren't available to set as one.

removed all add-ons and double checked all components, nothing has reloaded anything in the deps folder.


@awarecan
Since the front end is no longer throwing this exact error, but the outcome is the same (can't set a group status by clicking the header), should a new issue be opened?


also to note, you can't do this in lovelace either

@mealan I'm now facing the same issue. Maybe the fix was only kind of a "workaround", to not throw the error (as the color wheel still doesn't show)?

@TheJulianJES yep, my interface also said I was on the latest version. Seems like I've got to agree with you. but we might have to open a new issue for the same thing.

Like @TheJulianJES said, the fix resolve one front end issue, but may not be able bring the change group color feature back, please open a new issue along with new screenshot and console log if you have.

issue #1589 was opened in polymer.

Was this page helpful?
0 / 5 - 0 ratings