How to Send Temperature Data to ISY 994i

randyth

Member
The following attempts to explain how to send temperature information from a CAi WebControl board to a Universal Devices ISY 994i home automation system.
 
1.        Ensure you have these three main ingredients:
a.        ISY 994i device (assumed already up and running and connected to your local area network)
b.        WebControl board with firmware 3.02.16a or later (assumed to be connected to your local area network and, of course, a power supply and a temperature sensor)
c.        A computer with a web browser connected to your local area network (required for setup purposes only, not for ongoing communication between the temperature sensor and ISY device)
2.        Add a variable to your ISY device to receive the temperature
a.        Open the ISY admin console on your computer
b.        Click on the Programs tab (wait for it to digest things) and then click on the Variables tab
c.        So you can trigger ISY programs based on the temperature, I recommend you create a State variable, so go ahead and click on the State tab.
d.        From the State-tab screen, click on the Add button found at the bottom of the window, change the name of the variable to something like WebControllerTemp, and then click the Save button.
e.        The rest of these instructions are going to assume this variable is the first State variable you’ve created on your ISY device (ID of 1).  If it isn’t, you’ll have to modify the instructions in step 5.a.ii below so the State variable ID number jives with the ID number found on this State variables screen.
3.        Discover your ISY’s Secret Decoder Ring Code string (a base64 encoded string)
a.        To talk to your ISY, the WebControl needs to get past your ISY device’s password-protected security.  To do this, it wants a hashed version of your login name and password.
b.        Go to http://www.cainetwor...4-encoding.html.  In the first field, enter your ISY device's admin login name (usually just admin) followed immediately by a colon and your password.
c.        Your secret decoder ring code magically appears in the box that follows. As you can see from this screen shot snippet, a login of "admin" and a password of "password" generates a base64 string of YWRtaW46cGFzc3dvcmQ=
hash.PNG
d.        Remember this string of characters: Write it down or, better yet, leave this browser window open so you can copy the base64 encoded string and paste it into the appropriate WebControl field as explained in step 5.a.iii below.
 
For the sake of simplicity and clarity, the following assumes you do not have an existing program running on your WebControl.  If there is, I assume you created that program and have enough knowledge to adjust the instructions below so they don’t stomp all over your current WebControl program / configuration.
 
