Nekmo / amazon-dash

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

How to trigger more than one thing with just one dash button? #47

Closed areknames96 closed 6 years ago

areknames96 commented 6 years ago

How can I get two different events to trigger the same dash button? I tried this way, but it does not work:

DASH_BUTTON_MAC_ADDRESS: name: something_1 url: 'https://maker.ifttt.com/trigger/something/with/key/mykey' method: post SAME_DASH_BUTTON_MAC_ADDRESS: name: something_2 homeassistant: 127.0.0.1:8123 event: switch_something_2

Nekmo commented 6 years ago

Currently this is not possible without a hack. You can run a bash script that has all the actions you need. For example:

mac_address:
    cmd: /path/to/script.sh
fake_mac1:
    name: something_1
    url: 'https://maker.ifttt.com/trigger/something/with/key/mykey'
    method: post
fake_mac2:
    name: something_2
    homeassistant: 127.0.0.1:8123
    event: switch_something_2

Script content:

#!/usr/bin/env bash
# /path/to/script.sh
amazon-dash test-device fake_mac1
amazon-dash test-device fake_mac2

I think it's a good idea to execute more than one action but with the current syntax it is not possible. I accept suggestions.

areknames96 commented 6 years ago

I have some problems. I created the script file in the same directory as amazon-dash.yml, in etc. Below I paste the contents of amazon-dash.yml and script.sh:

amazon-dash.yml:

amazon-dash.yml

---------------

settings: delay: 10 devices: REAL-MAC: name: script cmd: script.sh FAKE-MAC-1: name: first_event url: 'https://maker.ifttt.com/trigger/first_event/with/key/mykey' method: post FAKE-MAC-2: name: second_event homeassistant: 127.0.0.1:8123 event: switch_second_event

script.sh:

!/usr/bin/env bash

/script.sh

amazon-dash test-device FAKE-MAC-1 amazon-dash test-device FAKE-MAC-2

I tried to write the path in different ways, like /etc/script.sh, or /script.sh since it is in the same directory, but it did not work in any way, could you identify the error?

areknames96 commented 6 years ago

Hi, there are some news, I ran this from the terminal: amazon-dash test-device FAKE-MAC

and this is the answer: Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 8, in execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 129, in execute_from_command_line execute_args(args) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 84, in execute_args test_device(args.device, args.config, args.root_allowed) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 133, in test_device config = Config(file) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/config.py", line 181, in init self.read() File "/usr/local/lib/python2.7/dist-packages/amazon_dash/config.py", line 189, in read data = load(open(self.file), Loader) IOError: [Errno 13] Permission denied: 'amazon-dash.yml'

Nekmo commented 6 years ago

You will need to run amazon-dash as root so that you can read the configuration file. It is not the best but it is a solution.

areknames96 commented 6 years ago

I'm trying to get around the problem by delegating the execution of the two commands to home assistant, launching only one event for home assistant from amazon-dash, but I encountered another problem, I have two dash buttons with a similar but different Mac address, if I configure them both in amazon-dash.yml, I get this error:

[Error] Amazon Dash Exception (InvalidConfig): The configuration file is invalid. Check the file and read the documentation. There can only be one method of execution on a device. The device is ok.

Individually configured, they work

areknames96 commented 6 years ago

Update: this error comes out if in amazon-dash.yml I configure more dash button with home assistant triggers, regardless of the mac of the dash button. With amazon-dash I can launch only one home assistant event? If I want to trigger another HA event with another Dash button, is not possible, it's true? Or am I doing wrong?

Nekmo commented 6 years ago

That error occurs because you have more than one method of execution on a device. For example:

# WARNING: Invalid config. Do not copy & paste.

  0C:47:C9:98:4A:12:
    name: Kitcken button
    user: your-user 
    cmd: spotify
    url: 'http://domain.com/path/to/webhook'

Paste your configuration to receive more help.

areknames96 commented 6 years ago

This is my configuration:

amazon-dash.yml

---------------

settings: delay: 10 devices: XX:XX:XX:6C:52:8B: name: switch homeassistant: localhost event: switch XX:XX:XX:75:46:0C: name: on url: 'https://maker.ifttt.com/trigger/on/with/key/mykey' method: post XX:XX:XX:35:63:AF: name: off url: 'https://maker.ifttt.com/trigger/off/with/key/mykey' method: post XX:XX:XX:26:C5:93: name: son homeassistant: localhost event: son XX:XX:XX:FE:D4:F9: name: soff homeassistant: localhost event: soff

