Nekmo / amazon-dash

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

jsonschema has been updated to 3.0.0 (incompatible update) #130

Closed Zachary3352 closed 5 years ago

Zachary3352 commented 5 years ago

Put an x into all the boxes [ ] relevant to your issue (like this: [x])

What is the purpose of your issue?

Description

I'm trying to install Amazon Dash on my Raspberry Pi. I've gotten pretty far, but it wasn't working correctly when I just started the utility, so I did a little more digging...

What I Did

I tried running sudo amazon-dash check-config --config /etc/amazon-dash.yml and here's what comes up: Welcome to Amazon-dash v1.3.2 using Python 2.7.9 Traceback (most recent call last): File "/usr/local/bin/amazon-dash", line 6, in <module> 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 764, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/amazon_dash/management.py", line 109, in check_config from amazon_dash.config import check_config File "/usr/local/lib/python2.7/dist-packages/amazon_dash/config.py", line 7, in <module> from jsonschema import validate, ValidationError File "/usr/local/lib/python2.7/dist-packages/jsonschema/__init__.py", line 12, in <module> from jsonschema.exceptions import ( File "/usr/local/lib/python2.7/dist-packages/jsonschema/exceptions.py", line 141, in <module> @attr.s(hash=True) AttributeError: 'module' object has no attribute 's'

When I run sudo systemctl status amazon-dash here's what I get: ● amazon-dash.service - Amazon Dash service Loaded: loaded (/usr/lib/systemd/system/amazon-dash.service; disabled) Active: activating (auto-restart) (Result: exit-code) since Sat 2019-03-02 03:24:03 EST; 627ms ago Process: 19691 ExecStart=/usr/bin/env amazon-dash run --config /etc/amazon-dash.yml (code=exited, status=1/FAILURE) Main PID: 19691 (code=exited, status=1/FAILURE)

I would really appreciate your help trying to solve these issues! Thanks!

Nekmo commented 5 years ago

Try installing jsonschema 2.6.0:

pip install jsonschema==2.6.0

A new version has been released recently and may have broken the backward compatibility.

Zachary3352 commented 5 years ago

Thanks for your help. This seems to have made the issue a bit better, but I'm still having some other issues.

First, how do I turn debugging/logging on? I've tried amazon-dash run* --info and amazon-dash --info run* but neither of them are working. I thought this was how I was supposed to do it, but if you could please tell me the correct way I would really appreciate it.

Back to the original question: Now, my config checks out, so that's great, but when I run sudo systemctl status amazon-dash I get this most of the time: sudo systemctl status amazon-dash ● amazon-dash.service - Amazon Dash service Loaded: loaded (/usr/lib/systemd/system/amazon-dash.service; disabled) Active: activating (auto-restart) (Result: exit-code) since Sun 2019-03-03 23:03:10 EST; 51ms ago Process: 23284 ExecStart=/usr/bin/env amazon-dash run --config /etc/amazon-dash.yml (code=exited, status=1/FAILURE) Main PID: 23284 (code=exited, status=1/FAILURE) But I get this some of the time (maybe one in five times): sudo systemctl status amazon-dash ● amazon-dash.service - Amazon Dash service Loaded: loaded (/usr/lib/systemd/system/amazon-dash.service; disabled) Active: active (running) since Sun 2019-03-03 23:03:13 EST; 269ms ago Main PID: 23312 (amazon-dash) CGroup: /system.slice/amazon-dash.service └─23312 /usr/bin/python /usr/local/bin/amazon-dash run --config /etc/amazon-dash.yml Mar 03 23:03:13 raspberrypi2 systemd[1]: Started Amazon Dash service. Mar 03 23:03:13 raspberrypi2 env[23312]: Welcome to Amazon-dash v1.3.2 using Python 2.7.9 Mar 03 23:03:13 raspberrypi2 env[23312]: Listening for events. Amazon-dash will execute the events associated with the registered buttons.

Unfortunately, no matter what, it doesn't seem like my commands are being sent. I get the notification on my phone that Amazon wants me to complete button setup, so I know the button is working right. I've also confirmed my MAC address is correct. Here's my config for IFTTT in amazon-dash.yml:

[REDACTED]: name: LIFX ifttt: [REDACTED] event: light data: {}

Does this code look right? If so, might you know what's going on? I really appreciate your help. Thanks!

Nekmo commented 5 years ago

You have to remove the asterisk (*) from the run command.

Zachary3352 commented 5 years ago

Here's what I get when I run sudo amazon-dash run --info: Welcome to Amazon-dash v1.3.2 using Python 2.7.9 Usage: amazon-dash run [OPTIONS] Try "amazon-dash run --help" for help. Error: no such option: --info

Am I making another mistake? Thank you for your help!

Nekmo commented 5 years ago

Use amazon-dash --info run instead amazon-dash run --info

Zachary3352 commented 5 years ago

Thanks! The command seems to run now. I'm not at home right now, but when I am I'll try it with a button and let you know if it works.

BTW, for anyone looking later at this string, Amazon Dash uses Python 2.7 for me, so I had to change the last line in my _compat.py by removing "subprocess32 as" and that fixed it for me. If you have trouble doing this, please let me know and I can help you.

Zachary3352 commented 5 years ago

Everything is working! Thanks again @Nekmo for your help.

Nekmo commented 5 years ago

Thanks! I will fix the requeriment in the next version.