[APP][Pro] < group > (3.2.4 - Stable)

I have just installed the Alpha and come across a problem: go into the app configuration, select my group of curtains then try to make any changes and I get the error message pop up, "Error: group.setSettings is not a function. "

Also I see the group I am editing in the list. Would that cause a problem if I added the group to the group?

Edit: I can’t capture the error message as it disappears when the screen capture occurred.

Sorry, I’ve just seen the link at the top of the topic about where to post reports so I will add it there as well.

All good, to answer your question.

Currently the alpha required a small ‘hack’ to get the settings to work due to an issue with Homey.

https://github.com/athombv/homey-web-api-issues/issues/5

This means that ‘old’ groups you created will not be able to be edited with in the settings. (until athom fix their issue).

The fact the current item shows in the list is a bug - and it would be great if you could create a ticket for it.

Thanks!

(V2).00rc12 is out. IF you are still experiencing the problem - please let me know with specific details / steps on what you did to cause the error - so I can reproduce it.

Thanks all!

2 Likes

rc12 seems to have fixed it for me Jamie

With rc12 (just updated) creating a new group is instant on Android. So that issues seems resolved.

I just created a new group, added 2 ikea gu10 bulbs (connected through Hue), renamed it and moved it in a zone.

Works as expected, but as soon as I reboot it’s still the same errors.
Homey: 2.0.0-rc12
iOs app: 0.18.0 (241)
< Group > version: v2.0.208 beta

@jamie this issue sounds like one that also pops up in the Homeykit app: for some reason, device.capabilitiesObj.SOME_CAPABILITY can sometimes be undefined. Still haven’t worked out why/when it happens.

Yeah, ran into that one on Heimdall too. Found after 2 days of searching (on another users homey without access) it was because of a crashed app for which the device showed that symptoms.

Now I only add a device when device.ready=true, haven’t had the issue since.

2 Likes

Ah, nice one!

It seems that another issue re-appeared, which I mentioned for rc9 (see post #47 earlier) :frowning: . @Davy reported it also just now.
An existing group gives the issue “er ging iets fout…”. A newly created group works though. Have not tested it with a reboot.

Ok from what I can gather when you :

  1. create a new group
  2. rename said group
  3. then restart your homey

You get an error and you can not control the group.

I suspect this actually is actually a race condition with in the homey restart process, which is why it only affecting some groups for some people. @DaneedeKruyff gave me the hint with his device.ready.

When the groups app starts up it grabs all the devices and says to keep an eye out for changes. Now if the group app loads that piece of code prior to the devices app (fibaro/hue/whatever) loading the actual device - it will throw a hissy fit. Which in turn might cause the issue people are experiencing.

Honestly the weirdest part of this bug is the fact it only occurs after renaming a group, I have no idea why that would be the case @robertklep / @DaneedeKruyff ?

If i’m right, then that means two things : ONE : after restarting homey if you wait for all your devices to load - then restart < group > - you wont get the error. TWO: I’m actually a bit stuck as to how to correctly fix this issue short of some sort of lame timer hack.

Welcome to the wonderful works of lame timer hacks. We’re doing the exact same thing in HomeyKit (when the app starts up, it checks every 30 seconds to see if the number of devices has changed; if it has, it means there are still devices being created and we wait another 30 seconds).

Alternatively, but that might be something that won’t work for your app, we’re watching the device.update event and keep track of which devices are “new” (not seen yet). On v1.5 we used device.create, but on v2 that event may trigger on devices that aren’t “ready” yet.

Is renaming a group the same as renaming any Homey device? If so, I have absolutely no idea why that would cause problems, because it’s something beyond the control of your app (from what I know).

Well, I did go for the lame timer hack (but that’s for adding a new device):


:slight_smile:

I’ve also tried watching the device.update but it seemed the floodgates were opened and decided to not listen in just for finding out when a device became ready after adding so I went the dirty road.
It would be nice if device.ready was emitted but on the other hand I have no idea how many times that would occur.

Manually restarting the < Group > app does makes the groups work after a reboot, good workaround :hugs:

Is 2 seconds enough time in your experience?

Yes, for me in my test situation it’s enough.
I wrote this code in anticipation of a useable solution from Athom but not sure we will get on since Emile told us ‘A device’s lifecycle is actually quite complex’ and closed the issue. :frowning:

I generalized it a bit so it will check a device once per second:

  async waitForDevice(id) {
    const device = await this.api.devices.getDevice({ id });
    if (device.ready) {
      return device;
    }
    await delay(1000);
    return this.waitForDevice(id);
  }

(theoretically, if a device never becomes ready, this solution isn’t great, but YOLO)

I’ve been able to reliably reproduce the bug and more importantly log it. Consequently ive been able to ‘fix it’ - by fix it I mean the group will now be disabled and let you know to restart the app if the group contains any problem devices - For Omega testers.

YOLO fix coming soon, possibly something with doubles the setTimeout value each time it is called.

3 Likes

Alpha is now running 2.1.6 - which will now poll the grouped devices and check to ensure that they are .ready.

If a group contains a device(s) which is not ready, has crashed, app disabled etc. The group will continue to work with out said device(s) until When/If they start working again.

This also will fix the race condition people have experienced after renaming/rebooting their homey.

Thanks

4 Likes