https://github.com/hasscc/petkit
🐱 Petkit feeder components for HomeAssistant
https://github.com/hasscc/petkit
custom-component feeder home-assistant petkit
Last synced: 4 months ago
JSON representation
🐱 Petkit feeder components for HomeAssistant
- Host: GitHub
- URL: https://github.com/hasscc/petkit
- Owner: hasscc
- License: apache-2.0
- Created: 2021-08-26T09:45:20.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-08-30T02:59:01.000Z (almost 2 years ago)
- Last Synced: 2023-11-07T16:09:51.093Z (over 1 year ago)
- Topics: custom-component, feeder, home-assistant, petkit
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 113
- Watchers: 13
- Forks: 13
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Petkit for HomeAssistant
> ⚠️ I don't have more time to maintain this repo, [`RobertD502/home-assistant-petkit`](https://github.com/RobertD502/home-assistant-petkit) is a better integration, please switch to it.
------
## Installing
> [Download](https://github.com/hasscc/petkit/archive/main.zip) and copy `custom_components/petkit` folder to `custom_components` folder in your HomeAssistant config folder
OR
```shell
# 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.
## Config
> It is recommended to use another account credentials for this integration.
>
> Add the following to your `configuration.yaml`:```yaml
# configuration.yamlpetkit:
# 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:
```yaml
# configuration.yamlpetkit:
# 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:
>> 1. Go to `Settings -> Devices & Services -> Entities`
>> 2. Search for `petkit` (you should see new entities with Integration label `Petkit`)> If integration not successful:
>> 1. Check your `home-assistant.log` file
>> 2. Search for `petkit` in the file
>> 3. There should be an error message related to your issue
>> 4. 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': '登录会话期,请重新登录'}}`## Services
#### [Request Petkit API](https://my.home-assistant.io/redirect/developer_call_service/?service=petkit.request_api)
```yaml
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
```