Jump to content

How to set up Demopad for use with ISY


wwat

Recommended Posts

Note: see next post to set up ISY event subscriptions, its a much better way to receive device status changes. Some info in this post is still useful so I will leave it up.

 

Hi,

 

A week ago I stumbled across this great program called Demopad. It allows users to create really nice looking front ends for devices like ISY and place them on an iPad or iPhone/iPod Touch. Over the last week I spent some time making sure it was able to perform all the right connections with ISY and so far its looking good.

http://www.demopad.com/index.php

 

With some direction from Demopad support I was able to get Demopad talking with ISY. This enables us to retrieve status information from ISY using a Demopad device, use feedback to retrieve ISY device status information and poll the ISY if required. It would be great if we could subscribe to ISY for automatic status update but I haven't worked out how to do that or even whether it can be done without new features in Demopad. When I find out one way or another I'll post an update.

 

 

Here is a small getting started how-to which should cut down the time for anyone interested in Demopad:

 

Setting the response terminator

One thing you need to setup two-way feed back is a response terminator. Unfortunately the xml strings returned from ISY do not have a null terminator but I have found what appears to be a unique sequence of characters which so far has worked to determine the end of the feedback data.

 

Here is the string you need to paste into the response terminator text box,the character representation is /nodeInfo>

 

\x2F\x6E\x6F\x64\x65\x49\x6E\x66\x6F\x3E

 

Encoding your user name and password

The example below uses admin:admin for the user name and password which when encoded translates to YWRtaW46YWRtaW4=

Obviously you would need to encode your own user name and password and replace this one which you can do from this website: http://www.opinionatedgeek.com/dotnet/tools/base64encode

 

One thing to keep in mind is that if you intend to use this remotely you should use secure protocol (https) because the user name and password will be visible and readable once decoded.

 

Example 1 - command to turn on a switchlinc

The ISY device id used in this example is 12.60.B7.1 which translates to 12%2060%20B7%201 , just replace it with one of your own Switchlinc device id's.

 

Here is a sample command which turns on an Insteon Switchlinc, there is no device status returned in this case:

 

GET rest/nodes/12%2060%20B7%201/cmd/DON HTTP/1.1\x0D\x0AHost: 192.168.1.105\x0D\x0AAuthorization: Basic YWRtaW46YWRtaW4=\x0D\x0A\x0D\x0A

 

This is what the formatted get request and header response looks like:

 

GET rest/nodes/12%2060%20B7%201/cmd/DON HTTP/1.1
Host: 192.168.1.105
Authorization: Basic YWRtaW46YWRtaW4=

HTTP/1.1 200 OK
Content-Length: 104
Connection: Keep-Alive
WWW-Authenticate: Basic realm="/"
Content-Type: text/xml
Cache-Control: no-cache
EXT: UCoS, UPnP/1.0, UDI/1.0
Last-Modified: Tue, 4 Dec 2012 14:40:4 GMT

<?xml version="1.0" encoding="UTF-8"?>200

 

 

Example 2 - Retrieve the status of the switchlinc

 

To retreive the status for that Switchlinc the following command should to be used, the return string contains the ISY device id which can be used to create a match in the two-way feedback dialogue box.

 

GET rest/nodes/12%2060%20B7%201 HTTP/1.1\x0D\x0AHost: 192.168.1.105\x0D\x0AAuthorization: Basic YWRtaW46YWRtaW4=\x0D\x0A\x0D\x0A

 

Here is the formatted get request and header for the above command:

 

GET rest/nodes/12%2060%20B7%201 HTTP/1.1
Host: 192.168.1.105
Authorization: Basic YWRtaW46YWRtaW4=

HTTP/1.1 200 OK
Content-Length: 528
Connection: Keep-Alive
WWW-Authenticate: Basic realm="/"
Content-Type: text/xml
Cache-Control: no-cache
EXT: UCoS, UPnP/1.0, UDI/1.0
Last-Modified: Wed, 5 Dec 2012 20:16:13 GMT

<?xml version="1.0" encoding="UTF-8"?>12 60 B7 1Furnace Room SL182591.1.55.0true12 60 B7 1D09

 

 

Example 3 - Regex to get the actual status from the xml

 

This is the regex you could use to retrieve the status from the return xml:

 

12 60 B7 1.*ST.*formatted="(.*)" uom.*

 

Hope this helps newbies and if anyone has any better approaches to doing any of this please just add to this thread with the improvements.

 

