Jump to content

Home Automation Dashboard 4.0.2 beta


bmercier

Recommended Posts

Hi Benoit,

 

  This is very nice.

 

  I am in the process of trying this out.     One feature that would be very handy would be if there was a way to specify the base url in  a variable for the REST calls.   This way, instead of requiring the host (or virtual host) of the web pages to position the REST proxy at /rest, it could be positioned at an arbitrary URL.   

 

   In particular, this would be conducive to having the original page accessed as http://admin:admin@hostname/dashboardand letting the REST calls be done as a mod_proxy rule that doesn't insert its own authentication.   Then, instead of having a proxy at a fixed URL that bypasses authentication, the rest calls would be done according to the same authentication provided by the client.

 

-J

 

Hi,

 

Unfortunately, that would not be possible. An Ajax request has to be sent to the origin server, meaning the server which served the html page.

 

I could easily add the ability to insert a prefix to the path (e.g /prefix/rest/nodes), if that's useful for you, but I cannot change the host name. This is a browser security feature that ensures that the data comes from the intended source.

 

There are techniques to get around that, like using jsonp, but it would not help for accessing ISY rest calls. Jsonp is basically a way to get json data, wrapped by javascript. Javascript includes are not limited to the same origin policy, as a normal ajax call is.

 

Ref: http://en.wikipedia.org/wiki/Same-origin_policy

 

Benoit.

Link to comment
Share on other sites

Hi Benoit,

 

  Actually, it is the prefix I was referring to.

 

  I created a simpler and faster proxy that seems to work well (attached).  You can give it whatever name you want and place it in any directory on the same server as the rest of HA-dashboard and make it executable.

 

 So, in my case, I place "myisyrest" in /usr/lib/cgi-bin/myisyrest  and I change the path (prefix) in isyrest.js so that, instead of all url starting with "/rest", they all start with "/cgi-bin/myisyrest".  This works with a "default" ubuntu install.

 

  When HA dashboard fetches /cgi-bin/myisyrest/foo/bar/baz, myisyrest gets called (this is standard cgi behavior) and has access to the entire path.

 

  The same CGI could also be placed in the HA dashboard directory itself by using an .htaccess file containing...

 

<Files "rest">
  Options +ExecCGI 
  SetHandler cgi-script
</Files>
 
and setting the prefix to "rest" instead of "/rest" so the relative path works.
 
Cheers,
 
-J
 

myrest.zip

Link to comment
Share on other sites

 

Hi Benoit,

 

  Actually, it is the prefix I was referring to.

 

  I created a simpler and faster proxy that seems to work well (attached).  You can give it whatever name you want and place it in any directory on the same server as the rest of HA-dashboard and make it executable.

 

 So, in my case, I place "myisyrest" in /usr/lib/cgi-bin/myisyrest  and I change the path (prefix) in isyrest.js so that, instead of all url starting with "/rest", they all start with "/cgi-bin/myisyrest".  This works with a "default" ubuntu install.

 

  When HA dashboard fetches /cgi-bin/myisyrest/foo/bar/baz, myisyrest gets called (this is standard cgi behavior) and has access to the entire path.

 

  The same CGI could also be placed in the HA dashboard directory itself by using an .htaccess file containing...

 

<Files "rest">
  Options +ExecCGI 
  SetHandler cgi-script
</Files>
 
and setting the prefix to "rest" instead of "/rest" so the relative path works.
 
Cheers,
 
-J

 

 

Hi,

 

I have updated HAD to allow for a custom base URL. Can you give it a try?

 

Look for ajaxBaseUrl in custom.js.

You can set it to "/cgi-bin/myisyrest", and that will redirect standard calls like "/rest/nodes" to "/cgi-bin/myisyrest/rest/nodes"

 

You may want to test camera functions, as this uses different ajax functions internally.

 

Thanks,

 

Benoit.

Link to comment
Share on other sites

