scrool / xled

🎄Unofficial control for Twinkly - Smart Decoration LED lights.
MIT License
204 stars 46 forks source link

Validation error #79

Closed majuss closed 2 years ago

majuss commented 3 years ago

Summary

I'am running the latest Raspberry Pi OS and a fresh Python3.7 venv. When I try xled on I get this validation error:

xled on
Looking for any device...
Working on device: b'Twinkly_EBEA99'
ERROR:xled.auth:challenge-response invalid. Received challenge-response: '4b8af...' but '0fdb2...' was expected.
Traceback (most recent call last):
  File "/home/pi/xledvenv/bin/xled", line 10, in <module>
    sys.exit(main())
  File "/home/pi/xledvenv/lib/python3.7/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/click/core.py", line 1668, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/xledvenv/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/xled/cli.py", line 107, in turn_on
    control_interface.turn_on()
  File "/home/pi/xledvenv/lib/python3.7/site-packages/xled/control.py", line 554, in turn_on
    return self.set_mode("movie")
  File "/home/pi/xledvenv/lib/python3.7/site-packages/xled/control.py", line 322, in set_mode
    response = self.session.post(url, json=json_payload)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/xled/auth.py", line 329, in request
    headers = self.add_authorization(headers)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/xled/auth.py", line 354, in add_authorization
    self.fetch_token()
  File "/home/pi/xledvenv/lib/python3.7/site-packages/xled/auth.py", line 272, in fetch_token
    self.client.challenge_response_valid(self.hw_address)
  File "/home/pi/xledvenv/lib/python3.7/site-packages/xled/auth.py", line 403, in challenge_response_valid
    raise ValidationError()
xled.exceptions.ValidationError

Affected XLED components

XLED version

Name: xled
Version: 0.6.1
Summary: Python library and command line interface to control Twinkly - Smart Decoration LED lights for Christmas.
Home-page: https://github.com/scrool/xled
Author: Pavol Babinčák
Author-email: scroolik@gmail.com
License: MIT license
Location: /home/pi/xledvenv/lib/python3.7/site-packages
Requires: Click, arpreq, tornado, netaddr, pyzmq, cryptography, click-log, requests, requests-toolbelt
Required-by:

Twinkly device details

TWF020STP 192.168.2.122

Device information

{
    "product_name": "Twinkly",
    "hardware_version": "100",
    "bytes_per_led": 3,
    "hw_id": "ebea98",
    "flash_size": 64,
    "led_type": 14,
    "product_code": "TWF020STP",
    "fw_family": "F",
    "device_name": "Twinkly_EBEA99",
    "uptime": "232837887",
    "mac": "f0...:eb:ea:99",
    "uuid": "A5804158-...",
    "max_supported_led": 510,
    "number_of_led": 20,
    "led_profile": "RGB",
    "frame_rate": 81,
    "measured_frame_rate": 90.91,
    "movie_capacity": 992,
    "wire_type": 1,
    "copyright": "LEDWORKS 2021",
    "code": 1000
}

Firmware version

{
    "version": "2.7.1",
    "code": 1000
}

Operating system

Raspberry Pi OS Linux pi4 5.10.52-v7l+ #1440 SMP Tue Jul 27 09:55:21 BST 2021 armv7l GNU/Linux

Python version

Python 3.7.3

Anders-Holst commented 3 years ago

I may be confused about this of course, but I had the same problem and discovered that it disappeared when I used the code directly checked out from he Git repo, rather than the code installed with pip. So if your problem is the same as mine it appears to be fixed but not propagated to the distributed version yet.

scrool commented 2 years ago

I believe the issue was what @Anders-Holst wrote. @majuss please try code from devel git branch. If you happen to still see this issue, feel free to reopen this with more details added.