homebridge-petkit-feeder-mini
homebridge-petkit-feeder-mini copied to clipboard
Cannot read property 'sn' of undefined
I am getting the above error message. This is what I'm seeing in the Homebridge logs. I have the latest version of Homebridge and your plugin. Any help would be appreciated. I have the Fresh Element feeder and I'm in the US.
[3/24/2021, 1:16:41 PM] [petkit_feeder_mini] [INFO] found you ownd one Feeder with deviceId: redacted. [3/24/2021, 1:16:41 PM] [petkit_feeder_mini] [ERROR] unable to get device(redacted) status: undefined (node:17559) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'sn' of undefined at /homebridge/node_modules/homebridge-petkit-feeder-mini/index.js:637:68 at /homebridge/node_modules/homebridge-petkit-feeder-mini/index.js:966:27 at processTicksAndRejections (internal/process/task_queues.js:93:5)
Sorry for the delay. Could you please goto the plugin settings, set the log level to ‘debug’(in config.json change ‘log_level’ to 0) and then update the log? That will helpful to solve the problem.
Here is the debug log:
[3/25/2021, 10:01:43 PM] [petkit_feeder_mini] [DEBUG] http request success
[3/25/2021, 10:01:43 PM] [petkit_feeder_mini] [DEBUG] {"result":{"d4":{"enable":0},"devices":[{"type":"Feeder","data":{"name":"Dog Feeder","createdAt":"2020-12-17T17:03:06.285Z","id":redacted,"state":1,"status":{"desiccantLeftDays":0,"errorPriority":0,"feeding":0,"food":946,"ota":0,"overall":1,"percent":37,"pim":1,"wifi":{"bssid":"244bfe0b3ae8","rsq":-61,"ssid":"IoT-2G"}},"relation":{"petIds":["100193648"],"userId":"redacted"},"desc":"No feeding plan."}}],"cozy":{"gearsTotal":6,"enable":1,"tempunit":0,"sTempMin":10,"isShowDeviceSafetyClause":0,"gearsOffset":3,"sTempMax":42},"feeder":{"isShowDeviceSafetyClause":0},"k2":{"enable":1},"go":{"hasMarks":0,"maxMarksPerRoute":30,"markEnabled":1},"feedermini":{"isShowDeviceSafetyClause":0},"tools":[{"type":"walkpet","data":{"goal":10}},{"type":"weight"},{"type":"remind","data":{}}],"t3":{"enable":1},"d3":{}}}
[3/25/2021, 10:01:43 PM] [petkit_feeder_mini] [INFO] found you ownd one Feeder with deviceId: redacted.
[3/25/2021, 10:01:43 PM] [petkit_feeder_mini] [DEBUG] request initial device status from Petkit server.
[3/25/2021, 10:01:43 PM] [petkit_feeder_mini] [ERROR] unable to get device(redacted) status: undefined
(node:15257) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'sn' of undefined
at /homebridge/node_modules/homebridge-petkit-feeder-mini/index.js:637:68
at /homebridge/node_modules/homebridge-petkit-feeder-mini/index.js:966:27
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ...
to show where the warning was created)
(node:15257) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:15257) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
closed due to inactive.
@elfive why did you close this due to inactivity? I sent you the log like you requested but I never got a response back from you.
Sorry for closing this issue, I'll dig into this problem.
@jlhunter2008 for some reason, I'll release a new version of plugin(v2.1.1), and need you update the log, so I can locate the problem.
@elfive this is what's in the log now:
[4/9/2021, 8:31:28 AM] [petkit_feeder_mini] [DEBUG] http request success [4/9/2021, 8:31:28 AM] [petkit_feeder_mini] [DEBUG] {"result":{"d4":{"enable":0},"devices":[{"type":"Feeder","data":{"name":"Dog Feeder","createdAt":"2020-12-17T17:03:06.285Z","id":100015746,"state":1,"status":{"desiccantLeftDays":0,"errorPriority":0,"feeding":0,"food":1839,"ota":0,"overall":1,"percent":73,"pim":1,"wifi":{"bssid":"244bfe0b3ae8","rsq":-57,"ssid":"IoT-2G"}},"relation":{"petIds":["100193648"],"userId":"100139393"},"desc":"No feeding plan."}}],"cozy":{"gearsTotal":6,"enable":1,"tempunit":0,"sTempMin":10,"isShowDeviceSafetyClause":0,"gearsOffset":3,"sTempMax":42},"feeder":{"isShowDeviceSafetyClause":0},"k2":{"enable":1},"go":{"hasMarks":0,"maxMarksPerRoute":30,"markEnabled":1},"feedermini":{"isShowDeviceSafetyClause":0},"tools":[{"type":"walkpet","data":{"goal":10}},{"type":"weight"},{"type":"remind","data":{}}],"t3":{"enable":1},"d3":{}}} [4/9/2021, 8:31:28 AM] [petkit_feeder_mini] [INFO] found you ownd one Feeder with deviceId: 100015746. [4/9/2021, 8:31:28 AM] [petkit_feeder_mini] [DEBUG] request initial device status from Petkit server. [4/9/2021, 8:31:28 AM] [petkit_feeder_mini] [ERROR] unable to get device(100015746) status: TypeError: Cannot read property 'replace' of undefined [4/9/2021, 8:31:28 AM] [petkit_feeder_mini] [WARN] bypass initialize Petkit Feeder device(Dog Feeder).
@elfive any luck?