Hi Benoit,

 

  I hope I am not being obtuse, but I am confused about where to get the update version.  I looked at the wsdk releases and the newest seems to be 4.2.22 from Jan 6 or earlier.

 

  What I am trying to do is to host this on another Linux machine, though customizing the version on the ISY also could be a good option.

 

  What I ultimately wish to do may require some further extension, but I suspect my extensions may be useful to to others.   Ultimately, I would like to have this interface work as a status panel on a tablet mounted to a wall or on a phone.   Here are the changes I would need to make....

 

 

1) Adjust sizes so that Chrome on Android will let the table fill the screen instead of assuming that the table is a small portion of a large window.

 

2) Refer to variables by name rather than ID (This looks like it may be there in the custom.js on my ISY... is that newer than 4.02 ?)

 

3) Permit the CSS sytle of a table row or its elements to be controlled by the value of a variable.

 

4) Permit the slider to be hidden along with hidecontrols (perhaps already done newer than 4.02 ?)

 

5) Implement a return-to-tab-1 after a certain idle time

 

6) Permit a program to be simply "run" with a single button with a specified label.

 

 

Essentially, this means that I could have a bar on the top of a table indicating if the alarm is READY , NOT READY, or ARMED

 

Various controls could be indicated by buttons that would change colors based on current state and toggle when clicked.

 

On additional tabs, I could have the more traditional HA-dashboard widgets, but auto-return to the main tab.

 

Am I on the right track?

 

-J

Link to comment
Share on other sites

Hi,

 

The latest release is indeed 4.2.22 from January 6th 2015. In there, you will find UDAjax-HAD, with had4242custom.zip. This is the latest release.

 

There will be a fix coming in the next release that you can easily fix yourself - you seem to be a developer. I will publish another post with details for everyone.

 

 

What I am trying to do is to host this on another Linux machine, though customizing the version on the ISY also could be a good option.

 

You will find that hosting it on another server will be a bit faster.

 

 

  What I ultimately wish to do may require some further extension, but I suspect my extensions may be useful to to others.   Ultimately, I would like to have this interface work as a status panel on a tablet mounted to a wall or on a phone.   Here are the changes I would need to make....

 

1) Adjust sizes so that Chrome on Android will let the table fill the screen instead of assuming that the table is a small portion of a large window.

 

I also use it like that. I use an iPad on the wall.

 

When I start it, it looks good without resizing it. What would you suggest to do with the width? Reduce? Expand?

 

 

 

2) Refer to variables by name rather than ID (This looks like it may be there in the custom.js on my ISY... is that newer than 4.02 ?)

 

It is already there, since version 1. However, it is best to use ID's because this way you can avoid unnecessary rest calls. If you refer to them by name, then you need to enable loading of variable definitions, which has an impact on initial screen load time. On a PC, it is negligible. On iOS, it has a slight impact. If you don't play with that too often, it's better to set it in stone with ID's.

 

 

3) Permit the CSS sytle of a table row or its elements to be controlled by the value of a variable.

 

4) Permit the slider to be hidden along with hidecontrols (perhaps already done newer than 4.02 ?)

 

5) Implement a return-to-tab-1 after a certain idle time

 

6) Permit a program to be simply "run" with a single button with a specified label.

 

These are all good ideas and they are fairly simple to implement. However, I currently do not have the time to implement them. Feel free to do so. If you want to share it, I could include them in a future release.

 

I could do them as well in a month+ or so.

 

 


Essentially, this means that I could have a bar on the top of a table indicating if the alarm is READY , NOT READY, or ARMED

 

Various controls could be indicated by buttons that would change colors based on current state and toggle when clicked.

 

On additional tabs, I could have the more traditional HA-dashboard widgets, but auto-return to the main tab.

 

Am I on the right track?

 

-J

 

Yes, you are definitively on the right track :-)

 

Benoit.

Link to comment
Share on other sites

