elfive / homebridge-petkit-feeder-mini

control your petkit feeder mini from homekit, get full use of iOS automation
Apache License 2.0
31 stars 10 forks source link

Cannot be used after update #12

Closed yclai1229 closed 3 years ago

yclai1229 commented 3 years ago

Appears after update

"[PetkitFeederMini] praseGetDeviceDetailInfo error: jsonObj is nothing."

And the battery is low in the home app, what should I do? Thank you

yclai1229 commented 3 years ago

[10/14/2020, 21:30:00] [feeder] praseGetDeviceDetailInfo error: jsonObj is nothing. [10/14/2020, 21:30:01] TypeError: Cannot set property 'mealAmount' of undefined at petkit_feeder_mini_plugin.hb_mealAmount_set (/usr/local/lib/node_modules/homebridge-petkit-feeder-mini/index.js:811:43) at RotationSpeed.emit (events.js:315:20) at RotationSpeed.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/EventEmitter.js:60:38) at RotationSpeed.Characteristic._this.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:369:23) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:967:36 at Array.forEach (:null:null) at Bridge.Accessory._this._handleSetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:835:18) at HAPServer.emit (events.js:315:20) at HAPServer.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/EventEmitter.js:60:38) at HAPServer._this._handleCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/HAPServer.js:731:23) at IncomingMessage. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/HAPServer.js:240:39) at IncomingMessage.emit (events.js:315:20) at endReadableNT (_stream_readable.js:1220:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)

elfive commented 3 years ago

As for the battery low alert, this may caused by the server delay or device issue or just a plugin error, im not sure of it, but you can try these steps to check the battery level or battery mode is correct:

  1. close the Petkit app, and make sure it not running in background.
  2. close any HTTP netflow capture app or VPN connection.
  3. launch the Petkit app, wait for it finish refreashing the device status, and then click the device.
  4. is there a battery icon showed?
  5. or click the setting icon at the right top, right under the device name, what status it shows? (online for charging or battery mode)

based on the log, it seems the plugin did not receive device status info from the petkit server and may a reason casued those errors. if possible could you provide:

  1. plugin version.
  2. config.json configure.(REMOVE sensitive infomation, like X-Session)
  3. full log of this plugin from homebridge start to this error.

these infomation may very useful for us to locate the problem.

PParit commented 3 years ago

I got the same problem too.

elfive commented 3 years ago

Any updates? If no update, I'll close this issue in 3 days.

PParit commented 3 years ago

I did try revert back to v1.8.8 and using the same config, it appeared working.

PParit commented 3 years ago

[PetkitFeederMini] JSON.parse error with:{"error":{"code":1,"msg":"Oops, our system is busy, try again in a bit"}}

This is happen after I upgrade v1.8.8 to v1.9.1

PParit commented 3 years ago