If I leave only one homeassistant event in the configuration, it works. If you put 2 or 3 in the configuration, as above, always returns the same error by running any one.

Nekmo commented 6 years ago

In your config:

settings:
  delay: 10
devices:
  00:11:22:6C:52:8B:
    name: switch
    homeassistant: localhost
    event: switch
  00:11:22:75:46:0C:
    name: on
    url: 'https://maker.ifttt.com/trigger/on/with/key/mykey'
    method: post
  00:11:22:35:63:AF:
    name: off
    url: 'https://maker.ifttt.com/trigger/off/with/key/mykey'
    method: post
  00:11:22:26:C5:93:
    name: son
    homeassistant: localhost
    event: son
  00:11:22:FE:D4:F9:
    name: soff
    homeassistant: localhost
    event: soff

"on" and "off" are reserved names for Yaml. You have to put both names between quotes.

/home/nekmo/.virtualenvs/amazon-dash/bin/python /home/nekmo/Workspace/amazon-dash/scripts/amazon-dash run --config amazon-dash2.yml
Welcome to Amazon-dash v1.1.0a1 using Python 3.6.3
Listening for events. Amazon-dash will execute the events associated with the registered buttons.
[Error] Amazon Dash Exception (InvalidConfig):
The configuration file is invalid (/home/nekmo/Workspace/amazon-dash/amazon-dash2.yml). Check the file and read the documentation. True is not of type 'string'

Failed validating 'type' in schema['properties']['devices']['patternProperties']['^([0-9A-Fa-f]{2}[:]){5}([0-9A-Fa-f]{2})$']['properties']['name']:
    {'type': 'string'}

On instance['devices']['00:11:22:75:46:0C']['name']:
    True

After putting both names between quotes everything seems to work fine.

areknames96 commented 6 years ago

Excuse me, I created a misunderstanding, on and off I put them indicatively, in fact the names I gave are different. However, I emailed you the actual screenshots of my configuration and the tests I did

Nekmo commented 6 years ago

@areknames96 I can't reproduce your error.

My config:

# amazon-dash.yml
# ---------------
settings:
  delay: 10
devices:
  AA:BB:33:44:55:01:
    name: Switch test 1
    homeassistant: localhost
    event: switch_1
  AA:BB:33:44:55:02:
    name: Switch test 2
    homeassistant: localhost
    event: switch_2
  AA:BB:33:44:55:03:
    name: Switch test 3
    homeassistant: localhost
    event: switch_3
  AA:BB:33:44:55:04:
    name: Url test 1
    url: 'https://iftttt.com/test1'
    method: post
  AA:BB:33:44:55:05:
    name: Url test 2
    url: 'https://iftttt.com/test2'
    method: post

My test:

/home/nekmo/.virtualenvs/amazon-dash/bin/python /home/nekmo/Workspace/amazon-dash/scripts/amazon-dash test-device --config amazon-dash_.yml AA:BB:33:44:55:04
Welcome to Amazon-dash v1.0.2 using Python 3.6.3

Process finished with exit code 0
areknames96 commented 6 years ago

If you have seen the screenshots I sent you by email you will see that the tests are sometimes successful sometimes not, for no apparent reason. How can I completely delete amazon-dash from the raspberry and reinstall it from 0 to see if it works?

areknames96 commented 6 years ago

I made trouble trying to fix my error, I tried to update amazon-dash, but since I did it never works, not even ifttt events. If I do a test with a mac address configured in amazon-dash.yml, it works, but if I really hit the dash button, it does not work, it's like it could not capture the package. I tried to uninstall amazon-dash and reinstall it numerous times, I also tried to manually remove /etc/systemd/system/amazon-dash.service and /etc/systemd/system/multi-user.target.wants/amazon-dash.service But I can not get back to making it work anymore, now I have checked the log, and it is a continuous repetition of this error:

