user error? or library?
Hi- so happy this library exists, would love to get it working!
somehow i'm caught up at even the simplest sweep for devices on my network (LifxLAN().get_lights())
i'm on a mac running 14.3.1 w/ python v 3.12.4 i AM able to ping my devices' IPs from terminal (though 2 show up in my router's device list with 1 final digit different, 1 of them is ping-able)
here are the errors i'm seeing, any help would be rad! cheers
python 05_LIFXLan-lib.py
Traceback (most recent call last):
File "/Users/spencer/Documents/lifx-lights/05_LIFXLan-lib.py", line 39, in <module>
devices = lifx.get_lights()
^^^^^^^^^^^^^^^^^
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/lifxlan.py", line 42, in get_lights
self.discover_devices()
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/lifxlan.py", line 50, in discover_devices
responses = self.broadcast_with_resp(GetService, StateService,)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/lifxlan.py", line 234, in broadcast_with_resp
msg = msg_type(BROADCAST_MAC, self.source_id, seq_num=0, payload=payload, ack_requested=False, response_requested=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/msgtypes.py", line 19, in __init__
super(GetService, self).__init__(MSG_IDS[GetService], target_addr, source_id, seq_num, ack_requested, response_requested)
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/message.py", line 43, in __init__
self.packed_message = self.generate_packed_message()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/message.py", line 47, in generate_packed_message
self.header = self.get_header()
^^^^^^^^^^^^^^^^^
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/message.py", line 55, in get_header
frame_addr = self.get_frame_addr()
^^^^^^^^^^^^^^^^^^^^^
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/lifxlan/message.py", line 80, in get_frame_addr
mac_addr = little_endian(bitstring.pack(mac_addr_format, convert_MAC_to_int(self.target_addr)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/spencer/Documents/lifx-lights/.venv/lib/python3.12/site-packages/bitstring/methods.py", line 76, in pack
raise CreationError(f"Token with length {length} packed with value of length {len(value)}.")
ValueError: Token with length 64 packed with value of length 0.
ah, solved (ish) downgraded to python v 3.6.15 and it works as expected.
didnt mess about further to find which version it breaks at
same issue, I'm on Python 3.8.8.
Looks like this was fixed in this PR, as pointed out by this issue. I ran into this on Python 3.10.12, but I realized it may be because I installed using python3 -m pip install lifxlan. According to pypi.org, there hasn't been a release since 2021, so perhaps the fix didn't make it into pip yet.
@mclarkk - would it be possible to get an updated release so the pip method of installation pulls in the latest updates?
Is anyone running a modern version of Python? I stayed in an older version because everything works. Newer Python versions perform better so I would like to upgrade.
On Sat, Oct 12, 2024 at 6:22 PM Connor Shugg @.***> wrote:
Looks like this was fixed in this PR https://github.com/mclarkk/lifxlan/pull/174, as pointed out by this issue https://github.com/mclarkk/lifxlan/issues/173. I ran into this on Python 3.10.12, but I realized it may be because I installed using python3 -m pip install lifxlan. According to pypi.org, there hasn't been a release since 2021 https://pypi.org/project/lifxlan/#history, so perhaps the fix didn't make it into pip yet.
— Reply to this email directly, view it on GitHub https://github.com/mclarkk/lifxlan/issues/188#issuecomment-2408716046, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPDGJK7RRNTDWJQXWY5BQLZ3GOI7AVCNFSM6AAAAABPMX6RKWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYG4YTMMBUGY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@HaberHash yes, I was able to get it working on Python 10. Instead of running python3 -m pip install lifxlan, clone the repo on your machine, cd into it, and install it with the setup.py script:
git clone https://github.com/mclarkk/lifxlan
cd lifxlan
python3 -m pip install ./
This got things working for me, and this bug has not been an issue.
@mclarkk - would it be possible to get an updated release so the
pipmethod of installation pulls in the latest updates?
Done! Everyone with pip-installed lifxlan can get the fix now with pip install lifxlan --upgrade.
works! thanks @mclarkk 🙏