Closed roberkane212 closed 5 years ago
Please read through this other issue that a couple of other RPi 3B+ users had a discussion in. I still don't have one myself to test with but hopefully their solution can help you as well: https://github.com/brianpeiris/switchmate/issues/15
I’ve read through them, however I can even get to that part. I’m still searching to even find my device. I’ve tried all the things I’ve seen on here. If I could at least know where people are getting switchmate.py that would be great. I can’t fikd it anywhere
switchmate.py is the main file in this repo: https://github.com/brianpeiris/switchmate/blob/master/switchmate.py
Yes I know, I’m in it. However I get a error saying “NameError: name ‘switchmate’ is not defined
Sorry, I'm not following. What steps did you take to get that error? Do you mean you modified the code in switchmate.py? Can you post the full error stack?
I’m having an issue actually getting switchmate.py to scan. Can you tell me how you set up your switchmate in python. I’m sorry new to python and pip
@roberkane212 Sorry, forgot to reply to this earlier. Here are some instructions:
pip install -r requirements.txt
sudo python ./switchmate.py scan
to start using the script.ok thank you i really appreciate it, can you tell me what folder the i should put in in after i download? or will it find it no matter where it is on rpi
Doesn't matter where you put it, you can choose any folder. But you'll have to cd
into that folder to run the above commands
i got an error, could this because I'm using python 3?
$ pip3 install -r requirements.txt Collecting Django==2.1.5 (from -r requirements.txt (line 1)) Using cached https://files.pythonhosted.org/packages/36/50/078a42b4e9bedb94efd3e0278c0eb71650ed9672cdc91bd5542953bec17f/Django-2.1.5-py3-none-any.whl Collecting pkg-resources==0.0.0 (from -r requirements.txt (line 2)) Could not find a version that satisfies the requirement pkg-resources==0.0.0 (from -r requirements.txt (line 2)) (from versions: ) No matching distribution found for pkg-resources==0.0.0 (from -r requirements.txt (line 2))
uh. why is it trying to install django? are you sure you're in the right directory?
im not sure, but i got past that. when i run sudo python ./switchmate.py scan i get this error
pi@raspberrypi:~/.homebridge/switchmate-master $ sudo python ./switchmate.py scan
Traceback (most recent call last):
File "./switchmate.py", line 41, in
That error means the requirements weren't installed
they installed with no errors, i ran it just as you said
~/.homebridge/switchmate-master $ pip3 install -r requirements.txt Collecting bluepy==1.2.0 (from -r requirements.txt (line 1)) Downloading https://www.piwheels.org/simple/bluepy/bluepy-1.2.0-cp35-cp35m-linux_armv7l.whl (509kB) 100% |████████████████████████████████| 512kB 522kB/s Collecting docopt==0.6.2 (from -r requirements.txt (line 2)) Using cached https://www.piwheels.org/simple/docopt/docopt-0.6.2-py2.py3-none-any.whl Collecting tabulate==0.8.2 (from -r requirements.txt (line 3)) Downloading https://files.pythonhosted.org/packages/12/c2/11d6845db5edf1295bc08b2f488cf5937806586afe42936c3f34c097ebdc/tabulate-0.8.2.tar.gz (45kB) 100% |████████████████████████████████| 51kB 1.1MB/s Building wheels for collected packages: tabulate Running setup.py bdist_wheel for tabulate ... done Stored in directory: /home/pi/.cache/pip/wheels/2a/85/33/2f6da85d5f10614cbe5a625eab3b3aebfdf43e7b857f25f829 Successfully built tabulate Installing collected packages: bluepy, docopt, tabulate Successfully installed bluepy-1.3.0 docopt-0.6.2 tabulate-0.8.2
is there another command im missing?
i tried to use python 3 and got this error
~/.homebridge/switchmate-master $ sudo python3 ./switchmate.py scan
Traceback (most recent call last):
File "./switchmate.py", line 47, in
im very confused as it says i have both
Try sudo pip3 install -r requirements.txt
then sudo python3 ./switchmate.py scan
it worked!!!!! now its not finding my switchman, is there anything i can do to help
~/.homebridge/switchmate-master $ sudo python3 ./switchmate.py scan Scanning... No Switchmate devices found
I think we're now back to this problem: https://github.com/brianpeiris/switchmate/issues/18#issuecomment-452829499
No my issue is just the discovery it says no devices found
Shoukd to delete app?
That's what https://github.com/brianpeiris/switchmate/issues/15 is about. RPi 3B+ requires extra setup before it can even discover devices. Please read through that thread.
i can get it to toggle now, but can't get it to connect
used sudo "PATH=$PATH" python3 ./switchmate.py <mac_address> toggle
to see if the script can toggle your switch even if it can't scan for it. like you suggested to someone else worked for me
Interesting, thanks for reporting back.
i also can't get it to work with home bridge, the only way its working for me is running commands. tried to use it in cmdswitch, however the fact that you have to cd into a folder makes it too much of a command. does anyone have any advise on this issue?
That might be a better question for the homebridge community
anyone have a clue how i can find out my id number for my switchmate. i have everything else working
Are you asking about the mac address? Maybe use an app on your phone to scan for the devices, there are a number of general bluetooth scanning apps.
no the device id which i can not find in the app, nor is debug working for me. it just brings up the help options
i also can not get switchman plugin to work, however all other commands work scan, status, toggle
Sorry, I'm still not sure what you mean by "device id". You should only need the MAC address to use switchmate.py.
im trying to add it to home bridge, do you not have your switchmate connected to home bridge?
Nope, sorry, I do not use home bridge. As I mentioned, if you've got switchmate.py working in isolation, then it may be better to take this discussion to the home bridge community to answer the rest of your questions.
Since homebridge is based on node.js, you might have better luck with this project instead: https://github.com/valkjsaaa/homebridge-switchmate3
im forgetting about home bridge, i am not getting an error trying to run commands do you know why?
pi@raspberrypi:~/.homebridge/switchmate-master $ sudo python3 ./switchmate.py scan Scanning... Found Switchmates: c6:d6:aa:5e:bc:c6 pi@raspberrypi:~/.homebridge/switchmate-master $ sudo python3 ./switchmate.py status Looking for switchmate status... c6:d6:aa:5e:bc:c6 off pi@raspberrypi:~/.homebridge/switchmate-master $ sudo python3 ./switchmate.py c6:d6:aa:5e:bc:c6 toggle ERROR: Failed to connect to device. Try running switchmate with sudo.
Hmm, I would make sure your switchmate device is updated to the latest firmware via the official switchmate app. Then try to move your switchmate closer to the RPi since that error also occurs if the bluetooth signal is weak.
thanks it worked
have any clue why would get this error?
pi@raspberrypi:~ $ sudo "PATH=$PATH" python3 ./switchmate.py c6:d6:aa:5e:bc:c6 toggle python3: can't open file './switchmate.py': [Errno 2] No such file or directory pi@raspberrypi:~ $
Ok got all commands working, and got it working on homebridge using cmdswitch2 thanks for all your help
Glad to hear it! I'll go ahead and close this issue now. If you can summarize what you did through this whole process, it may be helpful to future homebridge users.
Yes it’s closed and yes I will write my steps
Great, thanks!
I have a RPi 3 B+, however it seems that this is all making it where you have to use external usb BluetoothZ however I believe my RPi has internal ble