⚠️ I don't have more time to maintain this repo,RobertD502/home-assistant-petkit
is a better integration, please switch to it.
Download and copy
custom_components/petkit
folder tocustom_components
folder in your HomeAssistant config folder
OR
# Auto install via terminal shell
wget -q -O - https://cdn.jsdelivr.net/gh/al-one/hass-xiaomi-miot/install.sh | DOMAIN=petkit REPO_PATH=hasscc/petkit ARCHIVE_TAG=main bash -
After installing, confirm that the custom_components/petkit
folder exists in your HomeAssistant config folder.
It is recommended to use another account credentials for this integration.
Add the following to your
configuration.yaml
:
# configuration.yaml
petkit:
# Single account
username: 86-18866668888 # Username of Petkit APP (小佩宠物), important to use country code
password: abcdefghijklmn # MD5 or Raw password
api_base: # Optional, default is China server: http://api.petkit.cn/6/
scan_interval: # Optional, default is 00:02:00
feeding_amount: # Optional, default is 10(g), also can be input_number entity id.
# Multiple accounts
accounts:
- username: [email protected]
password: password1
api_base: http://api.petktasia.com/latest/ # Asia server
feeding_amount: 20
- username: [email protected]
password: password2
api_base: http://api.petkt.com/latest/ # America server
feeding_amount: input_number.your_feeding_amount_entity_id # min:10, step:10
For a simple test to ensure integration added correctly, the following works as well:
# configuration.yaml
petkit:
# Single account
username: [email protected] # Username of Petkit APP (小佩宠物), important to use country code
password: your_password # MD5 or Raw password
api_base: http://api.petkt.com/latest/ # America server - this can be changed to any other server
To check if integration successful:
- Go to
Settings -> Devices & Services -> Entities
- Search for
petkit
(you should see new entities with Integration labelPetkit
)
If integration not successful:
- Check your
home-assistant.log
file- Search for
petkit
in the file- There should be an error message related to your issue
- Use Google translate
Example error message:
2023-06-01 14:58:08.450 ERROR (MainThread) [custom_components.petkit] Petkit login [email protected] failed: {'error': {'code': 125, 'msg': '手机号未注册'}}
2023-06-01 14:58:08.501 WARNING (MainThread) [custom_components.petkit] Got petkit devices for [email protected] failed: {'error': {'code': 5, 'msg': '登录会话期,请重新登录'}}
service: petkit.request_api
target:
entity_id: sensor.d4_xxxxxx_state # Any sensor entity in the account: the Petkit sensor entity ID shown in Settings -> Devices & Services -> Entities
data:
api: /discovery/device_roster
params:
key: val