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

How to get dasshio to connect to HA IP address #110

Open brucemiranda opened 1 year ago

brucemiranda commented 1 year ago

Currently I have my dash buttons recognised but they appear to be calling a URL starting with http://hassio/homeassistant/ e.g. In the log I can see a call to http://hassio/homeassistant/api/services/media_player/toggle but then I get a 500 Bad Request.

On my local network I cannot access my Home Assistant using http://hassio/homeassistant I need to use the IP address http://192.168.1.11:8123

So how do I get either Home Assistant or Dasshio changed so that they can work with each other?

suheilpurewal commented 1 year ago

were you ever able to figure this out? just started trying to set this up and realized i'm running into the same problem.

brucemiranda commented 1 year ago

No. I cannot find any information on how to change the base url used by dasshio without running the entire component locally and editing the code to suit me

brucemiranda commented 1 year ago

I just simply could not figure out how to change the Base URL that is used to access the internal api. So I solved this by using the full external REST API URL, with an Access token.

example.

- name: dash_airwick
  address: 50:f5:da:b7:f4:fc
  url: http://192.168.1.11:8123/api/services/media_player/media_play_pause
  headers: >-
    {"Authorization": "Bearer TOKEN",
    "content-type": "application/json"}
  body: "{\"entity_id\": \"media_player.study_player\"}"
danimtb commented 1 year ago

Thanks for posting here the solution!

I was checking this and it seems that the internal URL for add-ons to contact HA changed: https://developers.home-assistant.io/docs/add-ons/communication/#home-assistant-core

Anyway, this can be solved as you did use the API URL directly.

Please, keep in mind that I am no longer maintaining this addon as Amazon Dash Buttons stopped working for me after Amazon discontinued them and "bricked" them on purpose. If you are still doing fine with the buttons and this addon, please let me know and I'll try to give at least some minimum support to this addon. Thank you :)

brucemiranda commented 1 year ago

Thanks for posting here the solution!

I was checking this and it seems that the internal URL for add-ons to contact HA changed: https://developers.home-assistant.io/docs/add-ons/communication/#home-assistant-core

Anyway, this can be solved as you did use the API URL directly.

Please, keep in mind that I am no longer maintaining this addon as Amazon Dash Buttons stopped working for me after Amazon discontinued them and "bricked" them on purpose. If you are still doing fine with the buttons and this addon, please let me know and I'll try to give at least some minimum support to this addon. Thank you :)

Would it be possible to make the internal URL and token used by this add-on a configuration or yaml item. You can prefill it with what you expect, rather than use the BASE_URL environment variable as your default. I do use your add-on a lot so would be very appreciative if you could make this change so that it stays a bit future proof.