Garage Door Minder – Client Software

The Particle Smartphone application by is pretty good for doing very basic IO.  It supports Digital IO as well as reporting on Analog inputs, but that’s about as far as it goes.  What I needed really was more just a basic user interface without having to write a complete Smartphone application.

The approach I took was writing a couple of standalone web pages using the Java SDK and the js Delivr file spark.min.js (recently replaced by particle.min.js).  With the java library in place in was relatively straight forward to write a web page that queried the particle cloud for current variables, displayed them and hosted a button to call the published function on my Photon to hit the garage door button.

To make it easy, I created named SPANs in the HTML page, with names matching the published variables they were to display.  Then the java callback resulting from querying the particle cloud could just update the text string in the associated SPAN.

As an example, the temperature display SPAN looked like this:

Current Temp: <span id=”Temp”>N/A</span> Deg F<br>

The Java related to the Temperature looked like this:

var TempDiv = document.getElementById(‘Temp’);


function DisplayVal(Val) {

        particleDevice.getVariable(Val, function (err, data) {
             if (err) {
                   console.log(‘An error occurred while getting variable:’, err);
             } else {
                    DisplaySpecificVal(Val, JSON.parse(JSON.stringify(data))[‘result’]);


function DisplaySpecificVal(Div,Val) {
    switch(Div) {
        case ‘Temp’:
            TempDiv.innerHTML = Val;



That worked well with a web server, but I wanted to be able to run the standalone HTLM on my phone as an application without having to have an intermediate web server to host the web page and .js files.

Except…. that simply placing the HTML and JS files and trying to launch them didn’t work.  The page launched, but the java script doesn’t run.  I could open a browser, then navigate to the local file, open it and Java would work, but simply clicking on the .HTML file launched Android WebView, which doesn’t support Java.

The fix turned out to be relatively easy once I found the Android app Open In Browser and the Android application File Widget, that lets you create a short-cut to any file.  Between these two applications it’s possible to create a link to an HTML file on your phone which you can click and it will launch the HTML file in the selected browser with Java running.

So with that I had a quick and dirty Smartphone “application” which I could use to manage my garage door through my Garage Door Minder Photon device.

On to logging the data….