Many thanks.

Wayne

Link to comment

How to subscribe to ISY events for automatic device status changes

 

As suggested in the above post subscribing to ISY events is a better approach (much less resource intensive) and I was able to get this working which makes most of the methods in the above post redundant.

Below is the connection details to get Demopad/ISY users up and running without too much effort.

 

This is the response terminator:

\x3C\x2F\x45\x76\x65\x6E\x74\x3E

 

You will need to create a Demopad command using the following POST string and run the command from an application startup action: (Replace the encoded authorization string and IP address/Port to suit)

POST /services HTTP/1.1 \x0D\x0AHost: 192.168.1.105:80 \x0D\x0AAuthorization: Basic YWRtaW46YWRtaW4= \x0D\x0AContent-Length: 192 \x0D\x0AContent-Type: text/xml; charset="utf-8" \x0D\x0A\x0D\x0AREUSE_SOCKETinfinite


 

An example of regex code to pattern match device status, this can be run from the two-way feedback action (change device id to one of your own):

ST.*(.*)12 60 B7 1

This example will match humidity changes if you have a Venstar thermostat:

CLIHUM.*(.*)11 BD 72 1

 

This is a way better approach to getting status changes and its relatively easy to set up. Please feel free to improve further on any of this and post to this thread.

 

Regards,

Wayne

Link to comment

Below are two more commands that will retrieve the initial load of integer and state variables. You need to execute these seperately because variables are not loaded like all the other ISY device/scene etc status information when you initially subscribe to ISY. All further variable *updates* do however come by way of the subscription connection.

 

The other thing you will have to setup in Demopad is a second Demopad device (connection to ISY). The first device should be used solely for event subscriptions and will remain open until he app closes. The second device should be used for everything else, like retrieving these variables and all further commands.

 

Note: don't forget to change the encoded user name and password, and IP address/port number to your own. Also make sure that when you copy and paste these strings, that they are all pasted as a single line without any newline or additional spaces etc.

 

Retrieves integer variables

POST /services HTTP/1.1 \x0D\x0AHost: 192.168.1.105:80 \x0D\x0AAuthorization: Basic YWRtaW46YWRtaW4= \x0D\x0AContent-Length: 152 \x0D\x0AContent-Type: text/xml; charset="utf-8" \x0D\x0A\x0D\x0A1

Retrieves state variables

POST /services HTTP/1.1 \x0D\x0AHost: 192.168.1.105:80 \x0D\x0AAuthorization: Basic YWRtaW46YWRtaW4= \x0D\x0AContent-Length: 152 \x0D\x0AContent-Type: text/xml; charset="utf-8" \x0D\x0A\x0D\x0A2

The response terminator for the second device represented in Hex as follows:

\x3C\x2F\x73\x3A\x45\x6E\x76\x65\x6C\x6F\x70\x65\x3E

Here is a regex code sample to retrieve state variable with and ID of 1, and which matches either 0 or 1 in value:

.(0|1)

Here is a good site to test your regex code http://www.regextester.com/

another good site for looking up the Hex representation of ASCII characters http://www.asciitable.com/

Link to comment
  • 11 months later...

Thank you for the great post on setting up subscription services in demopad. This works great when using the device on the local network. Unfortunately, demopad support tells me devices are limited to local tcp/udp communications, but will not work wil http, https, telnet etc. I had been hoping to get this to work for remote communications for ISY control and support suggested I try 'send data to website' as a workaround.

 

I have been experimenting with this utilizing the /rest interface. I have been sucessfull sending commands utilizing http but not https. I will not use demopad remotely through a nonsecure port. Below are samples of two commands, one (http) which works and the other (https) that does not:

 

http://username:password@hostname.com:p ... 01/cmd/DON (Works)

 

https://username:password@hostname.com: ... 01/cmd/DON (Doesn't work)

 

I have the following questions:

 

(1) Has anybody sussecfully communicated with ISY over https utilizing demopad? If so, does anybody know if the rest/status or any of the rest/get type commands work to solicit feedback utilizing the 'send data to website' command?

 

(2) Can anyone suggestion a better client software package to use for iPhone/iPad that can both utilize ISY's Subscription Services and HTTPS?

 

I have used iRule to solicit feedback over https, but have not been able to succesfully subscribe to the ISY Subscription Services. Thanks for the assistance,

 

Andy

Link to comment
  • 5 months later...
  • 5 weeks later...

Archived

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


×
×
  • Create New...