Nekmo / amazon-dash

Hack your Amazon Dash to run what you want.
MIT License
828 stars 67 forks source link

Not able to run discovery #49

Closed Slowsteve closed 6 years ago

Slowsteve commented 6 years ago

Hi, I'm having problems and would really appreciate any help. I'm trying to teach an old dog new tricks ; that old dog is me, a retired engineer(mechanical, unfortunately). I have some home automation set up on android using Tasker and RM Plugin etc and thought the next step would be to learn some coding so have recently bought and have set up a raspberry pi headlessly and accessing it by SSH and VNC. I thought I would ease into it by reproducing other peoples work so have been trying to re-purpose some dash buttons. After days of Googling , changing node.js versions, reinstalling npm, re-flashing etc, etc I still cannot get Mr Maddox's Dasher to work. I then came accross your excellent work but I have failed again. I have started from a fresh install many times and run the apt-get update and upgrade commands. The pasted screen shots below show where I am currently at. It might be relevant to mention that on one occasion I tried following your instructions to delete previous attempts by command lines and the first instruction worked (pip uninstall from memory) but each of the other 3 rm commands returned that files could not be found (sorry I dont have actual screen shots of this). I hope you can point me in the right direction please.

What I Did

pi@raspberrypi:~ $ sudo pip install amazon-dash Collecting amazon-dash Using cached https://www.piwheels.org/simple/amazon-dash/amazon_dash-1.0.2-py2.py3-none-any.whl Requirement already satisfied: click-default-group in /usr/local/lib/python2.7/dist-packages (from amazon-dash) Requirement already satisfied: click in /usr/local/lib/python2.7/dist-packages (from amazon-dash) Requirement already satisfied: requests in /usr/local/lib/python2.7/dist-packages (from amazon-dash) Requirement already satisfied: jsonschema in /usr/local/lib/python2.7/dist-packages (from amazon-dash) Requirement already satisfied: scapy-python3 in /usr/local/lib/python2.7/dist-packages (from amazon-dash) Requirement already satisfied: PyYAML>=3.0 in /usr/local/lib/python2.7/dist-packages (from amazon-dash) Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests->amazon-dash) Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests->amazon-dash) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests->amazon-dash) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests->amazon-dash) Requirement already satisfied: functools32; python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from jsonschema->amazon-dash) Installing collected packages: amazon-dash Successfully installed amazon-dash-1.0.2

