Closed ardeus-ua closed 6 years ago
Hello, this is not implemented on the current version. But I can implement it. Give me a moment.
Now available in version 0.4.2. Thanks for your issue :)
Please close the report if it works well for you.
I guess I was initially wrong with the configuraton. I need "x-ha-access: YOUR_PASSWORD" header to be sent as a one field. And I guess it can be added to HA action config. Is this possible to have it similar to https://github.com/danimtb/dasshio like
"domain": "light",
"service": "toggle",
"service_data": "{\"entity_id\": \"light.room_light\"}"
In theory with the latest version it should be possible using your own example:
name: Basics
url: 'http://ha_ip:8123/api/services/switch/toggle'
method: post
headers: {"x-ha-access": "ha_password"}
content-type: json
body: '{"entity_id": "light.hall"}'
Latest release: https://github.com/Nekmo/amazon-dash/releases/tag/v0.4.2 Commit: https://github.com/Nekmo/amazon-dash/commit/5bfbd2c09159344e538504b1e4005f9f5961756e
Let me know if you have problems.
Greetings
I have 401 with the example including {"x-ha-access: ha_password"} And 400 with the example including {"x-ha-access": "ha_password"}
Have you updated Amazon-dash to the latest version? Update it using:
pip install -U amazon-dash
For test the execution run on other console:
nc --listen localhost -p 8123 -v
And change ha_ip
to localhost
on your amazon-dash configuration.
With this you can see what your Home Assistant server receives.
nc --listen localhost -p 8123 -v
nc: invalid option -- '-'
usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-O length]
[-P proxy_username] [-p source_port] [-q seconds] [-s source]
[-T toskeyword] [-V rtable] [-w timeout] [-X proxy_protocol]
[-x proxy_address[:port]] [destination] [port]
I have updated Amazon-dash and changed ip to localhost before restarting the service. Service status shows: 2018-02-26 21:28:52,838 - amazon-dash - WARNING - "http://localhost:8123/api/services/light/toggle" return code 401.
Try to change nc
to netcat
. If you do not have it installed you will have to install it. If you are running Home Assistant on the same machine, also change the port to test. For example:
netcat --listen localhost -p 8000 -v
Change it also in your config:
name: Basics
url: 'http://localhost:8000/api/services/switch/toggle'
method: post
headers: {"x-ha-access": "ha_password"}
content-type: json
body: '{"entity_id": "light.hall"}'
You can test it without restart the service:
sudo amazon-dash test-device <mac address>
Sometimes by cache or by being too recent Pypi does not install the latest version. Make sure your version is correct by running:
pip list | grep amazon-dash
It worked! Here's the config I have used
DASH_MAC:
name: Basics
url: 'http://localhost:8123/api/services/light/toggle'
method: post
content-type: json
headers: {"x-ha-access": "api_password"}
body: '{"entity_id": "light.hall"}'
Thank you very much!
You are welcome :)
This feature has been included in the development branch.
DASH_MAC: name: Basics url: 'http://localhost:8123/api/services/light/toggle' method: post content-type: json headers: {"x-ha-access": "api_password"} body: '{"entity_id": "light.hall"}'
Is there a way to fire an hass event with this writing?
Change 'http://localhost:8123/api/services/light/toggle
to 'http://localhost:8123/api/events/<event name>
Is there a way to pass authorization to Home Assistant?
Gave me 401 error