rsnodgrass / pyadtpulse

Python interface for ADT Pulse security systems
Other
15 stars 5 forks source link

RuntimeError: Cannot login asynchronously with a synchronous session - Python 3.11 #37

Closed ryanbuckner closed 6 months ago

ryanbuckner commented 8 months ago

I have simple code that logs into ADT and disarms my alarm. It was working fine until I upgraded to Python 3.11 from 3.10. Now the following gives an error :

def disarm_alarm():
    adt = PyADTPulse(
        username,
        password,
        fingerprint
    )

    time.sleep(5)   

    for site in adt.sites:
        site.status
        site.disarm()

disarm_alarm()

here's the error:

adtpulse-arm.py, line 36, at top level
     File '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyadtpulse/__init__.py', line 63, in __init__
       self.login()
     File '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyadtpulse/__init__.py', line 164, in login
       raise self._login_exception
     File '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyadtpulse/__init__.py', line 116, in _sync_loop
       await self.async_login()
     File '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyadtpulse/__init__.py', line 236, in async_login
       self._pulse_connection_properties.check_async(
     File '/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pyadtpulse/pulse_connection_properties.py', line 153, in check_async
       raise RuntimeError(message)
RuntimeError: Cannot login asynchronously with a synchronous session
rlippmann commented 6 months ago

synchronous support is being deprecated. it's kind of a hack running uvloop in separate thread for compatibility.

perhaps you should update uvloop?