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

"It's no longer possible to auto initialise a bitstring from an integer" error #181

Open
ath0rus opened this issue Sep 21, 2023 · 7 comments
Assignees

Comments

@ath0rus
Copy link

ath0rus commented Sep 21, 2023

as the title suggests I keep getting It's no longer possible to auto initialise a bitstring from an integer. Use 'Bits(0)' instead of just '0' as this makes it clearer that a bitstring of 0 zero bits will be created. when ever I try to use the library, is there something im doing wrong and how can i fix it

@ath0rus
Copy link
Author

ath0rus commented Sep 21, 2023

my code is as follows
`from lifxlan import LifxLAN
import time

def main():
# Initialize LifxLAN object
lifx = LifxLAN(1) # 1 light

# Get the first light
light = lifx.get_lights()[0]

# Store the current color
original_color = light.get_color()

# Set the light to red
red_color = [65535, 65535, 65535, 3500]  # [Hue, Saturation, Brightness, Kelvin]
light.set_color(red_color, rapid=True)

# Wait for 3 seconds
time.sleep(3)

# Revert to the original color
light.set_color(original_color, rapid=True)

if name == "main":
main()`

curtsy of chatgpt4

@salil-khanna
Copy link

facing same issue :(

@aredon
Copy link

aredon commented Oct 15, 2023

I'm getting hit by this as well now. I thought it was my own inputs to set_zone_colors() but seeing this here is worrying...

@aredon
Copy link

aredon commented Oct 15, 2023

Ok I'm digging in a bit here and it looks like bitstring is another package. Lifxlan is using bitstring.pack() in message.py in order to send information to the light. I would suspect that is where the error lives.

@aredon
Copy link

aredon commented Oct 16, 2023

It might be possible to load an older version of bitstring. It appears as of 4.1.0 this was disallowed.

@HaberHash
Copy link

HaberHash commented Oct 16, 2023

I had a similar issue a while back. This is the feedback pedantic79 sent me privately:

The problem is that the current version of lifxlan only works with v3 of bitstring, and you have v4 of bitstring. So your options are:

  1. If you pip install lifxlan, then run pip list, you should see bitstring 4.0.2 (or some other version 4 bitstring package). To fix this run pip install bitstring==3.1.9, this will force your install to work.

  2. Rather than installing in a global python package directory, consider using venv. Once your venv is activated, then follow the instructions in 1. This solution is useful if you have other things that depend on bitstring and installing bitstring==3.1.9 will conflict globally.

  3. Wait until there is a version of lifxlan that supports bitstring

——

#1 worked for me although a longer-term fix would be better. I discovery issues and crashes.

@aredon
Copy link

aredon commented Oct 16, 2023

Nice! I figured that would work. Unfortunately I'm running this in home assistant which appears to be running bitstring 4 so I'll have to find another solution.

I had a similar issue a while back. This is the feedback pedantic79 sent me privately:

The problem is that the current version of lifxlan only works with v3 of bitstring, and you have v4 of bitstring. So your options are:

  1. If you pip install lifxlan, then run pip list, you should see bitstring 4.0.2 (or some other version 4 bitstring package). To fix this run pip install bitstring==3.1.9, this will force your install to work.
  2. Rather than installing in a global python package directory, consider using venv. Once your venv is activated, then follow the instructions in 1. This solution is useful if you have other things that depend on bitstring and installing bitstring==3.1.9 will conflict globally.
  3. Wait until there is a version of lifxlan that supports bitstring

——

#1 worked for me although a longer-term fix would be better. I discovery issues and crashes.

@mclarkk mclarkk self-assigned this Oct 13, 2024
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

5 participants