homebridge-magichome-platform icon indicating copy to clipboard operation
homebridge-magichome-platform copied to clipboard

No action at all since rpi upgrade to 'bullseye'

Open PatriceRobert opened this issue 2 years ago • 13 comments

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 avatar Aug 22 '22 06:08 PatriceRobert

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

PatriceRobert avatar Aug 23 '22 11:08 PatriceRobert

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

CsabaVK avatar Sep 23 '23 12:09 CsabaVK

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 avatar Sep 23 '23 12:09 PatriceRobert

flux_led.py.txt

@CsabaVK

PatriceRobert avatar Sep 23 '23 12:09 PatriceRobert

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

CsabaVK avatar Sep 23 '23 12:09 CsabaVK

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....)

PatriceRobert avatar Sep 23 '23 12:09 PatriceRobert

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

CsabaVK avatar Sep 23 '23 13:09 CsabaVK

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

PatriceRobert avatar Sep 23 '23 13:09 PatriceRobert

I tried with PuTTY gave me the same error :(

CsabaVK avatar Sep 23 '23 13:09 CsabaVK

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.

PatriceRobert avatar Sep 23 '23 13:09 PatriceRobert

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 avatar Sep 23 '23 14:09 CsabaVK

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!

CsabaVK avatar Sep 23 '23 14:09 CsabaVK

please consider a pull request

ageorgios avatar Sep 23 '23 16:09 ageorgios