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

Important announcement!!!

1. permanently stop this plugin develop ,unpublish from npmjs.com and no more further issue will be answerd.
2. highly recommended you the pet owner and pet lovers stop buying any petkit products.
3. it better feed your soul mate with natural food, like raw meat or dried meat.
4. thank you for your support.

homebridge-petkit-feeder-mini


NPM Version Total NPM Downloads Verified by Homebridge
Setup Guide | Contribute

1) Description

control your petkit feeder mini from homekit, get full use of iOS automation.

screenshotscreenshot2
screenshot3screenshot4

features

limitations

2) How to setup

Firstly, setup your Petkit mobile app.

Goto App Store, download Petkit mobile app, register, login, add device. before use this plugin you MUST make sure the app works fine with you.

Secondly, prepare to capture Petkit app http request.

Please goto this wiki page to find more detail.

Finally, retrieve infomation.

you should provide one critical infomation to this plugin: X-Session, if you have more than one Petkit feeder mini device, then you should alse provide deviceId in the header field of the config.json file.

Be aware of that, to minimize the effect to the Petkit server with unnecessary http requests, the plugin just update device status more than 10s interval, which means the status will bufferd at lease 10s.

here is a example of Quantumult X capture data page:

quantumultX

you can find X-Session data from the request header area and deviceId in response data area.

3) Configure

config.json field

field name type required default range description
platform string yes 'petkit_feeder_mini' 'petkit_feeder_mini' Must be 'petkit_feeder_mini' in order to use this plugin.
log_level int no 2 1,2,3,4,9 one of these values:
- 1: Debug
- 2: Info
- 3: Warn
- 4: Error
- 9: None
devices object yes --- --- Petkit Feeder device config.
See more detail info at decices field below.

devices field

field name type required default range description
location string yes 'cn' 'cn',
'asia',
'north_america'
China users:'cn';
Asia users: 'asia';
North America users: 'north_america';
other location because lack of infomation, not sure it will work.
You can find more info here.
model string no 'FeederMini' 'FeederMini',
'Feeder'
Petkit Feeder Mini: 'FeederMini'
Petkit Feeder Element: 'Feeder'
deviceId string tbd --- --- your Petkit feeder mini Id, which is buildin your device, will never change.
If you just have one Petkit feeder device, you can ignore this value.
If you just have more than one Petkit Feeder device, you must set this value.
headers array yes --- --- http request headers.
See more detail info at headers field below.
enable_http_retry no false true/false Enable or disable HTTP retry function, useful when your device or homebridge has a bad internet connection.
http_retry_count int no 3 1 to 5 max retry times when a http request failed.
DropMeal_name string no 'DropMeal' --- name of DropMeal switch in HomeKit.
MealAmount_name string no 'MealAmount' --- name of MealAmount fan speed in HomeKit.
FoodStorage_name string no 'FoodStorage_Empty'
or
'FoodStorage'
--- name of FoodStorage indicator in HomeKit.
Note: if reverse_foodStorage_indicator value is set to true, then the default name is 'FoodStorage_Empty', otherwise 'FoodStorage'
DesiccantLevel_name string no 'DesiccantLevel' --- name of DesiccantLevel indicator in HomeKit.
ManualLock_name string no 'ManualLock' --- name of ManualLock switch in HomeKit.
LightMode_name string no 'LightMode' --- name of LightMode switch in HomeKit.
Battery_name string no 'Battery' --- name of Battery indicator in HomeKit.
enable_polling bool no true true/false Automatically update device info from Petkit server.
polling_interval int no 60 60 to 3600 update device info interval from Petkit server(s).
enable_manualLock bool no false true/false if enabled, a switch will show in homekit to control the manual lock of the feeder.
enable_lightMode bool no false true/false if enabled, a switch will show in homekit to control the lighe mode of the feeder.
reverse_foodStorage
_indicator
bool no false true/false normally, the occupancy will show an alert in homekit when there is enough food in the feeder, in which situation may not so recognizable, so you can reverse the status bu set this value to true, so when there is not much food, it can show an alert in homekit.
ignore_battery_when
_charging
bool no false true/false Ignore battery low level alerm when device connected to a power source.
And battery function is disabled when using a Petkit Feeder Element device.
fast_response bool no false true/false if set to true, then when received a Homekit set request, return immediately, ignore the result.
this is useful when your homebridge or Petkit device has a bad internet connection.

headers field

field name type required default range description
X-Session string yes --- --- Tell server who you are. This changes everytime you login Petkit app.
X-Api-Version string prefer '7.18.1' --- For China mainland users, this field is not necessary, but for users outside China mainland, this field is optional, if not provided, then the default value will be used. but we recommand to fufill this field.
X-Timezone int no 8 -12 to 12 Your local timezone offset, UTC time. If autoDeviceInfo is set to true, it will overwrited with the timezone of your device, which is set in your Petkit app.

we recomand you entered all the headers you captured. If you don't want to do so, please ensure header "X-Session" is correctly entered.

example of config.json file

"platforms": [{
  "log_level": 2,
  "devices": [
      {
        "headers": [
          {
            "key": "X-Session",
            "value": "xxxxxx"
          }
        ],
        "location": "cn",
        "model": "FeederMini",
        "enable_http_retry": false,
        "http_retry_count": 3,
        "DropMeal_name": "DropMeal",
        "MealAmount_name": "MealAmount",
        "FoodStorage_name": "FoodStorage",
        "DesiccantLevel_name": "DesiccantLevel",
        "ManualLock_name": "ManualLock",
        "LightMode_name": "LightMode",
        "Battery_name": "Battery",
        "enable_polling": true,
        "polling_interval": 60,
        "enable_desiccant": true,
        "alert_desiccant_threshold": 7,
        "enable_autoreset_desiccant": true,
        "reset_desiccant_threshold": 5,
        "enable_manualLock": true,
        "enable_lightMode": true,
        "reverse_foodStorage_indicator": true,
        "fast_response": true
      }
  ],
  "platform": "petkit_feeder_mini"
}]