Alternate UI to UI7

[quote=“a-lurker, post:561, topic:185570”]Bit of a problem with OWServer plugin. During set up, the J_OWServer.js code makes an ajax call to the OW server to get some json. The call works and the json is returned. However an error msg says “TypeError: transport.responseText is undefined” in this code:

onSuccess: function(transport) { TypeTable = transport.responseText.evalJSON();

Which is part of prototypejs: Prototype JavaScript Framework | Introduction to JSON

This thread mentions a problem with “var RequestParms = new Hash()” also part of prototypejs:

http://forum.micasaverde.com/index.php/topic,8381.msg239853.html#msg239853

http://api.prototypejs.org/language/Hash/

I imagine this is some sort of library usage problem. I’ve no idea what is used by UI5, UI7 & AltUI and how. What needs to be done to cure these issues in general?[/quote]
Ui5 uses a mix of old jquery and prototypejs
I think ui7 only uses a more recent version of jquery and no prototypejs hence issues of this plugin when uses on ui7 I suppose

All these mixed framework are not really good so altUI made the choice to only uses latest jquery , but I do have issues like this occasionally which I have fixed by some ugly magic manipulating on the file plugin source code which uses prototypejs to rewrite the same thing in jquery only. I Will have to look at this one but might be tricky sine I do not own such hardware.

[quote=“a-lurker, post:561, topic:185570”]Bit of a problem with OWServer plugin. During set up, the J_OWServer.js code makes an ajax call to the OW server to get some json. The call works and the json is returned. However an error msg says “TypeError: transport.responseText is undefined” in this code:

onSuccess: function(transport) { TypeTable = transport.responseText.evalJSON();

Which is part of prototypejs: Prototype JavaScript Framework | Introduction to JSON

This thread mentions a problem with “var RequestParms = new Hash()” also part of prototypejs:

http://forum.micasaverde.com/index.php/topic,8381.msg239853.html#msg239853

http://api.prototypejs.org/language/Hash/

I imagine this is some sort of library usage problem. I’ve no idea what is used by UI5, UI7 & AltUI and how. What needs to be done to cure these issues in general?[/quote]

I have fixed ( I think ) these 2 issues but I am in the middle of a complex restructuration of the code to support a big new feature … so they are chances I break something. I will not put immediately that version in autoupdate so can you please try v373 using this install url : http://:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=8246&Version=28046 and confirm back if a) it does not break anything
b) it fixes your J_OWServer.js observations

[quote=“a-lurker, post:559, topic:185570”]Auto update going OK here (locally).

A couple of requests:

In the Control Panel for each device: You can click on the “Used in” button to get the list of action/scenes the device is used in. However, if the device is not being used at all; then there is no message to say so.[/quote]
in v373

[quote=“a-lurker, post:559, topic:185570”]On the ALTUI device - can we please have a link to the ALTUI web server like the infoviewer or dataMine devices have in UI5/UI7 - that is this link:

http://your_ip_address/port_3480/data_request?id=lr_ALTUI_Handler&command=home#

Note that in UI5, URL links (as labels) can’t be placed on the Device’s front page - they have to be placed on an internal tab. In UI5, text labels on the front page of the device are rendered using a “title” attribute contained in the opening “div” tag of an empty “div” statement. The title attribute may be html but the attribute is not interpreted as html (it’s an attribute ) and does not render as a clickable link. However on the Device tabs, the URL is placed between the “div” statement tags and works as expected.

The work around is to store the URL in a device variable and then place the variable on the device’s front page. That would also allow the the user to code the URL for the page they would like to open first. Sure you can just bookmark the ALTUI page but first time round it’s a pain to type in.[/quote]
sounds like a good idea but I do not understand completely how to do it. so let’s say I create a device variable for this URL , then what should i put in the UI5 Json and in the UI7 Json ? can you explain a little bit more ? ( sorry :slight_smile: )

[quote=“tomtcom, post:560, topic:185570”][quote=“amg0”][quote=“tomtcom, post:557, topic:185570”][quote=“amg0, post:554, topic:185570”]V 0.56.364

[ul][li]Scene History dialog ( since lua log restarted )[/li]
[li]Device Variable History ( since lua log restarted )[/li][/ul]

You press the little calendar button ( respectively in device variable dialog box for variable, or in scene dashboard panel ) and it will show you the history that it has found in the log

This feature will never replace database-based solution like DataMine/DataYours etc but it gives the history it finds in the lua logs for you, so let’s call it “recent history” since the last reboot or last log rotation

NOTE: I assume logs are on the vera box in /var/log/cmh but if some of you use logs on USB, please help me here by telling me the absolute file path where log can be read, I can then maybe do something equivalent for people putting logs on external storage/usb.

Install by autoupdate or with magic url : ?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=8246&Version=28028[/quote]

Hey amg0, auto update is reverting me back to .313. This is partly from my earlier post. I hit the update, confirm, after a while I reload the page and back to .313. The magic url will work fine and I’ll do that now but I’m not sure how to troubleshoot.

Also, from the prior version, I couldn’t get the mobile page to update past .313 either even after cache cleaning on Chrome for Android.

Any suggestions?[/quote]
Do you do local access or remote ? It seems I have issues with remote I may have to reduce auto update to local access[/quote]
I tried both a couple times so I couldn’t recall the order of which I did it.[/quote]

ok, I looked into this and I believe the problem is with remote access.
in order to know if there is a newer version, ALTUI makes an ajax call to read HTTP( or HTTPS ) //code.mios.com/svn_public/mios_alternate_ui/lastver.txt using JSONP standard to overcome the same domain origin restrictions imposed by browsers.

code.mios.com is a convenient server for me as I can update files easily and fast whenever I need and it should work in httpS mode without problem. in remote access, everything happens in HTTPS, all seems to work perfectly but when ALTUI tries to access https//code.mios.com/svn_public/mios_alternate_ui/lastver.txt , and this time it fails because of a certificate naming issue. the certificate does not seem to be aligned with the name code.mios.com and therefore the browser is not happy and reject the AJAX call. for ALTUI this is not an issue but the autoupdate feature will not happen, thats all.

Chrome is pretty clear about the issue ( at least in french )

Impossible de v?rifier sur le serveur qu'il s'agit bien du domaine code.mios.com, car son certificat de s?curit? provient du domaine *.repositoryhosting.com. Cela peut ?tre d? ? une mauvaise configuration ou bien ? l'interception de votre connexion par un pirate informatique.

to fix it it would require either

  • to lower the security in your browser and accept code.mios.com as a trusted site even if certificate is not correct, which I do not really recommend. I have made the test to force chrome to open this and then it works but I have not found in chrome option where to modify the settings to make code.mios.com a trusted site
  • to find another https server, like sjolhagen one but it is less convenient for me to publish files there … and I change this file often
  • MCV to renew their code.mios.com certificate…

so I propose to NOT fix this issue and simply decide that autoupdate is not a feature for remote access. it is probably sane anyhow to only do an auto-update when you have local access, just in case the upgrade does not work well.

[quote=“amg0, post:565, topic:185570”][quote=“tomtcom, post:560, topic:185570”][quote=“amg0”][quote=“tomtcom, post:557, topic:185570”][quote=“amg0, post:554, topic:185570”]V 0.56.364

[ul][li]Scene History dialog ( since lua log restarted )[/li]
[li]Device Variable History ( since lua log restarted )[/li][/ul]

You press the little calendar button ( respectively in device variable dialog box for variable, or in scene dashboard panel ) and it will show you the history that it has found in the log

This feature will never replace database-based solution like DataMine/DataYours etc but it gives the history it finds in the lua logs for you, so let’s call it “recent history” since the last reboot or last log rotation

NOTE: I assume logs are on the vera box in /var/log/cmh but if some of you use logs on USB, please help me here by telling me the absolute file path where log can be read, I can then maybe do something equivalent for people putting logs on external storage/usb.

Install by autoupdate or with magic url : ?id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=8246&Version=28028[/quote]

Hey amg0, auto update is reverting me back to .313. This is partly from my earlier post. I hit the update, confirm, after a while I reload the page and back to .313. The magic url will work fine and I’ll do that now but I’m not sure how to troubleshoot.

Also, from the prior version, I couldn’t get the mobile page to update past .313 either even after cache cleaning on Chrome for Android.

Any suggestions?[/quote]
Do you do local access or remote ? It seems I have issues with remote I may have to reduce auto update to local access[/quote]
I tried both a couple times so I couldn’t recall the order of which I did it.[/quote]

ok, I looked into this and I believe the problem is with remote access.
in order to know if there is a newer version, ALTUI makes an ajax call to read HTTP( or HTTPS ) //code.mios.com/svn_public/mios_alternate_ui/lastver.txt using JSONP standard to overcome the same domain origin restrictions imposed by browsers.

code.mios.com is a convenient server for me as I can update files easily and fast whenever I need and it should work in httpS mode without problem. in remote access, everything happens in HTTPS, all seems to work perfectly but when ALTUI tries to access https//code.mios.com/svn_public/mios_alternate_ui/lastver.txt , and this time it fails because of a certificate naming issue. the certificate does not seem to be aligned with the name code.mios.com and therefore the browser is not happy and reject the AJAX call. for ALTUI this is not an issue but the autoupdate feature will not happen, thats all.

Chrome is pretty clear about the issue ( at least in french )

Impossible de v?rifier sur le serveur qu'il s'agit bien du domaine code.mios.com, car son certificat de s?curit? provient du domaine *.repositoryhosting.com. Cela peut ?tre d? ? une mauvaise configuration ou bien ? l'interception de votre connexion par un pirate informatique.

to fix it it would require either

  • to lower the security in your browser and accept code.mios.com as a trusted site even if certificate is not correct, which I do not really recommend. I have made the test to force chrome to open this and then it works but I have not found in chrome option where to modify the settings to make code.mios.com a trusted site
  • to find another https server, like sjolhagen one but it is less convenient for me to publish files there … and I change this file often
  • MCV to renew their code.mios.com certificate…

so I propose to NOT fix this issue and simply decide that autoupdate is not a feature for remote access. it is probably sane anyhow to only do an auto-update when you have local access, just in case the upgrade does not work well.[/quote]

That makes sense and understood, agreed with NOT fixing this. Appreciate all the fine details very much.

On the OWServer plugin - that seems to be working OK so far. Not sure what trickery you used!!

I came across another problem to-day. Vera is meant to work without a connection to the net. Well I tried that to-day. Both UI7 and AltUI had difficulties.

In UI7 you get the spinning wheel of death and this error in the console - “could not check internet”. Well if it’s not connected then yes but don’t stop the unit from running:

[code]core.js?1.7.619-1-01005059:10

2015-6-15 16:12:53 Error in Application.initializeCheckInternetError:

could not check internet [/code]

In AltUI it stalls on “Waiting initial data” - looks like it can’t retrieve code for the Google gauges:

[code]
data_request?id=lr_ALTUI_Handler&command=home:33

GET https://www.google.com/jsapi?autoload={"modules":[{"name":"visual?ation","version":"1","packages":["gauge","table"]}]} net::ERR_NAME_NOT_RESOLVED
data_request?id=lr_ALTUI_Handler&command=home:42 Uncaught ReferenceError: google is not defined(anonymous function) @ data_request?id=lr_ALTUI_Handler&command=home:42
J_ALTUI_uimgr.js:7691 Uncaught TypeError:

Cannot read property ‘info’ of undefined[/code]

Internet dropouts aren’t uncommon, so having completely disabled interfaces during such periods makes life a bit difficult.

[quote=“a-lurker, post:567, topic:185570”]On the OWServer plugin - that seems to be working OK so far. Not sure what trickery you used!!

I came across another problem to-day. Vera is meant to work without a connection to the net. Well I tried that to-day. Both UI7 and AltUI had difficulties.

In UI7 you get the spinning wheel of death and this error in the console - “could not check internet”. Well if it’s not connected then yes but don’t stop the unit from running:

[code]core.js?1.7.619-1-01005059:10

2015-6-15 16:12:53 Error in Application.initializeCheckInternetError:

could not check internet [/code]

In AltUI it stalls on “Waiting initial data” - looks like it can’t retrieve code for the Google gauges:

[code]
data_request?id=lr_ALTUI_Handler&command=home:33

GET https://www.google.com/jsapi?autoload={"modules":[{"name":"visual?ation","version":"1","packages":["gauge","table"]}]} net::ERR_NAME_NOT_RESOLVED
data_request?id=lr_ALTUI_Handler&command=home:42 Uncaught ReferenceError: google is not defined(anonymous function) @ data_request?id=lr_ALTUI_Handler&command=home:42
J_ALTUI_uimgr.js:7691 Uncaught TypeError:

Cannot read property ‘info’ of undefined[/code]

Internet dropouts aren’t uncommon, so having completely disabled interfaces during such periods makes life a bit difficult.[/quote]

you are absolutely correct, ALTUI is indeed internet dependant. it was in my project start considerations. I wanted to use latest copy of a few of very common frameworks to get maximal benefit and speed of evolution. I used big CDNs but if internet connectvity is out, it stucks where you see becasue it waits for the various JS frameworks to download from the CDN. it loads jquery, bootstrap, google jauge and a couple of other things from internet.

There is no alternative unless we load a direct copy of all these frameworks onto the VERA box itself which is technically feasible but will load the box quite a bit with big files. I will look at making this an option but the user will have to find a room on its vera , under /www to load these files

essentially all these should then be hosted and replaced by local copies

[code]

[/code]

Hi,

Folks with a local web server like on a NAS could use that for these files. Might be a nice test to see if AltUI then keeps working without internet. Just an idea.

Cheers Rene

The NAS idea is an interesting one and I can see that AltUI generally needs a net connection. But! How do you set up, in say a newly built house with no internet connection, twenty or so Z-Wave devices? - you can’t. In an existing setup and the net goes down, how do you turn off the lights before bed? It looks like it is compulsorily to have a 3G/4G fallback. Imagine if unfortunate circumstances struck your country (Vera is used World wide) and the net went off for months due to say warfare. Throw Vera in the bin in that case. We need graceful fallback. Maybe not from AltUI but certainly from MCV; who claim, as I understand it, that Vera can work without a net connection, albeit with reduced functionality. As for memory restrictions - we are all pretty clear that MCV needs to bring out some decent hardware; OpenHab is looming.

Just to be clear - @amg0 - love your work!

[quote=“a-lurker, post:570, topic:185570”]The NAS idea is an interesting one and I can see that AltUI generally needs a net connection. But! How do you set up, in say a newly built house with no internet connection, twenty or so Z-Wave devices? - you can’t. In an existing setup and the net goes down, how do you turn off the lights before bed? It looks like it is compulsorily to have a 3G/4G fallback. Imagine if unfortunate circumstances struck your country (Vera is used World wide) and the net went off for months due to say warfare. Throw Vera in the bin in that case. We need graceful fallback. Maybe not from AltUI but certainly from MCV; who claim, as I understand it, that Vera can work without a net connection, albeit with reduced functionality. As for memory restrictions - we are all pretty clear that MCV needs to bring out some decent hardware; OpenHab is looming.

Just to be clear - @amg0 - love your work![/quote]

I will try to find a compromise of all “use cases”. I will create a “LocalCDN” variable in the ALTUI device which will either be empty ( meaning as of today, taking file from internet ) or filled in with the URL root of a location where to find the files. that way this “LocalCDN” can point to your own vera /www folder if you want to put the files there , or on a local server or whatever

The only 2 caveats are 1) then you will have to update the files by hand whenever I make a change of these files versioning, but I will try to keep informed if that happens , 2) I am not fully sure how to handle the google gauge as the loading is quite complex
Stay tuned

