Metadata-Version: 2.1 Name: pyElectra Version: 1.2.4 Summary: Electra Smart Python Integration. Author-email: Jafar Atili Project-URL: homepage, https://pypi.org/project/pyelectra/ Project-URL: repository, https://github.com/jafar-atili/pyelectra/ Keywords: home,automation,Electra,smart,Electra Smart,Air Condition Classifier: Intended Audience :: Developers Classifier: Operating System :: OS Independent Classifier: Topic :: Home Automation Classifier: Topic :: Software Development :: Libraries :: Python Modules Classifier: Typing :: Typed Classifier: License :: OSI Approved :: Apache Software License Requires-Python: >=3.9 Description-Content-Type: text/markdown License-File: LICENSE Requires-Dist: aiohttp # pyElectra ![PyPI](https://img.shields.io/pypi/v/pyelectra?label=pypi%20package) ![PyPI - Downloads](https://img.shields.io/pypi/dm/pyelectra) Python library to control Electra Smart Air Condtioiner devices Usage: ```python import asyncio import aiohttp from electrasmart import * async def main(): session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False), timeout=aiohttp.ClientTimeout(total=10)) api = ElectraAPI(session) # User phone number phone_number = "0521234567" # Generate token imei = generate_imei() try: resp = await api.generate_new_token(phone_number=phone_number, imei=imei) except ElectraApiError as e: # handle error pass otp = input("Enter the OTP you recieved via SMS") # more error handling if resp[electra.ATTR_STATUS] == electra.STATUS_SUCCESS: if resp[electra.ATTR_DATA][electra.ATTR_RES] != electra.STATUS_SUCCESS: # Wrong phone number or unregistered user sys.exit(1) resp = await api.validate_one_time_password(otp=otp, imei=imei, phone_number=phone_number) if resp[electra.ATTR_DATA][electra.ATTR_RES] == electra.STATUS_SUCCESS: token = resp[electra.ATTR_DATA][electra.ATTR_TOKEN] else: # wrong OTP sys.exit(1) ac_devices = api.get_devices() for ac in ac_devices: assert(ac, ElectraAirConditioner) if ac.name == "Saloon AC": ac.turn_on() ac.set_mode(OPER_MODE_COOL) ac.set_temperature(17) ac.set_fan_speed(OPER_FAN_SPEED_HIGH) ac.set_vertical_swing(OPER_ON) api.set_state(ac) # This will send the conf to the AC loop = asyncio.get_event_loop() loop.run_until_complete(main()) ```