danimtb / dasshio

Hass.io add-on to easily use Amazon Dash Buttons with Home Assistant
Apache License 2.0
192 stars 63 forks source link

400 Bad Request from Homeassistant API #105

Closed Floppy closed 3 years ago

Floppy commented 3 years ago

I've set up dasshio as documented, and the buttons are working fine with dasshio itself, but when it connects to the HA API, I'm getting a 400.

timeout: 20
buttons:
  - address: 'AC:63:BE:08:43:0E'
    name: Dash Button 430E
    domain: automation
    service: trigger
    service_data: '{"event_id": "automation.dash_button_430e"}'
2021-05-11 17:26:03,075 | INFO | Starting sniffing...
2021-05-11 17:29:49,624 | INFO | Dash Button 430E button pressed!
2021-05-11 17:29:49,724 | INFO | Request: http://hassio/homeassistant/api/services/automation/trigger - body: {"event_id": "automation.dash_button_430e"}
2021-05-11 17:29:49,726 | INFO | Status Code: 400
2021-05-11 17:29:49,728 | ERROR | Bad request
2021-05-11 17:29:49,776 | INFO | Finishing sniffing

Having had a look at the Add-on Communication docs, that URL looks suspicious. The HA docs discuss using http://supervisor/core/api as the base URL, rather than hassio. I'm fairly new to Home Assistant so I'm not sure if this is a change since the dasshio docs were written, or if I'm looking at things wrong. Any help would be much appreciated!

I've tried setting url but that looks like it's taking over the entire HTTP request so I need to specify everything manually, which isn't quite what I had in mind.

Floppy commented 3 years ago

I'm an idiot. I had event_id instead of entity_id. It works fine.