jubepue/homebridge-petkit-platform

Doesn't work out of box

Opened this issue · 4 comments

Hey,

Background: I have Fresh Element Mini with China region and I have got the device in the list only with India country code.
First issue: Regarding the request there is not right TZ and locale.

The main problem: Trying to work with you plugin, has some issues. While using actions from Home App of my Fresh Element Mini, there is no success and logs have next issues:

PetkitOpenAPI request: method = post, endpoint = http://api.petktasia.com/latest, path = /feedermini/saveDailyFeed, params = null, body = {"amount":20,"day":"20230829","deviceId":"100048362","time":-1}, headers = {"X-Client":"ios(15.5;iPhone12,3)","Accept":"*/*","X-Timezone":"2.0","Accept-Language":"es-ES;q=1","Accept-Encoding":"gzip, deflate","X-Api-Version":"8.17.1","Content-Type":"application/x-www-form-urlencoded","User-Agent":"PETKIT/8.17.1 (iPhone; iOS 15.5; Scale/3.00)","X-TimezoneId":"Europe/Madrid","X-Locale":"es_ES","X-Session":"XXX"}
PetkitOpenAPI request: method = post, endpoint = http://api.petktasia.com/latest, path = /feedermini/saveDailyFeed, params = null, body = {"amount":20,"day":"20230829","deviceId":"100048362","time":-1}, headers = {"X-Client":"ios(15.5;iPhone12,3)","Accept":"*/*","X-Timezone":"2.0","Accept-Language":"es-ES;q=1","Accept-Encoding":"gzip, deflate","X-Api-Version":"8.17.1","Content-Type":"application/x-www-form-urlencoded","User-Agent":"PETKIT/8.17.1 (iPhone; iOS 15.5; Scale/3.00)","X-TimezoneId":"Europe/Madrid","X-Locale":"es_ES","X-Session":"XXX"}
[SET][Fresh Element Mini] Characteristic Error: Error: Request failed with status code 404
    at createError (/usr/local/lib/node_modules/homebridge-petkit-platform/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/usr/local/lib/node_modules/homebridge-petkit-platform/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/homebridge-petkit-platform/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  config: [Object],
  request: [ClientRequest],
  response: [Object],
  isAxiosError: true,
  toJSON: [Function: toJSON]
}
[SET][Fresh Element Mini] Characteristic Error: Error: Request failed with status code 404
    at createError (/usr/local/lib/node_modules/homebridge-petkit-platform/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/usr/local/lib/node_modules/homebridge-petkit-platform/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/homebridge-petkit-platform/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  config: [Object],
  request: [ClientRequest],
  response: [Object],
  isAxiosError: true,
  toJSON: [Function: toJSON]
}

Does any one know how to solve it?

Have tried to install your fork . I am having a similar issue to the original plugin. I would appreciate your help . I am on the "api.eu-pet.com"according to Charles. Have previously used other plugins with success since 2021 on the Asia server but with the Eu server having issues . Enter in my credentials into the plugin settings and get the following ,

"Initializing PetkitPlatform...
PetkitOpenAPI request: method = post, endpoint = http://api.petkt.com/latest, path = /user/login, params = null, body = {"username":"xxxxxxxxxxxxxxx.com","password":"xxxxxxxxxxxxxxxxxxxxxxxxx","encrypt":"1","timezoneId":"Europe/Madrid","timezone":"2.0","locale":"es_ES"}, headers = {"X-Client":"ios(15.5;iPhone12,3)","Accept":"/","X-Timezone":"2.0","Accept-Language":"es-ES;q=1","Accept-Encoding":"gzip, deflate","X-Api-Version":"8.17.1","Content-Type":"application/x-www-form-urlencoded","User-Agent":"PETKIT/8.17.1 (iPhone; iOS 15.5; Scale/3.00)","X-TimezoneId":"Europe/Madrid","X-Locale":"es_ES","X-Session":""}"

PetkitOpenAPI response: {"error":{"code":122,"msg":"El nombre de usuario o la contraseña son incorrectos."}} path = /user/login
Failed to login. Please check if the config.json is correct.

I would appreciate any help or tips. Have turned off location services within the app iOS .My country code is 353 and each time I get the above error.As you previously stated the wiki really doesn't relate to the plugin . From someone who has 2 Homebridge instances and scrypted running I can't be so incompetent to have missed something so simple with the install . Again any help appreciated .

@killi23 try to double check the region by authorisation via actual device + proxy. you will see the actual domain and find it in plugin mapping

Apologies for my ignorance. If it would be possible to explain in simpler terms I would appreciate it.

@monkeycatdog @jubepue I have the same problem. If i wanna feed, i get this error message: "Characteristic Error: Error: Request failed with status code 404".
I checked Charles, so the actual domain is: https://api.eu-pet.com.

Where is the Problem? The plugin find the feeder. Only control doesn't work.