lwestenberg / bold_smart_lock

This package implements the Bold Smart Lock API to authenticate and unlock a Bold smart lock. Usage of this API requires a Bold Connect.
MIT License
11 stars 3 forks source link

Some Extra help #7

Closed FutureCow closed 2 years ago

FutureCow commented 2 years ago

Thanks for making this API, I had contact with Bold for a RESTfull API about 2 years ago they said it's coming, but i'm still waiting...

So now i will try your Python package to integrate this into my domotica system. But i'm not that familiar with python to understand the things that needs to be done. I've installed the package and trying to get it working. With your "Usage" example for the README, I simply copy and paste this into a "test.py" and run.(comment out all the other code #) After a run I received an email from Bold with a code but also this error:

Traceback (most recent call last):
  File "/home/frans/domotica/scripts/bold_smart_lock/tests/test.py", line 34, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/frans/domotica/scripts/bold_smart_lock/tests/test.py", line 11, in main
    request_validation_id_response = await bold.request_validation_id("mymail@gmail.com");
  File "/home/frans/.local/lib/python3.10/site-packages/bold_smart_lock/bold_smart_lock.py", line 67, in request_validation_id
    return await self._auth.request_validation_id(email, phone)
  File "/home/frans/.local/lib/python3.10/site-packages/bold_smart_lock/auth.py", line 114, in request_validation_id
    raise exception
  File "/home/frans/.local/lib/python3.10/site-packages/bold_smart_lock/auth.py", line 107, in request_validation_id
    elif response_json["status"] == 400:
KeyError: 'status'

If I put the received code inside my test.py (what password and token do I need to enter?) I received this error:

Traceback (most recent call last):
  File "/home/frans/domotica/scripts/bold_smart_lock/tests/test.py", line 34, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/home/frans/domotica/scripts/bold_smart_lock/tests/test.py", line 15, in main
    authenticate_response = await bold.authenticate("mymail@gmail.com", "password", "codefrommail", "00000000-0000-0000-0000-000000000000");
  File "/home/frans/.local/lib/python3.10/site-packages/bold_smart_lock/bold_smart_lock.py", line 27, in authenticate
    return await self._auth.authenticate(
  File "/home/frans/.local/lib/python3.10/site-packages/bold_smart_lock/auth.py", line 28, in authenticate
    verified = await self.__verify_validation_id(verification_code, validation_id)
  File "/home/frans/.local/lib/python3.10/site-packages/bold_smart_lock/auth.py", line 152, in __verify_validation_id
    raise exception
  File "/home/frans/.local/lib/python3.10/site-packages/bold_smart_lock/auth.py", line 146, in __verify_validation_id
    raise InvalidValidationId
bold_smart_lock.exceptions.InvalidValidationId

The InvalidValidationId error is about the codefrommail? or another error? Can you help me a bit further?

dreasvandonselaar commented 2 years ago

I'm trying to get this to work as well (as n00b). I am not encountering your issue though. When I run the usage script, the first line of output shows an "ID" which I believe is the "validation ID" variable returned by the Bold API based on your email address. This should then correspond to the "code ID" as received in the email. The password would be the password you set when using the Bold official app.

lwestenberg commented 2 years ago

The library changed recently and Bold now supports oAuth2 so all the validation stuff is no longer applicable. I'm currently using this library in a Home Assistant integration that will be finished soon.

FutureCow commented 1 year ago

Do you have a timeline when a PR to HA core will be pushed? Ik glad to help and test if necessary! (Im using the new API with some HA helpers at the moment)

lwestenberg commented 1 year ago

The only thing holding us back now from releasing is that we have to make Python tests for the HA component. Hopefully I have some time soon but if there is anybody who has time and can help, let me know.

cris1 commented 1 year ago

Hi, any update ? Would be awesome to have something to work with. :)