[glow=red,2,300]EDIT !:[/glow] v>= 383 will have this, it works !

[ul][li]I created a folder /www/localcdn on my vera and put all the files needed ( which you find in the localcdn folder of http://code.mios.com/svn_public/mios_alternate_ui/ ).[/li]
[li]ALTUI vera device has a new variable called LocalCDN, which can be empty, or in my case ‘/localcdn’ ( with no trailing slash and you do put the complete vera path, just the part below /www ). no sense for remote access of course but I think it will work too if you use it this way. if you put a fully formed url like http://mylocalserver/xxx then it will work locally but probably not for remote access[/li][/ul]

I still personally prefer to let it in default mode with LocalCDN variable empty and internet access, but your mileage may vary and with this possibility ALTUI works without internet access. I ll publish a official autoupdate version a bit later.

V 0.58.390

[ul][li]LocalCDN variable & UI so ALTUI works without internet. for example , put ‘/localcdn’ in the variable and put the content of the folder localcdn of http://code.mios.com/svn_public/mios_alternate_ui/ on your VERA in /www/localcdn using a tool like WinSCP[/li]
[li]jquery version updates[/li]
[li]LocalHome variable & UI to save a prefered home page from UI5/7 page : in preparation of alurker’s idea, the setting button will open the url defined here with lang & home page preference. I am still not sure on how to use the HTML injection trick on UI5/UI7, feedbacks welcome[/li]
[li]J_OWServer.js compatibility fix with removing Hash() and adding evalJSON() to string prototype[/li]
[li]Device not used message when a device is not used in any scene / triggers etc[/li]
[li]Camera thumbnail size adjust[/li]
[li]some bug fixes[/li][/ul]

Install by autoupdate , or magic url id=action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=CreatePlugin&PluginNum=8246&Version=28064

EDIT: bug fix, I changed the version one more time to 390

The coding power machine delivers again ;D.

I will give it a shot both with the URL and a local vera folder. Can make the latter as a CIFS mount to the NAS not to take precious flash space from the Vera.

Cheers Rene.

A temporary USB key set up until the net is available - can this be done? Any instructions for this?

yes of course, as long as the LocalCDN variable of the ALTUI device contains the Unix full path name of where you mount your storage / the folder containing the files and as long as that folder contains the files given under “localcdn” visible on http://code.mios.com/svn_public/mios_alternate_ui/ ; then it should work.

so in theory all possibilities are there: Vera local storage, or USB storage, or CIFS should all work the same. and the dummy user like me can just continue to use internet and leave that LocalCDN variable of the ALTUI device empty

I am sadly not a Unix guru so I could not tell you how a USB key can be mounted on VERA file system in order to have a full path coming the root like /etc/myusbkey, but I am sure there are many UNIX Gurus in this forum who can tell us

hope that helps

the “tail -n” on the logs in ALTUI is really useful !

Thanks

There are a couple of scenarios here:

  1. the Google CDN servers are never available eg you live in country where the government blocks them. In this case being able to serve the files yourself using NAS, USB stick, etc is a plus

  2. you have a net connection but not all the time. Eg a laptop being moved around from place to place. In this case the js libs/apis will be cached in your browser for a year, once they are first accessed.

However it looks the visualization stuff is not cached at all. The last comment on this pages indicates why:

https://groups.google.com/forum/#!topic/google-visualization-api/kD5_9HckDSk

So it seems the only answer to having AltUI work off line is to disable the charting when the net is not available. You can be online but not able to reach Google. Maybe use google.setOnLoadCallback(drawVisualization); to set a visualizationLoaded flag? Problem is that drawVisualization will not be called if Google is unavailable and the function does other needed stuff.

[quote=“a-lurker, post:577, topic:185570”]There are a couple of scenarios here:

  1. the Google CDN servers are never available eg you live in country where the government blocks them. In this case being able to serve the files yourself using NAS, USB stick, etc is a plus

  2. you have a net connection but not all the time. Eg a laptop being moved around from place to place. In this case the js libs/apis will be cached in your browser for a year, once they are first accessed.

However it looks the visualization stuff is not cached at all. The last comment on this pages indicates why:

https://groups.google.com/forum/#!topic/google-visualization-api/kD5_9HckDSk

So it seems the only answer to having AltUI work off line is to disable the charting when the net is not available. You can be online but not able to reach Google. Maybe use google.setOnLoadCallback(drawVisualization); to set a visualizationLoaded flag? Problem is that drawVisualization will not be called if Google is unavailable and the function does other needed stuff.[/quote]

I have added d3.min.js in revision 404 ( had forgotten this one which is only loaded when needed), so it is also working in /localcdn mode now. [instructions : get rev and files from http://code.mios.com/svn_public/mios_alternate_ui/ , you need to update to this revision and add the d3.min.js file to your local cdn folder]

For google, indeed we have a problem, even their term of service do not allow offline mode as explained in their FAQ :자주 묻는 질문(FAQ)  |  Charts  |  Google Developers

However, I did include a local copy of jsapi.js and I was wondering what happens with no internet access. did anybody tried so far ? if so could you please share your result. I suspect it may just gracefully degrade and just not show the gauges, but to be confirmed

Would like to give this a try but I have no account in code.mios.com (that I know off).

It is read only access for all. You should see it, let me know if not

Envoy? de mon iPad en utilisant Tapatalk

No problem reading them. Just no download buttons. I would have to access each file and cut & paste the browser output.