Testing LANNouncer – Curl Examples

There’s a lot that can go wrong when trying to get LANNouncer running.  The top few items have their own sections – things such as not having the correct (static) IP Address or even an open port.  Other things are more subtle, and it can be reassuring and helpful to get it working bit-by-bit.  This section is designed to help with that.

Goal

The goal of this section is to help you be able to test LANNouncer without any other dependencies.  No SmartThings, no IFTTT.  Once you have LANNouncer working, and can prove it, the rest is easier to verify.

Micro-Introduction To curl

“curl” is a tool for performing internet (web) requests at the command line.  We’re going to use curl because it’s fast, simple (relatively), and can be automated in batch files or scripts, so what we do here you can later do for automation.

You can read about curl in the Wikipedia article here.  Your computer (Windows or Mac) probably already has curl, but if it doesn’t, you can download it here.

To start curl, you must be at the command line.  On the Mac, this is “terminal”.  On Windows, start (“run”) “cmd.exe”.

To verify you have it, type “curl” and hit <enter>.  You should see:

curl: try ‘curl –help’ or ‘curl –manual’ for more information

If you don’t, install it or set the path and try again.

Talking To LANNouncer

Remember your Android device IP Address?  You got it from the main screen during configuration.  It’s probably something like 192.168.1.45, with the last two digits being different.  It could start with a 172 or a 10, but most likely 192.168.*.  We need that; it will be the “ip address” we refer to.

And we’re likely listening on port 1035, unless you changed that on the device.  You can tell from the main screen again.  I’ll assume 1035 here.

So each curl command will start with:

curl “http://ip address:1035/?

For example,

curl “http://192.168.1.45:1035/?ALARM=CHIME&@DONE@”

In every case, your start will be the same.  And we will end with

&@DONE@”

What these mean is:

  • Run curl
  • The ” starts a string it should treat as a single parameter, as an address basically.
  • Use the http (internet) protocol.  That matters since that’s what LANNouncer expects.
  • Send it to 192.168.1.45, which is the device.
  • Talking on port (analogous to an extension or mail slot) 1035.
  • The / says we’re talking to the root.
  • The ? says the query parameters are starting.  Such as “ALARM…”

The &@DONE@” breaks down as:

  • & separates the query parameters (commands) to LANNouncer (or any web receiver.)
  • @DONE@ is a special code in LANNouncer to let it know to stop parsing.
  • The final ” tells curl to finish the string and send it.

What To Say

Everything else is just applying the Commands.  Some examples are:

  • curl “http://192.168.1.45:1035/?ALARM=CHIME&@DONE@”
    • plays a chime
  • curl “http://192.168.1.45:1035/?FLASH=CONTINUOUS&@DONE@”
    • Starts the strobe
  • curl “http://192.168.1.45:1035/?FLASH=STOP&@DONE@”
    • Stops the strobe.
  • curl “http://192.168.1.45:1035/?SPEAK=Awaiting your command&@DONE@”
    • Speaks (via TTS) the words “awaiting your command.”

curl Alternative

You don’t have to use curl.  You can actually paste the bits inside the quotes into your web browser (e.g. Chrome) address line.  Note that Microsoft Edge won’t work unless you explicitly add the device to your Local Internet devices (Control Panel – Internet Options – Security – Local Internet – [Sites] button, [Advanced] button, add the IP address (without the port) to the zone.  Save, close.)  Probably easiest to just not use Microsoft Edge.

When a command completes successfully, you will see “LANNouncer: OK” in the browser.