andgineer / docker-amazon-dash-button-hack

Amazon Dash Button hack in Docker for Synology
http://masterandrey.com/posts/en/amazon_dash_button/
11 stars 8 forks source link

setting up with ifttt #3

Closed fun4stuff closed 7 years ago

fun4stuff commented 7 years ago

So I think I have it up and running in docker on my synology NAS. I only want to use the button to trigger IFTTT events using webhooks. Just looking for some clarification on getting it to work with IFTTT.

Within settings.json under the ifttt section, what are value1, value2, and value3 used for? Thanks again

fun4stuff commented 7 years ago

nevermind, i see this is answered here: https://maker.ifttt.com/use/--removed secret key--

i'm still having trouble getting it to work with ifttt. If I only want to use the dash button with ifttt, would the following settings.json work (event name to use with ifttt: button_pushed)?

{ "credentials_file_name": "../amazon-dash-private/amazon-dash-hack.json", "ifttt_key_file_name": "../amazon-dash-private/ifttt-key.json",

"actions": { "white": { "summary": "button_pushed", "actions": [ { "type": "ifttt", "summary": "button_pushed", "value1": "", "value2": "", "value3": "" } ] } } }

fun4stuff commented 7 years ago

currently getting this in the log when I push the dash button:

button white pressed stdout 22:45:55 Event for ifttt: ({'value2': '', 'value3': '', 'value1': '', 'type': 'ifttt', 'summary': 'button_pushed'}) stdout 22:45:55 Traceback (most recent call last): stdout 22:45:55 File "amazon_dash.py", line 72, in stdout 22:45:55 main() stdout 22:45:55 File "amazon_dash.py", line 68, in main stdout 22:45:55 sniff(prn=arp_handler, filter="arp", store=0) stdout 22:45:55 File "/usr/lib/python3.5/site-packages/scapy/sendrecv.py", line 599, in sniff stdout 22:45:55 r = prn(p) stdout 22:45:55 File "amazon_dash.py", line 50, in arp_handler stdout 22:45:55 trigger(buttons[pkt[ARP].hwsrc]) stdout 22:45:55 File "amazon_dash.py", line 60, in trigger stdout 22:45:55 Action(settings).action(button) stdout 22:45:55 File "/amazon_dash/action.py", line 87, in action stdout 22:45:55 ACTION_HANDLERS[act['type']](button, act) stdout 22:45:55 File "/amazon_dash/action.py", line 90, in ifttt_action stdout 22:45:55 ifttt = Ifttt(self.settings) stdout 22:45:55 File "/amazon_dash/ifttt.py", line 12, in init stdout 22:45:55 self.key_file = self.load_key() stdout 22:45:55 File "/amazon_dash/ifttt.py", line 16, in load_key stdout 22:45:55 with open(self.settings['ifttt_key_file_name'], 'r') as key_file: stdout 22:45:55 KeyError: 'ifttt_key_file_name'

WARNING: No route found for IPv6 destination :: (no default route?). This affects only IPv6 stdout
andgineer commented 7 years ago

Before you can use IFTTT with your buttons you should place secret key into ifttt-key.json file. In Maker Webhook applet get URL, open it and you will see your key at the top of the page (Your key is:).

Value1, Value2, Value3 from the button action you can use in IFTTT like {{Value1}}.

http://masterandrey.com/posts/en/amazon_dash_button_hack_install/

The exact error from your log means that there are no ifttt_key_file_name parameter in your settings file. This parameter exists in sample file - may be you removed or renamed it accidentally? If you cannot solve the problem please post here your settings.json file.

fun4stuff commented 7 years ago

Yay got it pretty much working. Only issue I'm having is it only seems to be detecting the button pushes half the time or so.

When it detects the press, it reports it in the container log within docker.

However, there are times where I press the button and I see the light on the button blink and I get a pop up message on my phone from the Amazon app telling me to complete the setup process, so I know the button is connecting to wifi. But, there's nothing posted in the logs about the button being pressed.

I don't think it matters, but here's my settings.json: https://pastebin.com/u0umhrg0

andgineer commented 7 years ago

May be something wrong with the server that running the docker? I use it for months and the only problems that I had were because of docker auto-update on Synology. After auto-update Synology do not restart docker containers.

So I switched auto-update off for docker Synology package and now everything works like a charm.. I added this in the manual http://masterandrey.com/posts/en/amazon_dash_button_hack_install/