i have the following situation: A hacked amazon dash button, from which i am able to send HTTP requests (with a bit of firewall magic in my router and dnsmasq’s dhcp-script feature). Now i could use this dash button to manually set the state of a device via HA’s HTTP API. But i don’t like this situation, since i am wiring the button to a device outside of HA’s automation and script logic.
So i’d like to ask how to achieve this goal from within Home Assistant. Is there some kind of HTTP enabled dummy component, like a switch, and i can say that “everytime a request is made to $api_endpoint, toggle the switch”?
I was also thinking about connecting the dash button to MQTT, maybe with a script like “if the button is pressed, send an ON to the topic, wait 10 seconds and send an OFF to the topic”, but unfortunately there is no mqtt_pub package for OpenWRT which is the OS of my router and detects the wakeup of the Dash after button press.
Has anyone a similar setup, like a hardware device which makes a single HTTP request when activated, and only when activated, and figured how one can integrate this device into Home Assistant?
Hey, this is a pretty old post, but maybe still relevant
I also don’t have a solution for your question, but I guess after 4 years it’s irrelevant anyway - but I am wondering about your setup to get as far as you are. Did you just set up your own DHCP-Server using dnsmasq on a Raspberry Pi or something, and redefine the IPs that are behind the links that the Dash-Button is requesting? If so, how do you know which adress the Button is requesting? Is it just going to some “http://amazon.com/dashbutton23492349” or something, and you can just put the amazon-URL in hosts-file? Or how do I figure out what the button actually is requesting?
The basic gist of the dash buttons is that they stay dormant until needed. DHCP is handled however through whatever server you use. Then you have a monitor that just sits and looks for the request coming from the specific IP. At that point it knows that the button was pushed and it acts upon it.
No special magic, just a program that sits and wait. When it sees a request it calls the Home Assistant API.