[Bug] GE Smart Fan Control driver - Cannot invoke method last() on null object

@bobbyD @bcopeland getting error on the inbuilt GE Smart Fan Control driver when my son sets his fan to high. This has been happening for several releases, finally just reporting it.

How are you setting it to high (device detail page, specific app, etc.)? Can you also provide logs for this like the above with debug logging enabled? Thanks!

@bertabcd1234 thanks for your help. My son is using Homekit to set it to medium or even high. Here are the logs with debug on:

Device event logs

Device Data section just in case:

Thanks! It looks like that "deviceType" value from your "Device Data" section matches up with the three-speed model. If so, that will give you high, medium, and low, so medium-high would fail (although with a clearer error message in a future version). That's what's happening with the error for you. It looks like "medium" works. Is HomeKit only giving you three speeds, and is the highest one "medium-high" for some reason? (The logs will tell you what parameter it's passing to the "setSpeed" command, so that's how I'm telling.)

HomeKit presents a slider just like a dimmer. I seem to remember that the 4th speed was recently added to this driver. Since there is a data point to know whether the device supports 3 vs 4 speeds can this just be fixed programmatically? I ask because I have been using these devices on ST and HE for over 10 years and the driver always sets speed to based on thresholds 1-33(low), 34-66(medium), 67-100(high). With the 4 speed version the thresholds could be different.

With HomeKit only presenting a slider my son attempts to slide it to the middle for medium speed.

Thanks!

Thanks for the information! I added one to HomeKit to test, so I have a better idea of how to match what you're seeing with the driver now.

The driver already does this -- it only reports the supported speeds based on what the device supports, and HomeKit slider doesn't ultimately send numbers to the driver but rather the speeds, in my testing from only among the supported set. This means one of two things is wrong in your case, and here's what I'd check:

  1. What does supportedFanSpeeds say under "Current States" on the "Commands" tab of the device detail page for your device? Yours should say something like "[low, medium, high, off]".

    • If you see four speeds (plus off) instead, switch to the "Device" driver, run the command to delete all current states, and then switch back to the GE Smart Fan Control driver and do a "Save" on the "Preferences" tab (and maybe "Refresh" to get all the data back if it's not there after that on the "Current States" tab -- but the save, or alternatively a Configure, is the magic to get "supportedFanSpeeds" back).
  2. If the above is correct, you might need to remove and re-add to HomeKit to get it to "see" the new speeds; it might only read these when initially being added, not after. (The only previous version of this driver populated it with the speeds above, so you should really only see this if maybe you used a different driver at some point that populated it differently -- but a previous version of the driver shouldn't have been it, nor should the current one unless you have the only model currently know to support four speeds. If you are a beta tester, it is possible something got messed up then...)

Thanks again!

Appreciate the continued support

3 speeds:

FWIW as another data point, this id device #23 on my hub meaning it was paired in March 2018 when I was moving over from ST. I had to replace the switch around 2020 (according to my Amazon purchase history) which I believe still predates the 4 speed model. I have always used the inbuilt driver.

Given the age of my system I am also using an older Homebridge integration from tonesto7. I tried the inbuilt version but because I run multiple hubs and also need 2 separate Homes (one for kids and one for parents) I use the custom integration. I do have this fan along with many others under the 3 speed section but it does appear to be sending medium low and medium high

Knowing that you don’t support custom integrations, could the driver be updated to default any speed that startsWith “medium” to just medium if the device is a 3 speed model? I ask because I can reproduce this in MakerAPI too by setting speed to “medium-low”. Would be great to have this fail-safe in place for any type of integration.

Ah, I only checked the built-in HomeKit Bridge integration. I suspect your custom integration is just assuming a default, fixed set of speeds rather than reading supportedFanSpeeds from the device. The best solution would be for the author -- or any app author -- to make sure that setSpeed() is never called with an invalid parameter. That way, it can work with any device.

The Maker API problem is expected, too: you could send any invalid speed, such as "blaaaaarf," and the same would happen. Maker API just makes it easier to send bad ones. :slight_smile:

Anyway, since "medium-low" and "medium-high" were popular enough default assumptions for a while: maybe making them both to to "medium," as you suggest, would be a decent guard for misbehaved apps...

1 Like

That would be awesome. Thanks!

The app is still going strong and receiving updates. The app has options for adding fans as having anywhere between 3 and 6 speeds. Or just as fan without speed configuration.

Oooo, wait, is this problem solvable in the integration app then? I have a driver modification in mind but will stop if it is -- that's where it belongs, anyway. :slight_smile:

Bill thanks and when IU mentioned "older" I mean I am not using the latest v3.0, still using the latest version of 2.0. I am not ready to upgrade to the latest HomeBridge plugin yet. As mentioned above I have my fans in the correct 3 speed bucket but it is not working.

@bertabcd1234 thank you for considering this if you don't feel it is a good idea to include in the inbuilt driver I will just create my own driver then to correct for the time being. Up to you.

Any reason why? It was a smooth update for me.

@bertabcd1234 Again thank you for your help troubleshooting this issue. I just created my own custom driver to use for the time being until I can upgrade and test the latest Homebridge v3. I will revert back to the inbuilt driver if it behaves correctly with my 3 speed fan controllers.

Time... I have an aging QNAP NAS that I have Homebridge working on and I have left things alone until I can transition to a new NAS. Mostly an "if it ain't broke" situation plus time to upgrade all my other containers to the latest versions like NodeRed, Grafana, etc.

1 Like