May 09 15:26:19 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. May 09 15:26:19 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 09 15:26:19 raspberrypi systemd[1]: amazon-dash.service: Main process exited, code=exited, status=2/INVALIDARGUMENT May 09 15:26:18 raspberrypi env[10951]: Error: Got unexpected extra argument (run) May 09 15:26:18 raspberrypi env[10951]: Usage: amazon-dash --config [OPTIONS] May 09 15:26:18 raspberrypi env[10951]: Welcome to Amazon-dash v1.0.2 using Python 3.5.3 May 09 15:26:16 raspberrypi systemd[1]: Started Amazon Dash service. May 09 15:26:16 raspberrypi systemd[1]: Stopped Amazon Dash service. May 09 15:26:16 raspberrypi systemd[1]: amazon-dash.service: Service hold-off time over, scheduling restart. May 09 15:26:13 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. May 09 15:26:13 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 09 15:26:13 raspberrypi systemd[1]: amazon-dash.service: Main process exited, code=exited, status=2/INVALIDARGUMENT May 09 15:26:13 raspberrypi env[10913]: Error: Got unexpected extra argument (run) May 09 15:26:13 raspberrypi env[10913]: Usage: amazon-dash --config [OPTIONS] May 09 15:26:13 raspberrypi env[10913]: Welcome to Amazon-dash v1.0.2 using Python 3.5.3 May 09 15:26:11 raspberrypi systemd[1]: Started Amazon Dash service. May 09 15:26:11 raspberrypi systemd[1]: Stopped Amazon Dash service. May 09 15:26:11 raspberrypi systemd[1]: amazon-dash.service: Service hold-off time over, scheduling restart. May 09 15:26:08 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. May 09 15:26:08 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 09 15:26:08 raspberrypi systemd[1]: amazon-dash.service: Main process exited, code=exited, status=2/INVALIDARGUMENT May 09 15:26:07 raspberrypi env[10874]: Error: Got unexpected extra argument (run) May 09 15:26:07 raspberrypi env[10874]: Usage: amazon-dash --config [OPTIONS] May 09 15:26:07 raspberrypi env[10874]: Welcome to Amazon-dash v1.0.2 using Python 3.5.3 May 09 15:26:05 raspberrypi systemd[1]: Started Amazon Dash service. May 09 15:26:05 raspberrypi systemd[1]: Stopped Amazon Dash service.

Nekmo commented 6 years ago

To uninstall Amazon-dash completely:

sudo pip uninstall amazon-dash
sudo rm /usr/lib/sistemd/system/amazon-dash.service
sudo rm /lib/sistemd/system/amazon-dash.service
sudo rm /etc/amazon-dash.yml

I have tried to reproduce your problem without success, I am sorry.

(amazon-dash) [nekmo@homura ~/Workspace/amazon-dash] (master)$ for i in {1..100}; do echo "Try: "$i; ./scripts/amazon-dash --verbose test-device --config amazon-dash_.yml AA:BB:33:44:55:04; done
Try: 1
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:23:56,219 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 2
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:23:57,245 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 3
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:23:58,271 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 4
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:23:59,250 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 5
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:00,421 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 6
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:01,410 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 7
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:02,403 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 8
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:03,426 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 9
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:04,410 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 10
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:05,398 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 11
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:06,359 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 12
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:07,345 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 13
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:08,353 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 14
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:09,375 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 15
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:10,388 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 16
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:11,390 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 17
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:12,351 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 18
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:13,361 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 19
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:14,324 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 20
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:15,313 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 21
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:16,320 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 22
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:17,325 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 23
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:18,308 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 24
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:19,322 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 25
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:20,330 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 26
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:21,409 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 27
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:22,424 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 28
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:23,397 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 29
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:24,414 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 30
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:25,416 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 31
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:26,416 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 32
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:27,397 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 33
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:28,384 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 34
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:29,465 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 35
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:30,506 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 36
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:31,490 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 37
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:32,483 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 38
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:33,470 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 39
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:34,474 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 40
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:35,505 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 41
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:36,485 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 42
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:37,484 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 43
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:38,472 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 44
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:39,451 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 45
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:40,452 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 46
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:41,453 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 47
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:42,442 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 48
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:43,586 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 49
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:44,573 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 50
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:45,543 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 51
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:46,557 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 52
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:47,569 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 53
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:48,560 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 54
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:49,606 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 55
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:50,728 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 56
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:51,703 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 57
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:52,703 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 58
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:53,710 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 59
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:54,712 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 60
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:55,695 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 61
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:56,726 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 62
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:57,744 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 63
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:58,756 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 64
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:24:59,769 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 65
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:00,784 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 66
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:01,789 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 67
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:02,780 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 68
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:03,803 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 69
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:04,941 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 70
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:05,937 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 71
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:06,935 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 72
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:07,942 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 73
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:08,944 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 74
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:10,081 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 75
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:11,056 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 76
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:12,048 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 77
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:13,052 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 78
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:14,069 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 79
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:15,069 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 80
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:16,044 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 81
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:17,075 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 82
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:18,044 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 83
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:19,053 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 84
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:20,078 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 85
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:21,079 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 86
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:22,078 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 87
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:23,101 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 88
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:24,130 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 89
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:25,122 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 90
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:26,131 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 91
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:27,133 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 92
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:28,131 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 93
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:29,149 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 94
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:30,190 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 95
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:31,179 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 96
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:32,169 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 97
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:33,275 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 98
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:34,292 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 99
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:35,354 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
Try: 100
Welcome to Amazon-dash v1.0.2 using Python 3.6.3
2018-05-09 21:25:36,467 - amazon-dash - DEBUG   - Url test 1 device executed (mac aa:bb:33:44:55:04)
areknames96 commented 6 years ago