"accessories": [ { "headers": [ { "key": "X-Session", "value": "XXXX" } ], "name": "PetkitFeederMini", "location": "asia", "mealAmount": 1, "autoDeviceInfo": true, "sn": "PetkitFeederMini", "firmware": "1.394", "manufacturer": "Petkit", "model": "Petkit feeder mini", "enable_manualLock": false, "enable_polling": true, "polling_interval": 60, "autoResetDesiccant": false, "accessory": "petkit_feeder_mini" }

PParit commented 3 years ago

This is log file for v.1.9.1

[10/22/2020, 16:18:12] Homebridge is running on port 51428. [10/22/2020, 16:18:12] [PetkitFeederMini] start polling... [10/22/2020, 16:18:12] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:19:22] [PetkitFeederMini] start polling... [10/22/2020, 16:19:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:20:22] [PetkitFeederMini] start polling... [10/22/2020, 16:20:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:21:22] [PetkitFeederMini] start polling... [10/22/2020, 16:21:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:22:22] [PetkitFeederMini] start polling... [10/22/2020, 16:22:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:23:22] [PetkitFeederMini] start polling... [10/22/2020, 16:23:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:24:22] [PetkitFeederMini] start polling... [10/22/2020, 16:24:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:25:22] [PetkitFeederMini] start polling... [10/22/2020, 16:25:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:25:52] [Config] Running Command: sudo -E -n npm install -g homebridge-petkit-feeder-mini@latest [10/22/2020, 16:26:22] [PetkitFeederMini] start polling... [10/22/2020, 16:26:22] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:27:22] [PetkitFeederMini] start polling... [10/22/2020, 16:27:24] [PetkitFeederMini] successfully retrieved device infomation from server. [10/22/2020, 16:27:32] [Config] Rebooting linux server with command: "sudo -n shutdown -r now" [10/22/2020, 16:27:33] [HB Supervisor] Stopping services... [10/22/2020, 16:27:33] Got SIGTERM, shutting down Homebridge... [10/22/2020, 16:27:38] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null [10/22/2020, 16:27:57] [HB Supervisor] OS: Linux 5.4.51-v7+ arm [10/22/2020, 16:27:57] [HB Supervisor] Node.js v12.19.0 /usr/local/bin/node [10/22/2020, 16:27:57] [HB Supervisor] Homebridge Path: /usr/local/lib/node_modules/homebridge/bin/homebridge [10/22/2020, 16:27:57] [HB Supervisor] UI Path: /usr/local/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js [10/22/2020, 16:27:57] [HB Supervisor] Starting Homebridge with extra flags: -I [10/22/2020, 16:27:57] [HB Supervisor] Started Homebridge v1.1.6 with PID: 697 [10/22/2020, 16:27:59] Loaded config.json with 1 accessories and 1 platforms. [10/22/2020, 16:27:59] --- [10/22/2020, 16:28:01] Loaded plugin: homebridge-config-ui-x@4.30.0 [10/22/2020, 16:28:01] Registering platform 'homebridge-config-ui-x.config' [10/22/2020, 16:28:01] --- [10/22/2020, 16:28:01] Loaded plugin: homebridge-petkit-feeder-mini@1.9.1 [10/22/2020, 16:28:01] Registering accessory 'homebridge-petkit-feeder-mini.petkit_feeder_mini' [10/22/2020, 16:28:01] --- [10/22/2020, 16:28:01] Loading 1 platforms... [10/22/2020, 16:28:01] [Config] Initializing config platform... [10/22/2020, 16:28:01] [Config] Running in Service Mode [10/22/2020, 16:28:01] Loading 1 accessories... [10/22/2020, 16:28:01] [PetkitFeederMini] Initializing petkit_feeder_mini accessory... [10/22/2020, 16:28:01] [PetkitFeederMini] begin to initialize petkit feeder mini. Setup Payload: X-HM://0024W75BK5PB8 Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

┌────────────┐     
│ 861-07-824 │     
└────────────┘     

[10/22/2020, 16:28:02] Homebridge is running on port 51428. [10/22/2020, 16:28:01] [PetkitFeederMini] JSON.parse error with:{"error":{"code":1,"msg":"Oops, our system is busy, try again in a bit"}}

elfive commented 3 years ago

I published a new version of this plugin, version 1.9.2.

As the logs point out, I think it may be a http request header value error: [10/22/2020, 16:28:01] [PetkitFeederMini] JSON.parse error with:{"error":{"code":1,"msg":"Oops, our system is busy, try again in a bit"}} This error happens when the header set is not ok with the server, I suggest you set headers in this plugin with all headers you captured before. If it works in the new version, then you can safely update. Otherwise, please remain version 1.8.8 until further updates incoming.

Because version 1.9+ had replaced some deprecated libraries with newer libraries. So if version 1.8.* is works fine with you, you can still keep it there until I completely fixed this bug, and until then, no more new features will be published.

I noticed you was running Homebridge in a armv7 based device(maybe Reaspberry Pi?), if possible I suggest you use homebridge for docker to host the homebridge service.

PParit commented 3 years ago

Wow...It is working now. I have to include "X-API-Version" in the header too. Thanks!

elfive commented 3 years ago

glad it works for you.