Opening a certain webfront directly in Android app

‚What’s new‘ on the ipsymcon app in the play store says ‚Neu: Automatisches Einrichten von WebFronts über Links (symcon:// oder symcons://)‘. I take it that this means that you can open a certain webfront directly, without having to select it first in the app. Is there any documentation on how this works because for the life of me I can’t figure it out.

Hi roelv,

the new feature you are mentioning does what you need and more. You can now configure a new WebFront via a symcon:// link, after configuring it, it will immediately be opened.

This means, you could build a Link like this: symcon://www.webfront.info/#58972 where „www.webfront.info“ is your IP-Symcon Servers IP or URL and „58972“ is the WebFront-Configurator ID. When clicking it the App will automatically add and show it in the overview, but not open it. The Servers Adress follows standard URI schemes, implementing the port (IP:PORT) and authority (username:password@IP) part.

Just out of interest, do you have a usecase where you want / need to open the WebFront when clicking the link?

Cheers,
gucky

Hi,

Thanks for the fast reply. Where would I put such a link? If I type it in the address bar in Chrome (on Android), it just googles the string for me. Do you mean such a link can be put in the symcon frontend, and when I click on it, it would show this other frontend? So a shortcut basically to a frontend from within the app?

What I want is to access common functionality with less touch interactions. Right now if I want to turn on the light on the porch, I have to open the app (which is on my home screen), select the frontend (of which I have only one, so this is one extra touch I do 5 times a day for no reason at all), clicks ‚lights‘, ‚ground floor‘ and then the light I want to switch on. Of course the ‚lights/ground floor‘ is because of the way I have it set up, but if I could add a link to my home screen that would open the right webfront, that would save one touch already.

Another reason why this whole thing takes so long is because the app is slow. It seems it contacts the server every time you click a new menu; especially opening a web front takes 0.5 - 1 second (at least significantly more than the 0.1 second Nielsen prescribes as the cutoff for when a reaction feels instantaneous). The spinning wheel that is shown in front of each menu makes it feel even slower. So if it would just cache the menu layout and put a ‚refresh UI cache‘ item in the menu, that would already make a world of difference I think.

Finally, ideally what I would want is that the app would include widgets that I can put on the home screen to control the most often used devices. I would dedicate one view to the 5-10 devices I control often with my phone, that would make using symcon as fast as getting up and pressing a switch. For now, the app is a nice gimmick, but for most purposes it’s not as comfortable to use as it could be.

cheers,

roel

Hi roelv,

you could put that link where ever you want. In a htmlBox in your WebFront, in a mail you send to someone, on your website… it is important that it is a link (typing it into your browser doesn’t work) and that the link is complete, i.e.:


<a href="symcon://www.webfront.info/#58972">symcon://www.webfront.info/#58972</a>

since the android mail application on our test device interprets the link without explicit declaration as


//NOT WORKING EXAMPLE
symcon://<a href="www.webfront.info/#58972">www.webfront.info/#58972</a>

which wouldn’t work since android doesn’t know it should be opened with IP-Symcon.

Regarding the scenario you describe, I’m happy to say that it will work with our links, depending on how your android device is handling them. To do so you would need to configure your device and your IP-Symcon as follows:

1. IP-Symcon
You will need to create a WebFront for every „Szene“ you want to access from your HomeScreen. Like a „porch WebFront“ and a „Livingroom WebFront“.

2. Android Device
You need to add links to your homescreen, I think the standard „links“ Android uses are in fact WebApps which will continue to run when you click the icon (instead of resolving the link again), this won’t work for your purpose. But I’m sure there will be widgets for adding links to your HomeScreen. So add links to the WebFronts from Step1 to your Widget, when clicking the link IP-Symcon Mobile will add the WebFront if it is not already in the App and then open it. So you will reach your destination with only one click.

We have talked about implementing Widgets and we do have some ideas about that, but it is not yet planned to do it, because our ideas seem to be too complicated in Comparison to the usability gain. Caching is also problematic. But we are always bouncing new ideas to solve those problems, so hopefully we will have a good idea soon!

I hope the links will work for you.

Cheers,
gucky

OK thank you. Your answer send me looking in the right direction. It wasn’t trivial to get a link on the homescreen (how hard can it be, right?) but now I have a nice setup, where I can access my webfront with one link and I have a screen with widgets that toggle certain buttons, using the json API. Here’s what I did, to save others an afternoon of figuring this out:

  • I use a combination of Tasker, Dropbox and DropSync (on Android) and m4 (on desktop). Tasker to run javascripts from homescreen widgets, Dropbox and Dropsync to sync javascripts from desktop to mobile, and m4 to generate javascript files that call the IPSymcon JSON api.

  • It starts with some m4 macros and a batch file (can easily be substituted for a shell script, of course):

File common.m4:


var runInWSH = false;
var password = "abc"; // this needs to be a base64 encoded version of the string "username:password", where username and password are the ipsymcon username/pass

function showMsg(msg) {
    if (runInWSH) {
        WScript.Echo("Message: " + msg);
    }
};

function sendCommand(command, id, params) {
    if (runInWSH) {
        var http = new ActiveXObject("MSXML2.XMLHTTP")
    } else {
        var http = new XMLHttpRequest();
    }

    var content = '{ "jsonrpc":"2.0",';
    content += '"method":"' + command + '",';
    content += '"params":';
    content += params;
    content += ', "id":"null" }';;

    http.open("POST", "http://" + ... server url and port here + "/api/", false);
    http.setRequestHeader("Authorization", "Basic " + password);
    http.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    http.send(content);
    return(http.responseText);
};

function switchLight(id, on) {
    var params = '[' + id + ',' + (on ? 'true' : 'false') + ']';
    return sendCommand('ZW_SwitchMode', id, params);
};

function setDimmer(id, dimlevel) {
    var params = '[' + id + ',' + dimlevel + ']';
    return sendCommand('ZW_DimSet', id, params);
};

try {
    var result = doIt();
    showMsg("SUCCESS: " + result);
}
catch(e) {
    var error = e.message;
    showMsg("ERROR: " + error);
}

File set_dimmer.m4:

function doIt() {
    setDimmer(DEVICE_ID, DIMLEVEL);
};

include(common.m4)

File switch_light.m4:

function doIt() {
    switchLight(DEVICE_ID, DEVICE_STATE);
};

include(common.m4)

File generate_tasks.bat:

rem Office lights
..\..\..\bin\m4\bin\m4.exe -DDEVICE_ID=38497 -DDEVICE_STATE=true    switch_light.m4 > office_on.js
..\..\..\bin\m4\bin\m4.exe -DDEVICE_ID=38497 -DDEVICE_STATE=false   switch_light.m4 > office_off.js

rem Patio lights
..\..\..\bin\m4\bin\m4.exe -DDEVICE_ID=13284 -DDIMLEVEL=100         set_dimmer.m4 > patio_on.js
..\..\..\bin\m4\bin\m4.exe -DDEVICE_ID=13284 -DDIMLEVEL=0           set_dimmer.m4 > patio_off.js

Now when you run generate_tasks.bat (it is in this file that you configure the devices you want to control), it will generate a javascript file for each task (switch light on or off, set dim level to a certain value). This can trivially be extended to include more ipsymcon commands, of course.

I keep these files on Dropbox; I use the DropSync app to then sync these javascripts to the android device to a dedicated directory.

Then, I configured Tasker on the android device with tasks that run these javascript files. I have one task for each command: so one for office lights on, one for office lights off, etc.

Tasker lets you put widgets on the home screen that directly run a script. So I put a widget for each command I often use.

The nice thing is that I only need to set up the tasks/widgets once; after that, if I change the script and re-sync, the updated script is run automatically.

For opening the right webfront, I set up a Tasker ‚open link‘ task, with the ‚symcon://‘ scheme you mentioned.

Anyway, maybe this is useful to somebody else as well. It would be nice if such things were documented in the manual, though. I stopped using open source solutions to get away from time consuming DIY hacks like this…

cheers,

roel