I formatted the sd of the raspberry, I flashed a clean raspbian again, and I did only the following things: 1- Updated pip 2- Installed scapy 3- Installed amazon-dash 4- Started amazon dash 5- I saw the log, which I paste: May 10 11:35:56 raspberrypi env[1094]: Listening for events. Amazon-dash will execute the events associated with the registered buttons. May 10 11:35:56 raspberrypi env[1094]: Welcome to Amazon-dash v1.0.2 using Python 2.7.13 May 10 11:35:55 raspberrypi systemd[1]: Started Amazon Dash service. May 10 11:35:55 raspberrypi systemd[1]: Stopped Amazon Dash service. May 10 11:35:55 raspberrypi systemd[1]: amazon-dash.service: Service hold-off time over, scheduling restart. May 10 11:35:52 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. May 10 11:35:52 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 10 11:35:52 raspberrypi systemd[1]: amazon-dash.service: Main process exited, code=exited, status=1/FAILURE May 10 11:35:51 raspberrypi env[1088]: ImportError: No module named subprocess32 May 10 11:35:51 raspberrypi env[1088]: import subprocess32 as subprocess May 10 11:35:51 raspberrypi env[1088]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in May 10 11:35:51 raspberrypi env[1088]: from amazon_dash._compat import JSONDecodeError May 10 11:35:51 raspberrypi env[1088]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in May 10 11:35:51 raspberrypi env[1088]: from amazon_dash.confirmations import get_confirmation May 10 11:35:51 raspberrypi env[1088]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in May 10 11:35:51 raspberrypi env[1088]: from amazon_dash.listener import Listener May 10 11:35:51 raspberrypi env[1088]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 99, in run May 10 11:35:51 raspberrypi env[1088]: return callback(args, kwargs) May 10 11:35:51 raspberrypi env[1088]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke May 10 11:35:51 raspberrypi env[1088]: return ctx.invoke(self.callback, ctx.params) May 10 11:35:51 raspberrypi env[1088]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke May 10 11:35:51 raspberrypi env[1088]: return _process_result(sub_ctx.command.invoke(sub_ctx)) May 10 11:35:51 raspberrypi env[1088]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke May 10 11:35:51 raspberrypi env[1088]: rv = self.invoke(ctx) May 10 11:35:51 raspberrypi env[1088]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main May 10 11:35:51 raspberrypi env[1088]: return self.main(args, kwargs) May 10 11:35:51 raspberrypi env[1088]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call May 10 11:35:51 raspberrypi env[1088]: return fn(*args, *kwargs) May 10 11:35:51 raspberrypi env[1088]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap May 10 11:35:51 raspberrypi env[1088]: catch(cli)() May 10 11:35:51 raspberrypi env[1088]: File "/usr/local/bin/amazon-dash", line 6, in May 10 11:35:51 raspberrypi env[1088]: Traceback (most recent call last): May 10 11:35:39 raspberrypi env[1088]: Listening for events. Amazon-dash will execute the events associated with the registered buttons. May 10 11:35:39 raspberrypi env[1088]: Welcome to Amazon-dash v1.0.2 using Python 2.7.13 May 10 11:35:38 raspberrypi systemd[1]: Started Amazon Dash service. May 10 11:35:38 raspberrypi systemd[1]: Stopped Amazon Dash service. May 10 11:35:38 raspberrypi systemd[1]: amazon-dash.service: Service hold-off time over, scheduling restart. May 10 11:35:35 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. May 10 11:35:35 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 10 11:35:35 raspberrypi systemd[1]: amazon-dash.service: Main process exited, code=exited, status=1/FAILURE May 10 11:35:34 raspberrypi env[1076]: ImportError: No module named subprocess32 May 10 11:35:34 raspberrypi env[1076]: import subprocess32 as subprocess May 10 11:35:34 raspberrypi env[1076]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in May 10 11:35:34 raspberrypi env[1076]: from amazon_dash._compat import JSONDecodeError May 10 11:35:34 raspberrypi env[1076]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in May 10 11:35:34 raspberrypi env[1076]: from amazon_dash.confirmations import get_confirmation May 10 11:35:34 raspberrypi env[1076]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in May 10 11:35:34 raspberrypi env[1076]: from amazon_dash.listener import Listener May 10 11:35:34 raspberrypi env[1076]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 99, in run May 10 11:35:34 raspberrypi env[1076]: return callback(args, kwargs) May 10 11:35:34 raspberrypi env[1076]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke May 10 11:35:34 raspberrypi env[1076]: return ctx.invoke(self.callback, ctx.params) May 10 11:35:34 raspberrypi env[1076]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke May 10 11:35:34 raspberrypi env[1076]: return _process_result(sub_ctx.command.invoke(sub_ctx)) May 10 11:35:34 raspberrypi env[1076]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke May 10 11:35:34 raspberrypi env[1076]: rv = self.invoke(ctx) May 10 11:35:34 raspberrypi env[1076]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main May 10 11:35:34 raspberrypi env[1076]: return self.main(*args, *kwargs) May 10 11:35:34 raspberrypi env[1076]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call May 10 11:35:34 raspberrypi env[1076]: return fn(args, kwargs) May 10 11:35:34 raspberrypi env[1076]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap

pi@raspberrypi:/etc $ sudo journalctl -r -u amazon-dash -- Logs begin at Wed 2018-04-18 01:24:23 UTC, end at Thu 2018-05-10 11:40:00 UTC. -- May 10 11:39:54 raspberrypi env[1143]: Listening for events. Amazon-dash will execute the events associated with the registered buttons. May 10 11:39:54 raspberrypi env[1143]: Welcome to Amazon-dash v1.0.2 using Python 2.7.13 May 10 11:39:53 raspberrypi systemd[1]: Started Amazon Dash service. May 10 11:39:53 raspberrypi systemd[1]: Stopped Amazon Dash service. May 10 11:39:53 raspberrypi systemd[1]: amazon-dash.service: Service hold-off time over, scheduling restart. May 10 11:39:50 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. May 10 11:39:50 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 10 11:39:50 raspberrypi systemd[1]: amazon-dash.service: Main process exited, code=exited, status=1/FAILURE May 10 11:39:50 raspberrypi env[1139]: ImportError: No module named subprocess32 May 10 11:39:50 raspberrypi env[1139]: import subprocess32 as subprocess May 10 11:39:50 raspberrypi env[1139]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in May 10 11:39:50 raspberrypi env[1139]: from amazon_dash._compat import JSONDecodeError May 10 11:39:50 raspberrypi env[1139]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in May 10 11:39:50 raspberrypi env[1139]: from amazon_dash.confirmations import get_confirmation May 10 11:39:50 raspberrypi env[1139]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in May 10 11:39:50 raspberrypi env[1139]: from amazon_dash.listener import Listener May 10 11:39:50 raspberrypi env[1139]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 99, in run May 10 11:39:50 raspberrypi env[1139]: return callback(args, kwargs) May 10 11:39:50 raspberrypi env[1139]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke May 10 11:39:50 raspberrypi env[1139]: return ctx.invoke(self.callback, ctx.params) May 10 11:39:50 raspberrypi env[1139]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke May 10 11:39:50 raspberrypi env[1139]: return _process_result(sub_ctx.command.invoke(sub_ctx)) May 10 11:39:50 raspberrypi env[1139]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke May 10 11:39:50 raspberrypi env[1139]: rv = self.invoke(ctx) May 10 11:39:50 raspberrypi env[1139]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main May 10 11:39:50 raspberrypi env[1139]: return self.main(args, kwargs) May 10 11:39:50 raspberrypi env[1139]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call May 10 11:39:50 raspberrypi env[1139]: return fn(*args, *kwargs) May 10 11:39:50 raspberrypi env[1139]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap May 10 11:39:50 raspberrypi env[1139]: catch(cli)() May 10 11:39:50 raspberrypi env[1139]: File "/usr/local/bin/amazon-dash", line 6, in May 10 11:39:50 raspberrypi env[1139]: Traceback (most recent call last): May 10 11:39:37 raspberrypi env[1139]: Listening for events. Amazon-dash will execute the events associated with the registered buttons. May 10 11:39:37 raspberrypi env[1139]: Welcome to Amazon-dash v1.0.2 using Python 2.7.13 May 10 11:39:36 raspberrypi systemd[1]: Started Amazon Dash service. May 10 11:39:36 raspberrypi systemd[1]: Stopped Amazon Dash service. May 10 11:39:36 raspberrypi systemd[1]: amazon-dash.service: Service hold-off time over, scheduling restart. May 10 11:39:33 raspberrypi systemd[1]: amazon-dash.service: Failed with result 'exit-code'. May 10 11:39:33 raspberrypi systemd[1]: amazon-dash.service: Unit entered failed state. May 10 11:39:33 raspberrypi systemd[1]: amazon-dash.service: Main process exited, code=exited, status=1/FAILURE May 10 11:39:32 raspberrypi env[1136]: ImportError: No module named subprocess32 May 10 11:39:32 raspberrypi env[1136]: import subprocess32 as subprocess May 10 11:39:32 raspberrypi env[1136]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/_compat.py", line 18, in May 10 11:39:32 raspberrypi env[1136]: from amazon_dash._compat import JSONDecodeError May 10 11:39:32 raspberrypi env[1136]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/confirmations.py", line 5, in May 10 11:39:32 raspberrypi env[1136]: from amazon_dash.confirmations import get_confirmation May 10 11:39:32 raspberrypi env[1136]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/listener.py", line 6, in May 10 11:39:32 raspberrypi env[1136]: from amazon_dash.listener import Listener May 10 11:39:32 raspberrypi env[1136]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 99, in run May 10 11:39:32 raspberrypi env[1136]: return callback(args, kwargs) May 10 11:39:32 raspberrypi env[1136]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 534, in invoke May 10 11:39:32 raspberrypi env[1136]: return ctx.invoke(self.callback, ctx.params) May 10 11:39:32 raspberrypi env[1136]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 889, in invoke May 10 11:39:32 raspberrypi env[1136]: return _process_result(sub_ctx.command.invoke(sub_ctx)) May 10 11:39:32 raspberrypi env[1136]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke May 10 11:39:32 raspberrypi env[1136]: rv = self.invoke(ctx) May 10 11:39:32 raspberrypi env[1136]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 696, in main May 10 11:39:32 raspberrypi env[1136]: return self.main(*args, *kwargs) May 10 11:39:32 raspberrypi env[1136]: File "/usr/lib/python2.7/dist-packages/click/core.py", line 716, in call May 10 11:39:32 raspberrypi env[1136]: return fn(args, kwargs) May 10 11:39:32 raspberrypi env[1136]: File "/usr/local/lib/python2.7/dist-packages/amazon_dash/exceptions.py", line 91, in wrap

It must be a problem

areknames96 commented 6 years ago

Finally I came to a conclusion, on raspbian stretch with python 2.7, amazon-dash does not work from version 1.0.0 onwards. On a clean installation of raspbian stretch I installed version 1.0.2 and it did not work, it showed the errors I pasted some comments ago. The same thing happens with version 1.0.0. Finally I tried with a version 0.4.1 (the same version that I installed a few months ago), and in fact this version worked. It works but not very well, because I always find the same error, I can not configure more than one homeassistant event in configuration.yaml. I think this problem is limited to version 0.4.1, since you do not find the same problem, certainly because you use the latest version of amazon-dash. So now we need to understand why the 1.0.0 versions do not work on a clean installation of raspbian stretch ... out of curiosity, could I know what hardware and firmware you are running your amazon-dash?

Nekmo commented 6 years ago

Arch Linux x86_64. Intel i7 3770K. But I also use Amazon-dash on a Raspberry PI B +.

areknames96 commented 6 years ago

With raspbian?

Nekmo commented 6 years ago

Also with Arch Linux. But that should not matter. If the problem could be reproduced 100% of the time, it would be easy to fix it. But it's rare that you say it's random.

Nekmo commented 6 years ago

Closed due to inactivity.