mjg59 / python-broadlink

Python module for controlling Broadlink RM2/3 (Pro) remote controls, A1 sensor platforms and SP2/3 smartplugs
MIT License
1.35k stars 477 forks source link

Luceco Castra (Hangzhou Broadlink) discoverable, but gives Authentication Error #719

Open rbubley opened 1 year ago

rbubley commented 1 year ago

python-broadink can discover a Luceco Castra smart light with PIR (reporting devtype=25722, name='ACpir'), but attempting to auth() the device throws an exception:

>>> import broadlink
>>> dev=broadlink.hello('192.168.XXX.XXX')
>>> dev
broadlink.device.Device(('192.168.XXX.XXX', 80), mac=b'\xXX\xXX\xXX\xXX\xXX', devtype=25722, timeout=10, name='ACpir', model='', manufacturer='', is_locked=True)
>>> dev.auth()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/russ/.local/lib/python3.10/site-packages/broadlink/device.py", line 185, in auth
    e.check_error(response[0x22:0x24])
  File "/home/russ/.local/lib/python3.10/site-packages/broadlink/exceptions.py", line 152, in check_error
    raise exception(error_code)
broadlink.exceptions.AuthenticationError: [Errno -1] Authentication failed
zhou9110 commented 1 year ago

I found the solution in here, it is because is_locked=True.

In my case I am using RM4 pro, I need to open the BroadLink App, select the device -> click "..." in the top bar -> click "Property", then find the "Lock device" setting and turn it off. Then calling device.auth() just works for me.

Reference: https://github.com/mjg59/python-broadlink/issues/674#issuecomment-1134248621

felipediel commented 2 months ago

Let's add it. Does it work with the lb1 class?