pi@raspberrypi:~ $ sudo python -m amazon_dash.install Executing all install scripts for Amazon-Dash [OK] config has been installed successfully [OK] systemd service has been installed successfully pi@raspberrypi:~ $ sudo amazon-dash discovery Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in catch(cli)() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap return fn(*args, kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in call return self.main(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke return callback(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 122, in discovery from amazon_dash.discovery import discover File "/usr/local/lib/python2.7/dist-packages/amazon_dash/discovery.py", line 3, in from amazon_dash.scan import scan_devices File "/usr/local/lib/python2.7/dist-packages/amazon_dash/scan.py", line 6, in from scapy.all import File "/usr/local/lib/python2.7/dist-packages/scapy/all.py", line 10, in from .config import File "/usr/local/lib/python2.7/dist-packages/scapy/config.py", line 11, in from .data import * File "/usr/local/lib/python2.7/dist-packages/scapy/data.py", line 184, in TCP_SERVICES,UDP_SERVICES=load_services("/etc/services") File "/usr/local/lib/python2.7/dist-packages/scapy/data.py", line 109, in load_services f=open(filename, errors='ignore') TypeError: 'errors' is an invalid keyword argument for this function pi@raspberrypi:~ $

Nekmo commented 6 years ago

It seems that you have installed scapy-python3 on Python2:

$ sudo pip uninstall scapy-python3
$ sudo pip install scapy
Slowsteve commented 6 years ago

Thankyou for your quick reply. After a fresh install of raspbian stretch I followed your instructions and now discovery works brilliantly! I have a question please:- After I captured the mac addresses for the fist time I ran the service again (to gauge the difference in response time between wired and wireless connections). I was surprised to see an entry for an amazon device before I had pushed a button. I repeated this and the same thing happened with the same address.? Why would this happen? Thanks again for your help which has encouraged me to continue.

Nekmo commented 6 years ago

You may have another device at home that uses a registered Amazon mac address. Some examples:

Hope this can help you :)

Slowsteve commented 6 years ago

Thank you very much.

Slowsteve commented 6 years ago

I'm grateful for your help and am sorry to trouble you again. I've been trying for hours to edit the .yml file and have tried all combinations of layout and each time I run $ sudo amazon-dash check-config --config /etc/amazon-dash.yml I get the exact same responce:-

pi@raspberrypi:~ $ sudo amazon-dash check-config --config /etc/amazon-dash.yml Welcome to Amazon-dash v1.0.2 using Python 2.7.13 [Error] Amazon Dash Exception (InvalidConfig): The configuration file is invalid (/etc/amazon-dash.yml). Check the file and read the documentation. mapping values are not allowed here in "/etc/amazon-dash.yml", line 54, column 8

My .yml file looks like this :-

devices: c4:7b:9c:25:7c:9b: name: duracell url: 'https://maker.ifttt.com/trigger/doorbell/with/key/xxxxxXxXXXX-XxXXXXl' method: post

Everything else that was in there has been deleted. I have tried with and without the ' ' in the url line and tried to follow the layout of your example. I cant figure out where line 54 might be. I've tested the webhook service within ifttt and it sends me a notification so I guess that part is correct.

I hope you can help

Slowsteve commented 6 years ago

Not wishing to hound you but I have since checked status :-

pi@raspberrypi:~ $ sudo systemctl start amazon-dash pi@raspberrypi:~ $ sudo systemctl status amazon-dash ● amazon-dash.service - Amazon Dash service Loaded: loaded (/usr/lib/systemd/system/amazon-dash.service; disabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Wed 2018-05-16 13:04:41 +01; 1s ago Process: 2654 ExecStart=/usr/bin/env amazon-dash run --config /etc/amazon-dash.yml (code=exited, status=1/FAILURE) Main PID: 2654 (code=exited, status=1/FAILURE)

May 16 13:04:41 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 16 13:04:41 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. pi@raspberrypi:~ $

Where am I going wrong?

Slowsteve commented 6 years ago

also did this:-

pi@raspberrypi:~ $ sudo amazon-dash --config /etc/amazon-dash.yml Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Listening for events. Amazon-dash will execute the events associated with the registered buttons. Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in catch(cli)() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap return fn(*args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 99, in run from amazon_dash.listener import Listener File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in from amazon_dash.confirmations import get_confirmation File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in from amazon_dash._compat import JSONDecodeError File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in import subprocess32 as subprocess ImportError: No module named subprocess32

Slowsteve commented 6 years ago

Again not wishing to pester but thought my latest actions on a freshly installed raspbian might be relevent. it seems that Ive now got the .yml configured correctly but still have an issue with ImportError: No module named subprocess32

pi@raspberrypi:~ $ sudo amazon-dash check-config --config /etc/amazon-dash.yml Welcome to Amazon-dash v1.0.2 using Python 2.7.13 The configuration file "/etc/amazon-dash.yml" is correct pi@raspberrypi:~ $ sudo systemctl restart amazon-dash pi@raspberrypi:~ $ sudo amazon-dash run --help Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Usage: amazon-dash run [OPTIONS]

Run server

Options: --config PATH Path to config file. --root-allowed Allow execute commands on config file as root --help Show this message and exit. pi@raspberrypi:~ $ sudo amazon-dash run --root-allowed Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Listening for events. Amazon-dash will execute the events associated with the registered buttons. Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in catch(cli)() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap return fn(*args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 99, in run from amazon_dash.listener import Listener File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in from amazon_dash.confirmations import get_confirmation File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in from amazon_dash._compat import JSONDecodeError File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in import subprocess32 as subprocess ImportError: No module named subprocess32 pi@raspberrypi:~ $ sudo amazon-dash run --config Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Error: --config option requires an argument pi@raspberrypi:~ $ sudo amazon-dash run --config /etc/amazon-dash.yml Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Listening for events. Amazon-dash will execute the events associated with the registered buttons. Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in catch(cli)() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap return fn(*args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 99, in run from amazon_dash.listener import Listener File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in from amazon_dash.confirmations import get_confirmation File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in from amazon_dash._compat import JSONDecodeError File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in import subprocess32 as subprocess ImportError: No module named subprocess32 pi@raspberrypi:~ $ sudo amazon-dash test-device b4:7c:9c:25:7c:9b --config/etc/amazon-dash.yml Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Error: no such option: --config/etc/amazon-dash.yml pi@raspberrypi:~ $ sudo amazon-dash test-device b4:7c:9c:25:7c:9b --config /etc/amazon-dash.yml Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in catch(cli)() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap return fn(*args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 116, in test_device from amazon_dash.listener import test_device File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in from amazon_dash.confirmations import get_confirmation File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in from amazon_dash._compat import JSONDecodeError File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in import subprocess32 as subprocess ImportError: No module named subprocess32 pi@raspberrypi:~ $

Nekmo commented 6 years ago

It seems that for some reason you have not installed the dependencies of Python2. Install subprocess32.

$ sudo pip install subprocess32
Slowsteve commented 6 years ago

All working now, thankyou very much !!!

On a fresh install of Rasbian-Stretch I did these fixes and it worked
$ sudo pip uninstall scapy-python3 $ sudo pip install scapy $ sudo pip install subprocess32

Out of interest, on a different fresh install, I removed Python 2.7.13 and then installed some missing dependencies? (pip and tcdump) and then your installation was working on Python3. I guess there might be some anomolies with Raspbian having both versions.

As shown below, attempting to run with pi@raspberrypi:~ $ sudo amazon-dash run shows an error but the button presses continued to work. Should I use pi@raspberrypi:~ $ sudo systemctl start amazon-dash ? Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Listening for events. Amazon-dash will execute the events associated with the re gistered buttons. [Error] Amazon Dash Exception (ConfigFileNotFoundError): The configuration file was not found on "/home/pi/amazon-dash.yml"

pi@raspberrypi:~ $ sudo systemctl status amazon-dash ● amazon-dash.service - Amazon Dash service Loaded: loaded (/usr/lib/systemd/system/amazon-dash.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2018-05-17 11:53:29 UTC; 9min ago Main PID: 327 (amazon-dash) CGroup: /system.slice/amazon-dash.service └─327 /usr/bin/python /usr/local/bin/amazon-dash run --config /etc/amazon-dash.yml

May 17 11:53:29 raspberrypi systemd[1]: Started Amazon Dash service. May 17 11:53:33 raspberrypi env[327]: Welcome to Amazon-dash v1.0.2 using Python 2.7.13 May 17 11:53:33 raspberrypi env[327]: Listening for events. Amazon-dash will execute the events associated with the registered buttons lines 1-10/10 (END)

One last thing to ask. How should I exit the dicovery and the status 'widows' to safely return to the prompt ?

Slowsteve commented 6 years ago

Hello again, I've made some progress and now have home assistant (on venv) set up and working with mosquitto mqtt and code red on my RPi 3. My config file is

https://github.com/Nekmo/amazon-dash/issues

devices: b4:7c:9c:25:7c:9b: name: duracell url: 'https://maker.ifttt.com/trigger/doorbell/with/key/xxxxxxxxxxxxxxl' method: post fc:a6:67:1c:fc:82: name: right guard homeassistant: 192.168.1.194:8123 event: toggle_kitchen_light

The ifttt works and sends notification correctly. I'm still trying to get my head around the home assistant. Please could you confirm that my config looks correct and suggest a way to check if the message is being received by HA. I've not been able to see any entries in the HA log

Nekmo commented 6 years ago

The configuration seems to be fine but remember that spaces are important in yaml. Try to enter your configuration between triple quotes. Remember that you must have created a toggle_kitchen_light event in Home Asssistant.

Slowsteve commented 6 years ago

Thanks for prompt reply. Am struggling to create the HA event but will get there.

Nekmo commented 6 years ago

You can try your Home Assistant event without Amazon Dash to verify that it works correctly.

curl -X POST -H "Content-Type: application/json" http://192.168.1.194:8123/api/events/toggle_kitchen_light
ningstory commented 6 years ago

Hi, I'm having the same issue. I guess I had Scapy Python3, I uninstalled it and installed scapy. Tried running the discovery and now get this, can you please help:

First error, then uninstalled and reinstalled: Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in catch(cli)() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap return fn(*args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 122, in discovery from amazon_dash.discovery import discover File "/usr/local/lib/python2.7/dist-packages/amazon_dash/discovery.py", line 3 , in from amazon_dash.scan import scan_devices File "/usr/local/lib/python2.7/dist-packages/amazon_dash/scan.py", line 6, in from scapy.all import File "/usr/local/lib/python2.7/dist-packages/scapy/all.py", line 10, in from .config import File "/usr/local/lib/python2.7/dist-packages/scapy/config.py", line 11, in from .data import * File "/usr/local/lib/python2.7/dist-packages/scapy/data.py", line 184, in TCP_SERVICES,UDP_SERVICES=load_services("/etc/services") File "/usr/local/lib/python2.7/dist-packages/scapy/data.py", line 109, in load _services f=open(filename, errors='ignore') TypeError: 'errors' is an invalid keyword argument for this function

Second error after install: Welcome to Amazon-dash v1.0.2 using Python 2.7.13 Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in catch(cli)() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap return fn(*args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call return self.main(args, kwargs) File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke return callback(args, kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 122, in discovery from amazon_dash.discovery import discover File "/usr/local/lib/python2.7/dist-packages/amazon_dash/discovery.py", line 3 , in from amazon_dash.scan import scan_devices File "/usr/local/lib/python2.7/dist-packages/amazon_dash/scan.py", line 6, in from scapy.all import * ImportError: No module named scapy.all

Nekmo commented 6 years ago

I have installed Amazon-dash using Python 2 and I can not reproduce the error.

[nekmo@homura ~]$ mktmpenv -p /usr/bin/python2
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/nekmo/.virtualenvs/tmp-8aa55e4c3086875/bin/python2
Also creating executable in /home/nekmo/.virtualenvs/tmp-8aa55e4c3086875/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/nekmo/.virtualenvs/tmp-8aa55e4c3086875/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/nekmo/.virtualenvs/tmp-8aa55e4c3086875/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/nekmo/.virtualenvs/tmp-8aa55e4c3086875/bin/preactivate
virtualenvwrapper.user_scripts creating /home/nekmo/.virtualenvs/tmp-8aa55e4c3086875/bin/postactivate
virtualenvwrapper.user_scripts creating /home/nekmo/.virtualenvs/tmp-8aa55e4c3086875/bin/get_env_details
piThis is a temporary environment. It will be deleted when you run 'deactivate'.
(tmp-8aa55e4c3086875) [nekmo@homura ~/.virtualenvs/tmp-8aa55e4c3086875]$ pip install amazon-dash
Collecting amazon-dash
  Downloading https://files.pythonhosted.org/packages/bb/d4/3cf0b55d70e08f7af10c97106b57fc2f0ff58fcf52f909bbd297fbff41e1/amazon-dash-1.0.2.tar.gz
Collecting scapy (from amazon-dash)
  Downloading https://files.pythonhosted.org/packages/68/01/b9943984447e7ea6f8948e90c1729b78161c2bb3eef908430638ec3f7296/scapy-2.4.0.tar.gz (3.1MB)
    100% |████████████████████████████████| 3.1MB 4.6MB/s 
Collecting subprocess32 (from amazon-dash)
  Downloading https://files.pythonhosted.org/packages/de/fb/fd3e91507021e2aecdb081d1b920082628d6b8869ead845e3e87b3d2e2ca/subprocess32-3.5.1.tar.gz (95kB)
    100% |████████████████████████████████| 102kB 7.3MB/s 
Collecting PyYAML>=3.0 (from amazon-dash)
  Downloading https://files.pythonhosted.org/packages/4a/85/db5a2df477072b2902b0eb892feb37d88ac635d36245a72a6a69b23b383a/PyYAML-3.12.tar.gz (253kB)
    100% |████████████████████████████████| 256kB 7.0MB/s 
Collecting jsonschema (from amazon-dash)
  Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
Collecting requests (from amazon-dash)
  Using cached https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl
Collecting click (from amazon-dash)
  Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 7.5MB/s 
Collecting click-default-group (from amazon-dash)
  Downloading https://files.pythonhosted.org/packages/86/3e/389d8bbe3033613b17ce4136dbcf3e69c785c9c54d08f3adb95336b52040/click-default-group-1.2.tar.gz                                                                                            
Collecting functools32; python_version == "2.7" (from jsonschema->amazon-dash)                                                                                                                                                                     
  Downloading https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz                                                                                                
Collecting certifi>=2017.4.17 (from requests->amazon-dash)                                                                                                                                                                                         
  Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl                                                                                   
Collecting chardet<3.1.0,>=3.0.2 (from requests->amazon-dash)                                                                                                                                                                                      
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl                                                                                       
Collecting idna<2.7,>=2.5 (from requests->amazon-dash)                                                                                                                                                                                             
  Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl                                                                                            
Collecting urllib3<1.23,>=1.21.1 (from requests->amazon-dash)                                                                                                                                                                                      
  Using cached https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl                                                                                        
Building wheels for collected packages: amazon-dash, scapy, subprocess32, PyYAML, click-default-group, functools32                                                                                                                                 
  Running setup.py bdist_wheel for amazon-dash ... done                                                                                                                                                                                            
  Stored in directory: /home/nekmo/.cache/pip/wheels/6d/bc/0c/99177feb525558c59c304c17ce4a83a6c7cd4c1fbe71879048                                                                                                                                   
  Running setup.py bdist_wheel for scapy ... done
  Stored in directory: /home/nekmo/.cache/pip/wheels/cf/03/88/296bf69fee1f9ec7a87e122da52253b65f3067f6ea8719b473
  Running setup.py bdist_wheel for subprocess32 ... done
  Stored in directory: /home/nekmo/.cache/pip/wheels/61/3d/4c/cc17db440873580f63f67d30cd4a73b07db23f6f2efdca90b1
  Running setup.py bdist_wheel for PyYAML ... done
  Stored in directory: /home/nekmo/.cache/pip/wheels/03/05/65/bdc14f2c6e09e82ae3e0f13d021e1b6b2481437ea2f207df3f
  Running setup.py bdist_wheel for click-default-group ... done
  Stored in directory: /home/nekmo/.cache/pip/wheels/a0/ea/f9/462f99e2f22c3ff2dd009592ef9258eb3e5ed02cf3fcb31576
  Running setup.py bdist_wheel for functools32 ... done
  Stored in directory: /home/nekmo/.cache/pip/wheels/b5/18/32/77a1030457155606ba5e3ec3a8a57132b1a04b1c4f765177b2
Successfully built amazon-dash scapy subprocess32 PyYAML click-default-group functools32
Installing collected packages: scapy, subprocess32, PyYAML, functools32, jsonschema, certifi, chardet, idna, urllib3, requests, click, click-default-group, amazon-dash
Successfully installed PyYAML-3.12 amazon-dash-1.0.2 certifi-2018.4.16 chardet-3.0.4 click-6.7 click-default-group-1.2 functools32-3.2.3.post2 idna-2.6 jsonschema-2.6.0 requests-2.18.4 scapy-2.4.0 subprocess32-3.5.1 urllib3-1.22
(tmp-8aa55e4c3086875) [nekmo@homura ~/.virtualenvs/tmp-8aa55e4c3086875]$ sudo amazon-dash discovery
Welcome to Amazon-dash v1.0.2 using Python 2.7.14
The discovery command lists the devices that are connected in your network. Each device will only be listed once. After executing this command wait approximately 10 seconds before pressing the Amazon Dash button. After pressing the button, the Mac address of the button will immediately appear on the screen. Remember the address to be able to create the configuration file.

08:60:6e:69:xx:xx
4c:5e:0c:5f:xx:xx

Please paste your dependency list here.

$ pip freeze
ningstory commented 6 years ago

pi@raspberrypi:~ $ pip freeze amazon-dash==1.0.2 automationhat==0.1.0 blinker==1.3 blinkt==0.1.2 Cap1xxx==0.1.3 chardet==2.3.0 click==6.6 click-default-group==1.2 colorama==0.3.7 cryptography==1.7.1 dnspython==1.15.0 drumhat==0.1.0 enum34==1.1.6 envirophat==1.0.0 ExplorerHAT==0.4.2 Flask==0.12.1 fourletterphat==0.1.0 functools32==3.2.3.post2 gpiozero==1.4.1 idna==2.2 ipaddress==1.0.17 itsdangerous==0.24 Jinja2==2.8 jsonschema==2.6.0 keyring==10.1 keyrings.alt==1.3 lxkeymap==0.1 MarkupSafe==0.23 mcpi==0.1.1 microdotphat==0.2.1 mote==0.0.3 motephat==0.0.2 numpy==1.12.1 oauthlib==2.0.1 phatbeat==0.1.0 pianohat==0.1.0 picamera==1.13 picraft==1.0 piglow==1.2.4 pigpio==1.38 Pillow==4.0.0 pyasn1==0.1.9 pycrypto==2.6.1 pygame==1.9.3 pygobject==3.22.0 pyinotify==0.9.6 PyJWT==1.4.2 pyOpenSSL==16.2.0 pyserial==3.2.1 pyxdg==0.25 PyYAML==3.12 rainbowhat==0.1.0 requests==2.12.4 requests-oauthlib==0.7.0 RPi.GPIO==0.6.3 RTIMULib==7.2.1 scapy==2.4.0 scrollphat==0.0.7 scrollphathd==1.2.1 SecretStorage==2.3.1 sense-emu==1.0 sense-hat==2.2.0 simplejson==3.10.0 six==1.10.0 skywriter==0.0.7 sn3218==1.2.7 spidev==3.3 touchphat==0.0.1 twython==3.4.0 urllib3==1.19.1 Werkzeug==0.11.15

Slowsteve commented 6 years ago

Hi, I think I'm making progress with my project and would appreciate a bit more help please. I have mqtt working on the Pi and have rmplugin on android device and have enabled its mqtt client. If I publish pi@raspberrypi:~ $ mosquitto_pub -h 192.168.1.194 -t "rmplugin/macro" -m "kitchen music on" the rmpro sends the command successfully. The next step was to set up the Listerene dash button to execute this command so I added this to devices in config file:- 68:54:fd:c8:d7:9c: name: listerene user: pi@raspberrypi cmd: mosquitto_pub -h 192.168.1.194 -t "rmplugin/macro" -m "kitchen music on" This doesn't work. I have tried omitting user, putting sudo in front of the command, using localhost instead of ip address and many other combinations , restarting amazon-dash after each attempt. I don't know if I'm making a small mistake or if my whole concept is wrong?

Nekmo commented 6 years ago

@ningstory it seems that you did not have scapy installed but it is installed. It is something strange. You can try reinstalling scapy. If the problem persists, you may have a problem with your Python installation. You can try using virtualenvs.

@Slowsteve the user must be "pi". Remember that you must have "sudo" installed on your machine. If the execution of the command fails, paste the error message here.

Slowsteve commented 6 years ago

Sorted! Thankyou