Nekmo / amazon-dash

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

HTTPS & Api Password on Homeassistant #62

Closed nicomda closed 6 years ago

nicomda commented 6 years ago

Description

Most of the people using Homeassistant has https enabled and an API password. You should implement entries to be able to configure both things on each dash. In addition would be cool if we could set the port, cause lot of people has an instance of Homeassistant not in the default port.

What I Did

I modified execute.py but I'm really new on Python, so it's really difficult for me to add the 2 vars and upload fix. Can you fix it?. It's working for me now. If the POST is something like "https://localhost:8123/api/events/YOUR_EVENT_NAME?api_password=YOURPASSWORD

Thank you for the soft! Is just awesome, really easy to use. Really simple interface 👍

Nekmo commented 6 years ago

Amazon-dash already includes an access option (x-ha-access header). Can you confirm if that option works? This option is not documented (this is an mistake). It will be solved in the next version.

You can define the protocol and the port in the homeassistant option. For example:

40:B4:CD:67:A2:E1:
    name: Fairy
    homeassistant: https://hassio.local:1234  
    event: toggle_kitchen_light  

This feature is not documented. This will be added to the documentation in the next version of Amazon-dash.

Thank you.

Nekmo commented 6 years ago

This is documented, but there is no example of syntax.

nicomda commented 6 years ago

So fast! But not yet considering the addition of the API password at the end of the POST string. ?api_password=YOURPASSWORD

Nekmo commented 6 years ago

You can set your Homeassistant password using the access option. This feature is already included in the latest version of Amazon Dash. http://docs.nekmo.org/amazon-dash/config_file.html#homeassistant-event

The GET parameter api_password works like x-ha-access header according to the documentation. https://developers.home-assistant.io/docs/en/external_api_rest.html

However, it is advisable to define the password using the header. The url with the password can be logged into a file, such as a proxy server.

manuelgorman commented 6 years ago

When I add the "access" option, amazon-dash stops picking up my dash button press altogether, and shows nothing in the log. If I leave it out, it crashes and restarts after getting a 401 from my HA server.

Nekmo commented 6 years ago

@manuelgorman you need to use the --debug parameter to see each time you press the button: http://docs.nekmo.org/amazon-dash/usage.html#manually

Nekmo commented 6 years ago

Closed due to inactivity.