brianpeiris / switchmate

A python-based command line utility for controlling Switchmate switches
MIT License
35 stars 12 forks source link

bluepy, docopt and other dependencies on HA Linux Image #12

Closed rotcop4u2 closed 6 years ago

rotcop4u2 commented 6 years ago

Hello,

I'm trying to use your script but am unable to get the dependencies. do you know where to locate them?

brianpeiris commented 6 years ago

switchmate uses the typical method for python dependencies. They are specified in the requirements.txt file and can be installed with pip: pip install -r requirements.txt

rotcop4u2 commented 6 years ago

I'm having some issues trying to run the ./switchmate.py scan command.. it says permission denied even when I run in sudo su

On Fri, Sep 14, 2018, 11:28 AM Brian Peiris notifications@github.com wrote:

switchmate uses the typical method for python dependencies. They are specified in the requirements.txt https://github.com/brianpeiris/switchmate/blob/master/requirements.txt file and can be installed with pip: pip install -r requirements.txt

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/brianpeiris/switchmate/issues/12#issuecomment-421395208, or mute the thread https://github.com/notifications/unsubscribe-auth/AkOsJqrOJwnRMBviUDuOGosYBx5h2wNbks5ua8swgaJpZM4WpSsM .

brianpeiris commented 6 years ago

Can you paste the full error?

rotcop4u2 commented 6 years ago

master# bash switchmate.py scan switchmate.py: line 36: switchmate.py

A python-based command line utility for controlling Switchmate switches.

Usage: ./switchmate.py scan [options] ./switchmate.py status [options] ./switchmate.py status [options] ./switchmate.py switch (on | off) ./switchmate.py toggle ./switchmate.py battery-level ./switchmate.py debug ./switchmate.py (-h | --help) | help

Commands: scan Scan for switchmate devices and print their mac addresses. status Scan for switchmate devices and print their mac addresses and status. switch (on | off) Switch a device on or off. toggle Switch a device on if currently off, or off if currently on. debug Print a detailed information about a device, for debugging purposes. help Show this help screen.

Options: -t , --timeout= [default: 2] Search for devices until this timeout. -h, --help Show this help screen. : No such file or directory from: can't read /var/mail/future switchmate.py: line 39: import: command not found from: can't read /var/mail/docopt switchmate.py: line 42: syntax error near unexpected token (' switchmate.py: line 42:from bluepy.btle import (' root@HOMEASSISTANT:/home/homeassistant/.homeassistant/python_scripts/switchmate- master# cd .. root@HOMEASSISTANT:/home/homeassistant/.homeassistant/python_scripts# python swi tchmate.py scan Traceback (most recent call last): File "switchmate.py", line 41, in from docopt import docopt ImportError: No module named docopt

rotcop4u2 commented 6 years ago

i pip3 install -r requirements.txt already and it grabbed all the dependencies

brianpeiris commented 6 years ago

Might be easier if we chat in realtime on Gitter: https://gitter.im/brianpeiris-switchmate/Lobby

brianpeiris commented 6 years ago

Turns out @rotcop4u2 was running HomeAssistant's flavor of Linux on a Raspberry Pi 3B+

We got things partially working with these commands:

$ pip3 install -r requirements.txt
$ sudo pip3 install bluepy
$ pushd /usr/local/lib/python3.5/dist-packages/bluepy/
$ sudo make
$ popd
$ sudo python3 ./switchmate.py scan

But there is still an issue with finding particular switches.

lawrence-jeff commented 6 years ago

But there is still an issue with finding particular switches.

Are you having issues with the code seeing some devices -in my cases the code scans and if I add debug statements listing the macs it sees it sees the switchmate devices but skips past them as they don't match the service id in the code - are you seeing this also?

brianpeiris commented 6 years ago

@rotcop4u2 Let me know if this is still an issue for you with the new fix or if I can close this issue.

brianpeiris commented 6 years ago

I'm going to close this for now. Feel free to reopen if you need to.