4.        Log into your WebControl and verify that your temperature sensor is working
a.        Open your web browser and enter the WebControl’s IP address into the address bar.
i.        If you’ve never connected to your WebControl board before, its IP address defaults to 192.168.1.15
ii.       If you’ve connected your WebControl board before and enabled DHCP, hopefully you remember its new IP address; otherwise you’ll have to do some sleuthing or random guessing until you manage to navigate to the device’s main screen.
b.        Activate your temperature sensor (if you haven't already)
i.        Click on the Temperature Sensor Setup button
ii.       Use the pull-down menu in T1's "ROM Code" column to select the sensor you want to assign to T1.  If you only have one sensor connected to the WebControl, you will only have one valid (nonzero) option to choose from.  If your only option is 12 zeroes, then your temperature sensor is not properly connected.
iii.      Here is what my screen looks like:
TEMPSETUP.PNG
c.        Check to see if the sensor appears to be working.
i.        Click on the System Status button and look at the number in column 1 of the Temperature Sensors row.  It should at least look like a reasonable room temperature.  Try “fogging” the sensor with your breath and/or blowing on it to see if you can get the temperature to move up and down, clicking the Refresh button now and then to display an updated reading.
d.        If you don’t appear to be getting reasonable data or you are failing at step 4.b, double-check the wiring of the sensor to the WebControl board (cutting off its power if you do make any wiring changes, of course).
5.        Teach your WebControl how to talk to your ISY device
a.        Click on the WebControl menu's Notify Setup button and enter the following into each field for the URL1 row in the Web HTTP GET table at the bottom if this screen:
i.        Set IP-addr:port:Virtual Host to: isyipaddress
(do NOT include an http:// before the IP address)
ii.       Set GET URI to: rest/vars/set/2/1/
(the last number is the State variable's ID; if you are using a normal variable, the second to last number should be a 1 instead of a 2)
iii.      Set Base64 Authorization String to the Secret Decoder Ring Code from step 3.c
b.        For example, if your ISY's IP address is 192.168.1.28 and login username is admin and password is password, your URL1 Notify Setup info should look like this:
notify.PNG
c.        Click the Send button.
 
1.        Create a WebControl program to send the temperature to your ISY
a.        Click on PLC Program and then paste the following text into the big PLC Program box:

START
      SET RAM1 0
      SETLED 0  
LOOP:
      SET RAM2 T1
      ADD RAM2 5 RAM2
      DIV RAM2 10 RAM2
      TSTEQ RAM1 RAM2
      GOTO LOOP
      SETLED 1
      SET RAM1 RAM2
      WEBSET URL1 RAM1
      DELAY 1000
      SETLED 0
      GOTO LOOP
      END   
 
b.       Click the Send button and stand back in case you did something wrong because one bad character can cause the WebControl to explode.  OK, that last part was a joke.  Worst case, it simply won’t work.
c.      This code constantly polls the temperature sensor looking for changes.  Whenever the temperature changes by 1 degree or more, it sends the new temperature to the ISY device and flashes the WebControl’s green LED.
7.        Verify that it’s all working
a.        Go back to your ISY’s admin console and navigate back to the Programs->Variables->State screen where you created the MyTemp (or whatever you called it) variable to see if it has changed to something resembling a reasonable temperature.
b.        Again, feel free to hyperventilate a bit by “fogging” the sensor with your hot breath and/or blowing on it to see if you can get the temperature to move up and down.
8.        If it works, think nice thoughts about me.  If it doesn’t, please let us know where you think it’s going wrong.
 
Please note that your WebControl talks to your ISY device via your local area network (LAN) so both must remain connected to your LAN for this to work.
 
If anything is going awry, it's probably because there is an error in the Notify Setup data described in section 5.a.  It must be entered exactly right and, because everyone's setup is potentially unique, what's right for you won't be right for most other people.  Any mistake here will cause the ISY to ignore you.
 
Please reply with any additions or corrections you might have and I'll do my best to keep this initial post up to date.
 
Good luck,
-Randy
 
Very nice! This help many people and act as a guide to reference!
 
The IP address with  ":80:isy" has me a little puzzled. Mine works with just the IP address and nothing else on the end. IIRC it wouldn't function wit a suffix added.  Maybe that was using an http:// it wouldn't work
 
With my setup, at least, it does appear that the ":80:isy" part of WebControl's Notify Setup is unnecessary -- it's likely only required if you are accessing the ISY from outside your local network.  It doesn't hurt anything, but it works fine with the IP address alone and so I have updated the posting above to reflect that.
 
I originally included this "port:virtual host" information because of the example CAI gave on page 14 of the WebControl PLC User Guide (snippet below).
 
WEBSET feature allows setting VAR value in another WebControl board, or setting
value on your web server, if you have proper CGI code developed to take. For
example, to set a value in ISY from Universal Devices, you can configure the URL1 
to:
IP_address:port:virtual_host for example: 192.168.2.222:80:www.mydomain.com
Please note ISY99 using port 80
URI example: /rest/vars/set/1/15/
Base64 encrypted username:password: Example: YWRtaW46cGFzc3dvcmQg
 
-Randy
 
You have described exactly what I want to achieve. Thanks for the detailed instructions.

I don't have a CAI WebControl board and will have to buy one. When I look on the web I see a WebControl BRE unit and a WebControl PLC unit... Which do I need to buy? Also, so nothing is overlooked, what part/model number are you using for the temperature for the board?

Many thanks.
 
This worked perfectly for me first time! Thank you for the post and easing the learning curve on the PLC. I'm new to this but excited to experiment.
I pretty much can follow what the code is doing...
But I'm confused as to what the lines ADD RAM2 5 RAM2 along with the next DIV RAM2 10 RAM2 accomplish.
I'd like to think I know what they do but the numbers in isy are not lying, they match what the webcontrol board is reporting!
I'm hoping your reply will assist me in learning and modifying the code to my specific application. 
 
@deaconwc
That would be a usual rounding technique.
 
Without even looking... the programmer wants to divide the figure by ten so he adds half of ten to the figure and then divides it by ten. If the resulting fraction was going to be .5 or higher the next whole number will be used.
 
 
In Integer only math
(53 +5) / 10 = 5
(56 + 5) /10 = 6
 
 
 
@randyth
This would be awesome if you could post this verbatim into the appropriate forum section on the UDI forum. It would be appreciated to help promote this tiny board that may have uses for other HA people. With your permission I could cut and paste it there myself, if so desired.
 
ClayMaster said:
...
When I look on the web I see a WebControl BRE unit and a WebControl PLC unit... Which do I need to buy? Also, so nothing is overlooked, what part/model number are you using for the temperature for the board?
...
 
I am not familiar with the WebControl BRE version of the board (though I must say the concept of a Boolean Run Engine interests me).  For my example to work, you need the WebControl PLC due to the fact I am relying on PLC code.
 
For a temperature sensor, I am currently using this: http://www.amazon.com/dp/B008HODWBU
 
Any DS18B22- or DS18B20-based sensor should work.
 
-Randy
 
@deaconwc
So glad you got it working!  LarryLix is, of course, correct about the magic behind the math.  The temperature sensor input registers (T1 through T8) store integer values accurate to 1/10th of a degree so 72.6 degrees is stored as 726.  The code merely adds 5 (for rounding) and then divides by 10 to get it into a more recognizable range.  If you don't want to lose the accuracy of that last digit, you could remove the math and adjust your ISY code to deal with the larger number.
 
@larrylix
Good idea.  I will post this to the UDI forums.
 
I had a special forum thread setup for the CAI/WC8. It would be best there to keep the searching easier.
 
Thanks @larrylix and @randyth
After posting my original question, I woke up in the middle of the night with an ah-ha moment BUT I appreciate you both confirming that it wasn't a dream! I forgot that the temp is recorded with three digits, ie 67.6 is 676. I appreciate your assistance with the learning curve.
My Insteon PLM went down and I'm awaiting a new one so can't experiment right now. Could I also multiply X .1 (MUL RAM2 .1 RAM2) to maintain the decimal? Probably won't use this because rounding will work fine but just curious.
 
deaconwc said:
Thanks @larrylix and @randyth
...
Could I also multiply X .1 (MUL RAM2 .1 RAM2) to maintain the decimal?
...
 
Whether you divide by 10 or multiply by .1 (which I don't think the PLC would like), the result will always be an integer because the PLC supports integers only.  In other words, anything to the right of the decimal place will be lost.
 
-Randy
 
LarrylLix said:
I had a special forum thread setup for the CAI/WC8. It would be best there to keep the searching easier.
 
D'oh!  I just dropped it into the How To forum thread.  I'd move it, but I don't think have such powers.  I could simply start a topic in your CAI form thread that links to the post in the How To section.  Thoughts?
 
Yeah I think you can just repost it and delete your original post or maybe the whole thread.
 
If not, I have asked Michel or other to move it via PM, or repost it and ask the first thread to be deleted. They're really good about this stuff, treating the forum as a very orderly library.
 
My Insteon PLM went down and I'm awaiting a new one so can't experiment right now. Could I also multiply X .1 (MUL RAM2 .1 RAM2) to maintain the decimal? Probably won't use this because rounding will work fine but just curious

No! Welcome to the world of integer binary languages.
 
Small controllers such as WC8 have no fractional representation or floating point math.
 
    DIV RAM2 10 RAM2   is  RAM2 = RAM2 x 0.1
 
Back
Top