2.1.4 • Published 3 years ago

homebridge-petkit-feeder-mini v2.1.4

Weekly downloads
75
License
Apache-2.0
Repository
github
Last release
3 years ago

Important note!!!

  • if you are aready a plugin user, and have trouble when upgrade to v2.x.x from v1.x.x, please first consider update and double check your config.json.

    you can find out how to update your config.json here.

  • if you are a Petkit Feeder Element user and want to use this plugin, plseas install v2.x.x or above, v1.x.x is not compatible with Petkit Feeder Element.

homebridge-petkit-feeder-mini

1) Description

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

features

  • uses a fan speed to control the meal amount;
  • uses a switch to commit the drop;
  • uses a switch to control the Petkit feeder mini light mode;
  • uses a switch to control the Petkit feeder mini manual lock;
  • uses a occupancy to indicate food storage status;
  • uses a filter maintenance to indicate desiccant status(include auto reset desiccant left days, this may not show in homekit);
  • uses a battery service to indicate device power status(only for Petkit Feeder Mini, include power level, charging status and low battery alert in Homekit)
  • can fetch device info from Petkit server and shows in Homekit.

limitations

  • enable/disable meal plan for the day(may be in the next major version, currently no plan to do it).
  • currently this plugin for homebridge just tested with Petkit-feeder-mini (official store link), and this plugin currently only tested and works in Asia(include China mainland) and North America, other area may need more work.
  • to continuously use this plugin you should login Petkit app and never logoff, this plugin uses session id from the app and it will change every time you logoff and relogin.
  • because version 2.x.x is developed on a dynamic platform plugin, and not implement auto remove deleted device(s), so you may need to delete cached accessories manually.
  • ......

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.

  • for China mainland users, download “小佩宠物”
  • for those Asia users outside China mainland, you should download "PetKit(International)"
  • for users not from Asia, like America, Europe, etc. you also should download "PetKit(International)", but the API url address may not the same, this plugin may or may not works with you, if you are experienced in network, you could use "Quantumult X" to capture app network records, submit the api address to me or just create a PR or just modify this plugin for your own.

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.

  • X-Session: this value will change every time you login you Petkit app, so do not logoff your Petkit app unless necessary.
  • deviceId: this value indicate which device you wanna to control. If you just have one Petkit feeder mini, you can ignore this value.

here is a example of Quantumult X capture data page:

3) Configure

config.json field

field nametyperequireddefaultrangedescription
platformstringyes'petkit_feeder_mini''petkit_feeder_mini'Must be 'petkit_feeder_mini' in order to use this plugin.
log_levelintno21,2,3,4,9one of these values:- 1: Debug- 2: Info- 3: Warn- 4: Error- 9: None
devicesobjectyes------Petkit Feeder device config.See more detail info at decices field below.

devices field

field nametyperequireddefaultrangedescription
locationstringyes'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.
modelstringno'FeederMini''FeederMini','Feeder'Petkit Feeder Mini: 'FeederMini'Petkit Feeder Element: 'Feeder'
deviceIdstringtbd------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.
headersarrayyes------http request headers.See more detail info at headers field below.
enable_http_retrynofalsetrue/falseEnable or disable HTTP retry function, useful when your device or homebridge has a bad internet connection.
http_retry_countintno31 to 5max retry times when a http request failed.
DropMeal_namestringno'DropMeal'---name of DropMeal switch in HomeKit.
MealAmount_namestringno'MealAmount'---name of MealAmount fan speed in HomeKit.
FoodStorage_namestringno'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_namestringno'DesiccantLevel'---name of DesiccantLevel indicator in HomeKit.
ManualLock_namestringno'ManualLock'---name of ManualLock switch in HomeKit.
LightMode_namestringno'LightMode'---name of LightMode switch in HomeKit.
Battery_namestringno'Battery'---name of Battery indicator in HomeKit.
enable_pollingboolnotruetrue/falseAutomatically update device info from Petkit server.
polling_intervalintno6060 to 3600update device info interval from Petkit server(s).
enable_manualLockboolnofalsetrue/falseif enabled, a switch will show in homekit to control the manual lock of the feeder.
enable_lightModeboolnofalsetrue/falseif enabled, a switch will show in homekit to control the lighe mode of the feeder.
reverse_foodStorage_indicatorboolnofalsetrue/falsenormally, 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_chargingboolnofalsetrue/falseIgnore battery low level alerm when device connected to a power source.And battery function is disabled when using a Petkit Feeder Element device.
fast_responseboolnofalsetrue/falseif 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 nametyperequireddefaultrangedescription
X-Sessionstringyes------Tell server who you are. This changes everytime you login Petkit app.
X-Api-Versionstringprefer'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-Timezoneintno8-12 to 12Your 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"
}]

4) How to contribute

everyone is welcome to contribute to this plugin. PR/issue/debug all are welcome.

or you can send me an e-mail: elfive@elfive.cn

5) Buy me a coffee

if you think my work helps you, and wanna thank me, please consider buy me a coffee: https://paypal.me/iamelfive

2.1.2

3 years ago

2.1.1

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.10.5

3 years ago

1.10.4

3 years ago

1.10.3

3 years ago

1.10.2

3 years ago

1.10.1

3 years ago

1.10.0

3 years ago

1.9.8

3 years ago

1.9.7

3 years ago

1.9.6

3 years ago

1.9.5

3 years ago

1.9.4

3 years ago

1.9.2

3 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.8.8

4 years ago

1.8.7

4 years ago

1.8.6

4 years ago

1.8.5

4 years ago

1.8.4

4 years ago

1.8.3

4 years ago

1.8.2

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.7.2

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.1

4 years ago

1.4.2

4 years ago

1.5.0

4 years ago

1.4.1

4 years ago

1.3.2

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago