Dash Button in different WiFi

Hello,

I was thinking about adding a Amazon Dash Button to my setup, but learned it must be used in the same Wifi. That does not work for me. The use case is as follows.

I have a robo lawn mower. My neighbour is complaining about its to noise. I had the idea giving him a dash button to be run in his wifi. Its connected to my OH setup and send the lawn mower back home to its charging station for the rest of the day. Each time he feels annoyed he can press the button and the problem is solved.

This required the dash button to be connected in his WiFi. I understand this setup will not work. Anyone doing it differently? I can think of a lambda tirggered in AWS by the dash button and the lambda will set an item in my OH instance, a rule fireing sending the mower home. Should not be so difficult, except I dont know how to do that.

I implemented lambdas before, thats not the problem. But how to let this lambda from security perspective connect to my OH instance. Any idea? Via myopenhab.org?

Any idea appreciated. Or any other technical solution which I can think of for that use case?

looking forward to your thoughts.

Regards
Ralf

There should be information in here, but I have no experience…

https://www.openhab.org/docs/ecosystem/alexa/

Have you actually verified that your wifi isn’t reachable from his house? Around here I can reach my neighbor’s wifi no problem and that would eliminate the need to jump through all the extra hoops.

The problem with Dash button detection is in how it works. When the Dash button is pressed it tries to join the configured network. The first thing it does is send out an ARP request. It is the detection of this ARP request that drives all the Dash button scripts, bindings, and software out there.

The problem is that this ARP request never leaves the LAN. It shouldn’t because the whole purpose of ARP requests is asking “Which hardware address should I send packets for IP address XXX.XXX.XXX.XXX?” The request and response only makes sense on the local network. In fact, it is even more constrained because it only applies to devices connected to the same router.

The only chance you will be able to have at making this work is if you put a device (e.g. Raspberry Pi or ESP) on his network in promiscuous mode to listen for these ARP packets. Then that device will issue the command/update to your OH.

I just want to provide an explanation for “will not work” for future readers.

I’ll assume you know how to get the Dash button to call your lambda (that’s pretty cool actually, I didn’t know you could do that). So I’ll focus on your security perspective question.

Your hunch is correct. Use myopenhab.org. The openHAB Cloud Server hosted by myopenhab.org acts as a proxy to openHAB’s REST API. If you can do it through a UI, there is a REST call you can make from your lambda and myopenhab.org will forward that request and subsequent response through to your openHAB server and back.

If you have openHAB exposed to the Internet directly (for the love of Pete why!?) or through a reverse proxy, the same applies. You can make a REST API call. Install the REST Docs add-on from the UI tab in PaperUI (note, this was formerly located in the Misc tab). All the calls are there and it’s interactive so you can experiment. You probably want to use the items/itemname endpoint with a PUT or POST.

myopenhab.org supports basic auth so you can supply the username and password as part of the url

http://<username>:<password>@myopenhab.org/items/GoHomeMower

what about 2.4mhz ?
i am getting things from my garden to my sonoff RF with no issues even with walls
so maybe put a butten on your fance , that will send somthing to the home?

you an put the RF gate as close as possible to your nigber hosue , i am pretty sure it will pick the singal …
you just need to make sure the RF gate has some wifi

What devices use 2.4 MHz? Why would you choose a licensed mobile frequency?

Very helpful, as always. Big thank you. Which user and password? From myopenhab.org? This username requires to be an email adress . I tried to test it with curl with little success

$ curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://50liter@bierspen.de:secret@myopenhab.org/rest/items/ItemName
curl: (3) Illegal port number

ok, found encoding

curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://50liter%40bierspen.de:secret@myopenhab.org/rest/items/Light_GF_Stehlampen"
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx/1.10.0 (Ubuntu)</center>
</body>
</html>

Heureka, got it

$ curl -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "https://50liter%40bierspen.de:secret@home.myopenhab.org/rest/items/Light_GF_Stehlampen"

It works. Overall. This is so cool.

This is the lambda

import json
from botocore.vendored import requests
import logging

logger = logging.getLogger()
logger.setLevel(logging.DEBUG)

def lambda_handler(event, context):
    url = 'https://user:password@home.myopenhab.org/rest/items/MowerHome'
    response = requests.post(url,
        data="ON",                         
        headers={'content-type':'text/plain'},
        )

    logger.debug('Response is a = {}'.format(response.text))
    return True

Be sure to escape the @ in the user name with %40. email@adress.com becomes email%40adress.com.

It works like a charm. I have now an AWS Dash/IoT button which triggers the above lambda function. This lambda uses REST API via myopenhab.org. A rule fires on ON and off we go.

rule "Send Schafi Home via Dash Button"
when
    Item MowerHome changed to ON
then
    logWarn(logName, "Mower send home via dash button")
    mowerMode.sendCommand("EOD")
    timer = createTimer(now.plusSeconds(10)) [|
        logInfo(logName, "  Turn off MowerHome VirtualItem")
        sendCommand(MowerHome, OFF)
    ]
end

Special thanks to Rich!

ops its early :slight_smile:
menat to say 433
just basic switches from Ali, and somekind of bridge

1 Like