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

No action at all since rpi upgrade to 'bullseye' #36

Open
PatriceRobert opened this issue Aug 22, 2022 · 13 comments
Open

No action at all since rpi upgrade to 'bullseye' #36

PatriceRobert opened this issue Aug 22, 2022 · 13 comments

Comments

@PatriceRobert
Copy link

This plugin was working just fine up to an upgrade of the raspberry pi to 'bullseye' version:
Linux raspberrypi 5.15.56-v7l+ #1575 SMP Fri Jul 22 20:29:46 BST 2022 armv7l GNU/Linux
Now the plugin loads correctly, as before but nothing happens via homekit.
Tried the 'homebridge-magichome-dynamic-platform' plugin and it can control the lights but has less options than this current one (scenes: presetSwitches).

-- Patrice.

@PatriceRobert
Copy link
Author

PatriceRobert commented Aug 23, 2022

Dear all,

I think the issue has been found, in fact the file homebridge-magichome-platform/src/flux_led.py is using the latest python defined on the system (so python3 in my case) but the code is not compatible:

$ python3 flux_led.py 
  File "/home/magic/npm/node_modules/homebridge-magichome-platform/src/flux_led.py", line 124
    print ''.join('{:02x} '.format(x) for x in bytearray(bytes))
          ^
SyntaxError: invalid syntax
$ 

With python2:

$ python2 flux_led.py 
Usage: usage: flux_led.py [-sS10cwpCiltThe] [addr1 [addr2 [addr3] ...].
$ 

flux_led.py: error: An operation must be specified

So changed the header of the file to use: #!/usr/bin/python2 and it is now working fine back !!!!

-- Patrice

@CsabaVK
Copy link

CsabaVK commented Sep 23, 2023

How do you do that from homebridge? I can't seem to find the files

@PatriceRobert
Copy link
Author

PatriceRobert commented Sep 23, 2023

How do you do that from homebridge? I can't seem to find the files

Well, without python2 on your system, you may also want to 're-write' all the print functions in this flux_led.py file:
print "response too short!"
becomes
print("response too short!")

@PatriceRobert
Copy link
Author

PatriceRobert commented Sep 23, 2023

flux_led.py.txt

@CsabaVK

@CsabaVK
Copy link

CsabaVK commented Sep 23, 2023

I managed to find the file, but Im unsure how too rename the header, as Im using SSH connection to access my pi and doubt I could open the file from here?
Screenshot_3

@PatriceRobert
Copy link
Author

PatriceRobert commented Sep 23, 2023

I managed to find the file, but Im unsure how too rename the header, as Im using SSH connection to access my pi and doubt I could open the file from here? Screenshot_3

Looks good, just replace the file by the one sent in a post earlier (remove the .txt of course....)

@CsabaVK
Copy link

CsabaVK commented Sep 23, 2023

Im not sure if Im doing it correct as Im new to this, but
-I downloaded your file,
-the path seems to be correct,
-the file don't have the .txt anymore
-the ssh connection is on

and I get this error when Im trying to replace

image

@PatriceRobert
Copy link
Author

PatriceRobert commented Sep 23, 2023

Im not sure if Im doing it correct as Im new to this, but -I downloaded your file, -the path seems to be correct, -the file don't have the .txt anymore -the ssh connection is on

and I get this error when Im trying to replace

image

That's just because you shall use an scp tool from your windows to transfer the file, something like WinSCP or putty

@CsabaVK
Copy link

CsabaVK commented Sep 23, 2023

I tried with PuTTY gave me the same error :(

@PatriceRobert
Copy link
Author

Try to launch:
curl -sL https://github.com/sahilchaddha/homebridge-magichome-platform/files/12706444/flux_led.py.txt > flux_led.py
from the home dir of user pi through your ssh session, the file should be written in your home dir.

@CsabaVK
Copy link

CsabaVK commented Sep 23, 2023

I just did that, and it give the same error as in your first post,
I downloaded the file from the link inside the command to check, and in the header it says

#!/usr/bin/env python instead of #!/usr/bin/python2

Could that be the problem?

image

@CsabaVK
Copy link

CsabaVK commented Sep 23, 2023

Thank you for the help, I figured out the rest,
So I had to put this
pscp c:\Users\csaba\Desktop\flux_led.py [email protected]:/var/lib/homebridge/node_modules/homebridge-magichome-platform/src/flux_led.py
into the windows shell while I have the connection open on PuTTY

but it works!

@ageorgios
Copy link

please consider a pull request

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

3 participants