Hi Benoit,

 

   I think I have identified the necessary building blocks and I should be able to implement the necessary changes all within index.htm and custom.js.   My language preferences are Perl, C, followed by a few others before I hit Javascript in a browser environment (still, preferred to PDP8 machine code :wink:.  I'll post patches here unless you have another suggestion but my Javascript is a bit crude so it will require some clean-up before being generally useful.

 

   The reason that Android shrinks the JqueryUI so much is it defaults to pretending to be a much larger browser and JQueryUI decides to expand the background to fill the "page."  I found 2 imperfect solutions to this.

 

   Including <meta name="viewport" content="width=device-width" /> in the html head section prevents the browser from lying about the resolution.  It is also possible to hard-code a width here.  The down-side is, at least on my phone, I actually want the resolution in portrait mode to be a little higher than the actual.

 

   I can force the width with <body style="width:800px">, though that leaves a border between the active portion of the page and the rest of the background.  I had to use  <div id="tabs" style="border:0 !important"> to prevent that border.

 

  So, I have identified a few hacks that get my page to look the way I want on Android, but I'm not sure if there is a good way to make them generally useful.

 

  I'm working on a periodic "idle" timer that forces selection of a default tab and refreshes variables and custom javascript.  It isn't as robust as I'd like across browsers so I'll post that when finished.

 

-J

Link to comment
Share on other sites

  • 6 months later...

back to the drawing board. I had this working for a while and ended up having to replace my ISY and this has stopped working, I get "rest response not sucessful" when I try changing scenes etc. Any ideas ?

 

 

EDIT: looks like the rest commands are not getting the NODE ID in the URL string. Has something changed on the API in the newer ISY's ? some kind of device name to address mapping issue. The device names are all the same as I restored my ISY config from the old to the new...strange....

Link to comment
Share on other sites

Hello Kevman,

 

I can tell you the rest API have not changed for a while - except for adding new APIs.

 

This is indeed strange. Is HAD hosted on your ISY, or elsewhere?

 

What are the rest call that are failing? All of them? Or just those referencing a specific node? Could it be only ZWave ones?

 

Note, you can inspect the actual rest calls by pressing F12 in the browser.

 

Benoit.

Link to comment
Share on other sites

Hello Kevman,

 

I can tell you the rest API have not changed for a while - except for adding new APIs.

 

This is indeed strange. Is HAD hosted on your ISY, or elsewhere?

 

What are the rest call that are failing? All of them? Or just those referencing a specific node? Could it be only ZWave ones?

 

Note, you can inspect the actual rest calls by pressing F12 in the browser.

 

Benoit.

 

 

Hi Benoit- 

 

HAD is hosted on my ubuntu machine.  Could I host it all on my ISY ?

 

I had a line in my index.html file such as this

 

{ name : "FamilyRoom", displayname:"Family Room Lights", control:"FamilyRoomScene", refreshOpt:"Yes" },
 
Which did not work. 
 
I had to change it to this
 
 { name : "FamilyRoom", displayname:"Family Room Lights", control:"FamilyRoom", refreshOpt:"Yes" },
 
 
I guess that the control element has the word Scene on the end of the scene name in the original ISY, but I've changed it to the actual display nam  and that seems to help. but there are still a few things that are not working like refresh on some of my scenes. 

Hi kevman,

 

If you are on 5.0 firmware then there is a bug for Z-WAVE devices.

 

With kind regards,

Michel

Hi-

 

I'm on 4.2.3 , my old isyt ws on 4.1.6 when it died on my so I restored a 4.1.6 sytem to the 4.2.3 , would that make a difference?

Link to comment
Share on other sites

Hi Benoit- 

 

HAD is hosted on my ubuntu machine.  Could I host it all on my ISY ?

 

I had a line in my index.html file such as this

 

{ name : "FamilyRoom", displayname:"Family Room Lights", control:"FamilyRoomScene", refreshOpt:"Yes" },
 
Which did not work. 
 
I had to change it to this
 
 { name : "FamilyRoom", displayname:"Family Room Lights", control:"FamilyRoom", refreshOpt:"Yes" },
 
 
I guess that the control element has the word Scene on the end of the scene name in the original ISY, but I've changed it to the actual display nam  and that seems to help. but there are still a few things that are not working like refresh on some of my scenes. 

Hi-

 

I'm on 4.2.3 , my old isyt ws on 4.1.6 when it died on my so I restored a 4.1.6 sytem to the 4.2.3 , would that make a difference?

 

Hi Kevman,

 

Do you have a scene or device named "FamilyRoomScene"? 

 

The name suggests this is a scene. Could it be that the scene does not exists anymore?

 

Benoit

Link to comment
Share on other sites

Hi Kevman,

 

Do you have a scene or device named "FamilyRoomScene"? 

 

The name suggests this is a scene. Could it be that the scene does not exists anymore?

 

Benoit

 

The Scene name itself on the ISY is FamilyRoom. in the index.htm file it looks like all the scene names that are referenced have "Scene" added to the end of them. Perhaps It was a "working" typo previoulsy ?

Link to comment
Share on other sites

ok I have figured it out. When I replaced my ISY, i didn't have a backup that was the latest and greatest to restore from. So what I beleive is that the scene and device names were not the same as my index.htm file in HAD. I made them device names match exactly and now it seems to work.

 

Thanks!

Link to comment
Share on other sites

  • 4 months later...

Good evening,

I am interested in using HAD but I am not a developer.

Is there a layman user guide on how to customize firmware/portal version of HAD?

For example, I have two zwave siren devices and HAD automatically puts the ON/OFF buttons beside each device, I want to delete/hide the buttons so the user can not turn the siren on/off. Is this possible?

 

cheers.

Link to comment
Share on other sites

Good evening,

I am interested in using HAD but I am not a developer.

Is there a layman user guide on how to customize firmware/portal version of HAD?

For example, I have two zwave siren devices and HAD automatically puts the ON/OFF buttons beside each device, I want to delete/hide the buttons so the user can not turn the siren on/off. Is this possible?

 

cheers.

 

Unfortunately, there is no guide.

 

To start with, you can't customize the firmware or portal version. There is however a version intended for customization, but you have to host it somewhere, either on you ISY, or a separate web server. I personally like to host it on my NAS. This way, it is much easier to make modifications.

 

You can find the latest release in the SDK here:

https://www.universal-devices.com/isy-developers/

 

In the SDK, look for UDajax-HAD. This is HAD.

 

Index.htm is the home page. It's actually a single page app. At the top, you will find comment that explain how to build your device list. There are examples, including one that shows how to hide the buttons.

 

If you choose to host HAD on a separate web server, you will need a "transparent proxy" so that rest requests are directed to your ISY.

This will help you:

http://forum.universal-devices.com/topic/14632-need-help-loading-dashboard/?hl=%2Btransparent+%2Bproxy&do=findComment&comment=123033

 

Enjoy!

 

Benoit.

Link to comment
Share on other sites

.... but you have to host it somewhere, either on you ISY, or a separate web server. I personally like to host it on my NAS. This way, it is much easier to make modifications.

 

Hi Benoit, Merry Christmas to you!

 

Can my customized pages, hosted on my NAS, be served back through the portal, externally? I had made an assumption that my customized pages would have to be loaded back on to the ISY for external portal access.

 

Paul

Link to comment
Share on other sites

Hi Benoit, Merry Christmas to you!

 

Can my customized pages, hosted on my NAS, be served back through the portal, externally?

 

Paul

 

Hi Paul,

 

Unfortunately no. Portal can only communicate with an ISY, and ISY cannot act as a gateway to other web servers in your network, like your NAS.

 

If it was hosted on ISY, it would technically be feasible, but it is not supported scenario.

 

I think the best route would be a user-configurable HAD hosted on portal. However, this is not yet in the roadmap.

 

Merry Christmas!

 

Benoit.

Link to comment
Share on other sites

If it was hosted on ISY, it would technically be feasible, but it is not supported scenario.

 

Hi Benoit-

 

I'm don't know udajax at depth. In your opinion, is loading my customized pages back to the ISY to use through the portal a reasonable experiment at this time?

 

I'm willing to experiment with it, but if its not really feasible now for a novice, I'll wait. 

 

Thank you,

 

Paul

Link to comment
Share on other sites

Unfortunately, there is no guide.

 

To start with, you can't customize the firmware or portal version. There is however a version intended for customization, but you have to host it somewhere, either on you ISY, or a separate web server. I personally like to host it on my NAS. This way, it is much easier to make modifications.

 

You can find the latest release in the SDK here:

https://www.universal-devices.com/isy-developers/

 

In the SDK, look for UDajax-HAD. This is HAD.

 

Index.htm is the home page. It's actually a single page app. At the top, you will find comment that explain how to build your device list. There are examples, including one that shows how to hide the buttons.

 

If you choose to host HAD on a separate web server, you will need a "transparent proxy" so that rest requests are directed to your ISY.

This will help you:

http://forum.universal-devices.com/topic/14632-need-help-loading-dashboard/?hl=%2Btransparent+%2Bproxy&do=findComment&comment=123033

 

Enjoy!

 

Benoit.

 

Thank you for the explanation and Merry Christmas to all.

 

I looked at the links you sent and briefly read through. Unfortunately they are well beyond my present knowledge and capabilities.

 

I read that by placing a "~" in front of device name in ISY I can hide it, and this works in udajax but not in HAD.

 

I like a lot of how the firmware/portal version of HAD looks, I just need to take away some devices and adjustment capabilities, like +1 or -1 button for variables, and forcing the "Then" or "else" button on programs tab, etc. I want to take those abilities away.

 

Could you recommend someone outside or in these forums that would be able to help me develop some customized pages, of course as paid service?

These custom pages will be hosted on ISY, can the portal access for certain users be set up to default to these custom pages?

 

cheers.

Link to comment
Share on other sites

Hi Benoit-

 

I'm don't know udajax at depth. In your opinion, is loading my customized pages back to the ISY to use through the portal a reasonable experiment at this time?

 

I'm willing to experiment with it, but if its not really feasible now for a novice, I'll wait. 

 

Thank you,

 

Paul

 

Hi Paul,

 

Portal would need a change to support this. It's not something I had though of so far, but I think it's a good idea.

 

I will discuss with Michel, and this may be a feature that will be added.

 

Benoit.

Link to comment
Share on other sites

  • 3 weeks later...

Hi Paul,

 

Unfortunately no. Portal can only communicate with an ISY, and ISY cannot act as a gateway to other web servers in your network, like your NAS.

 

If it was hosted on ISY, it would technically be feasible, but it is not supported scenario.

 

I think the best route would be a user-configurable HAD hosted on portal. However, this is not yet in the roadmap.

 

Merry Christmas!

 

Benoit.

 

Hi Benoit, 

 

I got to this one on my list today. I moved one of my customized HAD pages to the ISY, and used the 'URL to ISY' address and logged in. I added the /USER/WEB/ path and htm file name in the URL. I realize its not supported, but one of customized tabs , which provides status, is functioning as expected. Granted, its not a very sophisticated tab technically.

 

There's no request at this time, its an update only. This method gives me what I was looking for.

 

Paul

Link to comment
Share on other sites

Hi Benoit, 

 

I got to this one on my list today. I moved one of my customized HAD pages to the ISY, and used the 'URL to ISY' address and logged in. I added the /USER/WEB/ path and htm file name in the URL. I realize its not supported, but one of customized tabs , which provides status, is functioning as expected. Granted, its not a very sophisticated tab technically.

 

There's no request at this time, its an update only. This method gives me what I was looking for.

 

Paul

 

Excellent, thanks for your post. I had not tested that, but I'm glad it's working.

 

Benoit.

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.2k
×
×
  • Create New...