Package: sharkiqpy
sharkiqpyUnofficial SDK for Shark IQ robot vacuums, designed primarily to support an integration forHome Assistant.InstallationUse the package managerpipto install foobar.pipinstallsharkiqpyUsageSimple Operationfromsharkiqpyimportget_ayla_api,OperatingModes,Properties,PowerModesUSERNAME='me@email.com'PASSWORD='$7r0nkP@s$w0rD'ayla_api=get_ayla_api(USERNAME,PASSWORD)ayla_api.sign_in()shark_vacs=ayla_api.get_devices()shark=shark_vacs[0]shark.update()shark.set_operating_mode(OperatingModes.START)shark.return_to_base()Async operationimportasynciofromsharkiqpyimportget_ayla_api,OperatingModes,SharkIqVacuumUSERNAME='me@email.com'PASSWORD='$7r0nkP@s$w0rD'asyncdefmain(ayla_api)->SharkIqVacuum:awaitayla_api.async_sign_in()shark_vacs=awaitayla_api.async_get_devices()shark=shark_vacs[0]awaitshark.async_update()awaitshark.async_find_device()awaitshark.async_set_operating_mode(OperatingModes.START)returnsharkayla_api=get_ayla_api(USERNAME,PASSWORD)shark=asyncio.run(main(ayla_api))Documentationget_ayla_api(username, password, websession=None)Returns andAylaApiobject to interact with the Ayla Networks Device API conrolling the Shark IQ robot, with theapp_idandapp_secretparameters set for the Shark IQ robot.class AylaAPI(username, password, app_id, app_secret, websession)Class for interacting with the Ayla Networks Device API underlying the Shark IQ controls.username: strpassword: strapp_id: strapp_secret: strwebsession: Optional[aiohttp.ClientSession] = NoneOptionalaiohttp.ClientSessionto use for async calls.  If
one is not provided, a newaiohttp.ClientSessionwill be created at the first async call.Methodsget_devices()/async_get_devices()Get a list ofSharkIqVacuums for every device found inlist_devices()list_devices()/async_list_devices()Get a list of known device descriptiondictsrefesh_auth()/async_refesh_auth()Refresh the authentication tokenrequest(method, url, headers = None, auto_refresh = True, **kwargs)/async_request(...)Submit an HTTP request to
the Ayla networks API with the auth headermethod: strAn HTTP method, usually'get'or'post'url: strheaders: Optional[Dict] = NoneOptionaldictof HTTP headers besides the auth header, which is included
automaticallyauto_refresh: bool = TrueIfTrue, automatically callrefesh_auth()/async_refesh_auth()if the auth token
is near expiration**kwargsPassed on torequests.requestoraiohttp.ClientSession.requestsign_in()/async_sign_in()Authenticatesign_out()/async_sign_out()Sign outclass SharkIqRobot(ayla_api, device_dct)Primary API for interacting with Shark IQ vacuumsayla_api: AylaApiAnAylaApiwith an authenticated connectiondevice_dct: DictAdictdescribing the device, usually obtained fromAylaApi.list_devices()Methodsfind_device()/async_find_device()Cause the device to emit an annoying chirpget_file_property_url(property_name)/async_get_file_property_url(property_name)Get the URL for the latest version of a'file'-type propertyproperty_name: Union[str, PropertyName]Either astrorPropertyNamesvalue for the desired propertyget_file_property(property_name)/async_get_file_property(property_name)Get the contents of the latest version of a'file'-type propertyproperty_name: Union[str, PropertyName]Either astrorPropertyNamesvalue for the desired propertyget_metadata()/async_get_metadata()Update some device metadata (vac_model_numberandvac_serial_number)set_operating_mode(mode)/async_set_operating_mode(mode)Set the operating mode.  This is just a thin wrapper
aroundset_property_value/async_set_property_valueprovided for convenience.mode: OperatingModes Mode to set, e.g.,OperatingModes.STARTto start the vacuumget_property_value(property_name)/async_get_property_value(property_name)Returns the value ofproperty_name, cast to the appropriate typeproperty_name: Union[str, PropertyName]Either astrorPropertyNamesvalue for the desired propertyset_property_value(property_name, property_value)/async_set_property_value(property_name, property_value)Set the value ofproperty_nameproperty_name: Union[str, PropertyName]Either astrorPropertyNamevalue for the desired propertyproperty_value: AnyNew value.  Type checking is currently left to the remote API.update()/async_update(property_list=None)Fetch the updated robot state from the remote apiproperty_list: Optional[Interable[str]]An optional iterable of property names.  If specified, only those
properties will be updated.Propertiesayla_apiThe underlyingAylaApiobjecterror_codeError code, if any.NB: these can be very stale as they are not immediately reset in the API when the
error is cleared.error_textEnglish description of theerror_code.  The same caveat applies.nameThe device name as it appears in the SharkClean appoem_model_numberA "rough" model number that does not distinguish, for example, between robots with and without
a self-emptying baseproperties_fullA dictionary representing all known device properties and their metadata (typeDict[str, Dict])property_valuesA convenience accessor intoproperties_fullmapping property names to valuesserial_numberThe unique device serial number used with the Ayla Networks API (NB: this name may change)vac_model_numberThe precise model numbervac_serial_numberThe serial number printed on the deviceEnumsOperatingModesOperation modes to control the vacuum (START,STOP,PAUSE,RETURN)PowerModesVacuum power mode (ECO,NORMAL,MAX)PropertiesProperties to use withget_property_value/set_property_valueTODOs:Add support for mapping and room selectionOnce we have mapping, it may be possible to use the RSSI property combined with an increased update frequency
to generate a wifi strength heatmap.  Kind of orthogonal to the main purpose, but I really want to do this.LicenseMIT