Package: petkitaio
PetKitAIOAsynchronous Python library for PetKit's API.This is PetKit's undocumented API. With that said, future changes made by PetKit may break this library. The API endpoint used is determined based on the region your account is locked to. See theRegionssection for available region values.Currently Supported Devices:FeedersFresh ElementD3 (Fresh Element Infinity)D4 (Fresh Element Solo)D4s (Fresh Element Gemini)Mini FeederLitter BoxesT3 (Pura X)T4 (Pura MAX) with/without Pura AirPurifiersK2 (Air Magicube)Water FountainsW5 (Eversweet Solo 2)W5 (Eversweet 3 Pro)W5 (Eversweet 5 Mini)ImportantPetKit accounts can only be logged in on one device at a time. Using this library will result in getting signed out of the mobile app. If you want to continue using the mobile app, use the family share feature to share devices to a secondary account.Note: The secondary account needs to be used with the mobile app while the primary account is used with this library as this library will not fetch devices that are part of family sharing.This package depends onaiohttpandtzlocal.Python 3.7or greater is required.UsageRegionsSee regions available(click to expand)RegionAfghanistanAland IslandsAlbaniaAlgeriaAmerican SamoaAndorraAngolaAnguillaAntarcticaAntigua and BarbudaArgentinaArmeniaArubaAustraliaAustriaAzerbaijanBahamasBahrainBangladeshBarbadosBelarusBelgiumBelizeBeninBermudaBhutanBoliviaBosnia and HerzegovinaBotswanaBouvet IslandBrazilBritish Indian Ocean TerritoryBrunei DarussalamBulgariaBurkina FasoBurundiCambodiaCameroonCanadaCape VerdeCayman IslandsCentral African RepublicChadChileChinaChristmas IslandCocos (Keeling) IslandsColombiaComorosCongoCongo (the Democratic Republic of the Congo)Cook IslandsCosta RicaCôte d'IvoireCroatiaCubaCyprusCzech RepublicDenmarkDjiboutiDominicaDominican RepublicEcuadorEgyptEl SalvadorEquatorial GuineaEritreaEstoniaEthiopiaFalkland Islands [Malvinas]Faroe IslandsFijiFinlandFranceFrench GuianaFrench PolynesiaFrench Southern TerritoriesGabonGambiaGeorgiaGermanyGhanaGibraltarGreeceGreenlandGrenadaGuadeloupeGuamGuatemalaGuernseyGuineaGuinea-BissauGuyanaHaitiHeard Island and McDonald IslandsHoly See [Vatican City State]HondurasHong KongHungaryIcelandIndiaIndonesiaIran (the Islamic Republic of Iran)IraqIrelandIsle of ManIsraelItalyJamaicaJapanJerseyJordanKazakhstanKenyaKiribatiKorea (the Democratic People's Republic of Korea)Korea (the Republic of Korea)KuwaitKyrgyzstanLao People's Democratic RepublicLatviaLebanonLesothoLiberiaLibyan Arab JamahiriyaLiechtensteinLithuaniaLuxembourgMacaoMacedonia (the former Yugoslav Republic of Macedonia)MadagascarMalawiMalaysiaMaldivesMaliMaltaMarshall IslandsMartiniqueMauritaniaMauritiusMayotteMexicoMicronesia (the Federated States of Micronesia)Moldova (the Republic of Moldova)MonacoMongoliaMontenegroMontserratMoroccoMozambiqueMyanmarNamibiaNauruNepalNetherlandsNetherlands AntillesNew CaledoniaNew ZealandNicaraguaNigerNigeriaNiueNorfolk IslandNorthern Mariana IslandsNorwayOmanPakistanPalauPalestinian TerritoryPanamaPapua New GuineaParaguayPeruPhilippinesPitcairnPolandPortugalPuerto RicoQatarRéunionRomaniaRussian FederationRwandaSaint HelenaSaint Kitts and NevisSaint LuciaSaint Pierre and MiquelonSaint Vincent and the GrenadinesSamoaSan MarinoSao Tome and PrincipeSaudi ArabiaSenegalSerbiaSeychellesSierra LeoneSingaporeSlovakiaSloveniaSolomon IslandsSomaliaSouth AfricaSouth Georgia and the South Sandwich IslandsSpainSri LankaSudanSurinameSvalbard and Jan MayenSwazilandSwedenSwitzerlandSyrian Arab RepublicTaiwan (Province of China)TajikistanTanzania,United Republic ofThailandTimor-LesteTogoTokelauTongaTrinidad and TobagoTunisiaTurkeyTurkmenistanTurks and Caicos IslandsTuvaluUgandaUkraineUnited Arab EmiratesUnited KingdomUnited StatesUnited States Minor Outlying IslandsUruguayUzbekistanVanuatuVenezuelaViet NamVirgin Islands (British)Virgin Islands (U.S.)Wallis and FutunaWestern SaharaYemenZambiaZimbabweCreating ClientimportasynciofrompetkitaioimportPetKitClientfromaiohttpimportClientSessionasyncdefmain():asyncwithClientSession()assession:# Create a client using PetKit account email, password, and regionclient=PetKitClient('email','password',session,'United States')###################################################################################ExampleswithintheexamplessectionutilizethePetKitClientinstancecreatedabove###################################################################################loop=asyncio.get_event_loop()loop.run_until_complete(main())ExamplesRetrieving all PetKit devices on account# See model.py for details regarding Data Classes createddevices=awaitclient.get_petkit_data()Manual Feeding# See model.py for details regarding "Feeder" class# Reusing retrieved devices from above. Note: A valid amount (in grams) will depend on the capabilities of the feeder.awaitclient.manual_feeding(feeder=devices.feeders[feederid],amount=10)Change Feeder Setting# See constants.py FeederSetting class for available settings# Additional import needed:frompetkitaio.constantsimportFeederSetting# Enabling child lock on a D4 feeder. Note: Mini Feeders use a different setting.# Reusing retrieved devices from above.awaitclient.update_feeder_settings(feeder=devices.feeders[feederid],setting=FeederSetting.CHILD_LOCK,value=1)Reset Feeder Desiccant# Reusing retrieved devices from above.awaitclient.reset_feeder_desiccant(feeder=devices.feeders[feederid])Control Water Fountain via BLE Relay# A valid relay (set up through the PetKit app) is required in order to send commands to the Eversweet 3 Pro# See constants.py W5Command class for available commands# Additional import needed:frompetkitaio.constantsimportW5Command# Set Water Fountain to Smart Mode. Reusing retrieved devices from above.awaitclient.control_water_fountain(water_fountain=devices.water_fountains[water_fountain_id],command=W5Command.SMART)