Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to pair with "Radio RA3" #171

Open
work-krishna opened this issue Aug 7, 2024 · 1 comment
Open

Unable to pair with "Radio RA3" #171

work-krishna opened this issue Aug 7, 2024 · 1 comment

Comments

@work-krishna
Copy link

Need help in pairing "Radio RA3"

Pairing fails at certificates verfication

here is my code snap:

import asyncio
from src.pylutron_caseta.pairing import *


def ready():
    print("ready")


async def routine():
    data = await async_pair("192.168.1.172", ready)
    print("data: ", data)


async def abcd():
    L = await asyncio.gather(
        routine(),
    )


asyncio.run(abcd())

response I'm getting is:

2024-08-07 12:10:27,174 - [pairing.py:180]: Generating a new private key...

2024-08-07 12:10:27,614 - [pairing.py:138]: Press the small black button on the back of the Caseta bridge...
ready

2024-08-07 12:10:33,287 - [pairing.py:64]: received: b'{"Header":{"StatusCode":"200 OK","ContentType":"status;plurality=single"},"Body":{"Status":{"Permissions":["Public","PhysicalAccess"]}}}\r\n'

2024-08-07 12:10:33,288 - [pairing.py:150]: Getting my certificate...

2024-08-07 12:10:33,288 - [pairing.py:71]: sent: b'{"Header": {"RequestType": "Execute", "Url": "/pair", "ClientTag": "get-cert"}, "Body": {"CommandType": "CSR", "Parameters": {"CSR": "-----BEGIN CERTIFICATE REQUEST-----\\nMIICXzCCAUcCAQAwGjEYMBYGA1UEAwwPcHlsdXRyb25fY2FzZXRhMIIBIjANBgkq\\nhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw70cOMqrtplWZjCYwAVe8xQ7iWYUCpOC\\nYeZvwOxyTMOU+ZJ1olLRMy18JAvMdCaTHvLDDhQSaLDew6Lf864Fxl3X2GgmnTn3\\nP2uJap1QrdUNUsy8DG43gNophDQ/3Kp6v6uHZEVIM/JA11HeMZ+aou/T8frDxWgk\\n+ZlMkxcMYVU7+Ilc30A4rULkFjIHwGzanIdB4RqnY98Pr0py3Ie7ivH9aA3659Nf\\nezTGq4ZRLQ5MU52TVj7ylVH36yQSJ6hrQHs0GxrWUcx8GvFYfjB70liZRN/+2fWm\\nya9HJBZn9lNsmTL+LsxFnTF5e5P1P1fcccoHYz1/GGxKdNYlGcRbBQIDAQABoAAw\\nDQYJKoZIhvcNAQELBQADggEBAA6IgObha4GnOEakO/NYdhkvP+ci0P+xXeS2gnmo\\n/KyHJI56vKVAdiQbqdTMc/P3+Lfvo1zk6okHU7XLqHZeQylcpfnkn1JW+8Exuc9P\\n9emhbR7s+H325WM9pM7HhOLJPsYTZ4P2UzTNClGoa4sQbzKUzK7mNdGWXFJ93Vtn\\nGDxreMjAcEY7gH/36gw9VU5gmVA/+IjQlCjMO2uMgWixWtetjUuODfwxns5Hh3ZT\\nWuWp4X6HoXkAZTLmDvXliaW1dCmR2gYcWyvOUOE0OyIq3oZyRzovjilOeN5IWg7o\\nAhNPR6mg6pX3Dcvb8A+7L7JWnmlOSj96CP61Vj9bDCBeK0c=\\n-----END CERTIFICATE REQUEST-----\\n", "DisplayName": "pylutron_caseta", "DeviceUID": "000000000000", "Role": "Admin"}}}\r\n'

2024-08-07 12:10:33,546 - [pairing.py:64]: received: b'{"Header":{"StatusCode":"200 OK","ClientTag":"get-cert","ContentType":"signing-result;plurality=single"},"Body":{"SigningResult":{"Certificate":"-----BEGIN CERTIFICATE-----\\nMIICzDCCAnKgAwIBAgIBATAKBggqhkjOPQQDAjB4MQswCQYDVQQGEwJVUzEVMBMG\\nA1UECBMMUGVubnN5bHZhbmlhMRQwEgYDVQQHEwtDb29wZXJzYnVyZzElMCMGA1UE\\nChMcTHV0cm9uIEVsZWN0cm9uaWNzIENvLiwgSW5jLjEVMBMGA1UEAxMMOTAwNkYy\\nNUUxMTIzMCAXDTE5MDMwMTAwMDAwMFoYDzIxMTkwMjA1MDAwMDAwWjBZMRgwFgYD\\nVQQDDA9weWx1dHJvbl9jYXNldGExHDAaBgorBgEEAYK5CQECE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YnVyZzElMCMGA1UEChMcTHV0cm9uIEVsZWN0cm9uaWNzIENvLiwgSW5jLjEVMBMG\\nA1UEAxMMOTAwNkYyNUUxMTIzMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEjQsd\\nCi2LBAwTNaQoJ2jhh4W48DXZOIIXRX8Qnhbz0LhzB9Uxju1B6hjHwM4yC90W3EdU\\nFqEYXgr54JbDeKVm6KMjMCEwDgYDVR0PAQH/BAQDAgG+MA8GA1UdEwEB/wQFMAMB\\nAf8wCgYIKoZIzj0EAwIDSAAwRQIgbL0E+OhUSLsYE5C3GCENG7s5Vr1iLQNtWch1\\nlHmmo4oCIQDW/pem2lWEvF9nr6zctbxlgreJxk9z08qUwP9DrXkQIQ==\\n-----END CERTIFICATE-----\\n"}}}\r\n'

2024-08-07 12:10:33,547 - [pairing.py:175]: Got certificates

2024-08-07 12:10:33,784 - [pairing.py:71]: sent: b'{"CommuniqueType": "ReadRequest", "Header": {"Url": "/server/1/status/ping"}}\r\n'
Traceback (most recent call last):
  File "/media/nds/projects/nds/hypnotik/pylutron-caseta/main.py", line 20, in <module>
    asyncio.run(abcd())
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/media/nds/projects/nds/hypnotik/pylutron-caseta/main.py", line 15, in abcd
    L = await asyncio.gather(
        ^^^^^^^^^^^^^^^^^^^^^
  File "/media/nds/projects/nds/hypnotik/pylutron-caseta/main.py", line 10, in routine
    data = await async_pair("192.168.1.172", ready)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/nds/projects/nds/hypnotik/pylutron-caseta/src/pylutron_caseta/pairing.py", line 106, in async_pair
    leap_response = await _async_verify_certificate(server_addr, signed_ssl_context)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/media/nds/projects/nds/hypnotik/pylutron-caseta/src/pylutron_caseta/pairing.py", line 222, in _async_verify_certificate
    if leap_response.get("CommuniqueType") == "ReadResponse":
       ^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'
@wdfrench13
Copy link

Hey @work-krishna, were you able to resolve or figure out a workaround for this? I'm having the same issue and can't seem to sort it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants