hasscc / petkit

🐱 Petkit feeder components for HomeAssistant
Apache License 2.0
119 stars 16 forks source link

Login error code 125 #36

Closed Redwid closed 1 year ago

Redwid commented 1 year ago

Hello,

I'm getting login error with code 125 and message '手机号未注册', that supposed to be translated to 'Mobile phone number is not registered' Why mobile number if I'm using email to login in mobile app?

Log:

Logger: custom_components.petkit
Source: custom_components/petkit/__init__.py:87 
Integration: Petkit ([documentation](https://github.com/hasscc/petkit), [issues](https://github.com/hasscc/petkit/issues)) 
First occurred: 14:32:57 (1 occurrences) 
Last logged: 14:32:57

Petkit login removed-email-here@gmail.com failed: {'error': {'code': 125, 'msg': '手机号未注册'}}
bebilith commented 1 year ago

I had the same issue, which could be resolved by using the US API configuration.yaml

petkit:
  # Single account
  username: xxx@yyy.com 
  password: hunter2 # MD5 or Raw password
  api_base: http://api.petkt.com/latest/
Redwid commented 1 year ago

Thanks @bebilith, that's works!

But now I have just Petkit request_api service, and nothing else. Needs to find out why...

bebilith commented 1 year ago

Did you add the service to your config? service: petkit.request_api target: entity_id: sensor.d4_petkit_state # Any sensor entity in the account data: api: /discovery/device_roster params: key: val

Then you should see a bunch of petkit entities, which you can add to cards.

Redwid commented 1 year ago

Can't find a correct identification place for it. It supposed to be a separate block in yaml as described here: https://www.home-assistant.io/docs/scripts/service-calls/ But that yaml block:

petkit:
  username: !secret petkit_username
  password: !secret petkit_password
  api_base: http://api.petkt.com/latest/

service: petkit.request_api
target:
  entity_id: sensor.d4_petkit_state
data:
  api: /discovery/device_roster
  params:
    key: val

Producing that errors in config validation:

Integration error: data - Integration 'data' not found. 
Integration error: service - Integration 'service' not found. 
Integration error: target - Integration 'target' not found.
Redwid commented 1 year ago

It started working without service config. image