dgreif / homebridge-hatch-baby-rest

A homebridge plugin for Hatch Baby Rest night light
MIT License
70 stars 19 forks source link

Plugin crash after latest Rest updates #115

Closed chaseconey closed 5 months ago

chaseconey commented 5 months ago

Overview

It seems this plugin is crashing after Hatch released their latest updates to the Hatch app (or at least the start of the crash corresponds to the launch of the new features). When trying to turn on the Rest 2nd Gen, homebridge crashes and completely restarts.

Turning off does seem to still function properly.

Details

image

Logs

[1/28/2024, 12:14:54 PM] [HatchBabyRest] Turning on first favorite for Sleep Pod
[1/28/2024, 12:14:54 PM] TypeError: Cannot read properties of undefined (reading 'id')
    at RestIot.<anonymous> (C:\Users\comp\AppData\Roaming\npm\node_modules\homebridge-hatch-baby-rest\lib\homebridge-hatch-baby-rest\rest-iot.js:38:56)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\comp\AppData\Roaming\npm\node_modules\homebridge-hatch-baby-rest\lib\homebridge-hatch-baby-rest\rest-iot.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
dgreif commented 5 months ago

Thanks for the heads up! I haven't upgraded my app yet, but will take a look when I get a chance. Might not be till this weekend

HipsterBrown commented 5 months ago

I ran into this as well while setting up the plugin for the first time. My Hatch Rest+ is using the latest update. It appears to be an issue setting the current favorite when an empty array is returned from fetching all favorites. I added an early return to the method to resolve the error but no routine or favorite is set when turning on the device from Homebridge or HomeKit. Not sure what Hatch changed to this data.

dgreif commented 5 months ago

This is fixed in v4.1.0