ADICON Support Forum Applied Digital, Inc.
Page 1 of 2 12>
Topic Options
#16409 - 09/11/06 01:39 PM x10 thermostat
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
can anyone point me to where I can learn to program the leopard to work with a x10 thermostat?
Top
#16410 - 09/11/06 01:55 PM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
Are you referring to a RCS thermostat, like the TX16B? There are C-Max instructions specifically designed to send commands to these. Look at page 46 of the downloadable Leopard II manual for a summary description of the "Send X10 Thermostat (RCS)" command. If you're looking for specific application examples, then ask your questions here. Some forum members have RCS thermostats.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16411 - 09/12/06 07:53 AM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
Thanks, I found it and got the basics working. I am having a problem with two things though.

I want the temp to display on the leopard screen. I did the following. I changed the controller parameter #21 to a value of 1. I then place a text on my touch screen and enter "%2" to display 2 digits. Then I bound the variable 64 for RCS Temp for house code A to the text. No temp is displaying. I noticed the Autosend variable. DO I have to do something with that? Or am I just doing this part all wrong.

Second, I when I adjust the thermostat setting I want to see the numbers go up or down on the leopard. How do I do this?

Can someone please give me some code snippets for both of these?

Many thanks in advance.

Top
#16412 - 09/12/06 01:07 PM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
I don't have an actual RCS X-10 thermostat but from what I understand, you will need to periodically request the temperature value from the thermostat. This can be done in C-Max using the instruction:

THEN Send RCS X10 A Command: Request Temperature

Maybe the Autosend setting you're referring to has the thermostat do this automatically...?

Depending on how much X10 traffic you can tolerate or want to avoid, you could do this once per hour or whatever. The thermostat responds with preset dim commands that the Leopard will then convert to a temperature value and store in variable #64 for house code A, etc. Use the C-Max controller utilities to "debug timers and variables" and monitor variable #64 to see if anything is getting stored in there. If that works ok, then look at your screen text too.


To set and see the setpoint on the screen, you would need to define increment and decrement buttons on screen and have them increment/decrement a displayed variable. You would then send that variable to the thermostat. The only thing is that C-Max doesn't have a way to invoke a variable to be sent as a setpoint, so you would need to use a series of hardcoded IF/THEN commands covering the range of possible setpoints that you want to be able to send.

Here is a sample program. A timer (timer #1) could be used so that a number of seconds have elapsed after having pressed the last increment/decrement button before the setpoint is sent. Lets also pretend that you want to limit the setpoint (variable #5) between 65 and 80 degrees. Something like this could be done (pseudo code):

IF Leopard button #1 is pressed //if increment button is pressed
AND Variable #5 is < 80 //and setpoint is less then allowed maximum
THEN Variable #5 + 1 //increment setpoint
THEN Timer #1 = 1 //and start stability timer

IF Leopard button #2 is pressed //if decrement button is pressed
AND Variable #5 is > 65 //and setpoint is higher then allowed minimum
THEN Variable #5 - 1 //decrement setpoint
THEN Timer #1 = 1 //and start stability timer

IF Timer #1 becomes > 4 //if nothing has changed for 4 seconds
ELSE Skip to line xx //else skip setpoint setting routine
THEN Timer #1 = 0 //stop timer

IF Variable #5 = 65
THEN Set RCS X10 A Setpoint 65

IF Variable #5 = 66
THEN Set RCS X10 A Setpoint 66

IF Variable #5 = 67
THEN Set RCS X10 A Setpoint 67

.
.
.

IF Variable #5 = 80
THEN Set RCS X10 A Setpoint 80

(line xx)
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16413 - 09/12/06 05:17 PM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
Thanks, got the temp to display before you posted, but still no luck with the setpoint displaying. Here is my code with your code integrated. Maybe you can find my mistake.

0001 - IF Timer #0 becomes = 0 //
0002 - THEN Variable# 63 / Screen# = 1 //
0003 - THEN Send RCS X10 A Command: Request Temperature //
0004 - IF Touch Object #2, Button Leopard is pressed //
0005 - THEN Send RCS X10 A Command: Fan ON //
0006 - IF Touch Object #3, Button Leopard is pressed //
0007 - THEN Send RCS X10 A Command: Fan OFF //
0008 - IF Touch Object #4, Button Leopard is pressed //
0009 - AND Variable #5 is < 80 //
0010 - THEN Variable #5 + 1 //
0011 - THEN Timer #1 = 1 //
0012 - IF Touch Object #5, Button Leopard is pressed //
0013 - AND Variable #5 is > 65 //
0014 - THEN Variable #5 - 1 //
0015 - THEN Timer #1 = 1 //
0016 - IF Timer #1 becomes > 4 //
0017 - ELSE Skip to line 18 //
0018 - THEN Timer #1 = 0 //
0019 - IF Variable #5 is = 65 //
0020 - THEN Set RCS X10 A Setpoint 65 //
0021 - IF Variable #5 is = 66 //
0022 - THEN Set RCS X10 A Setpoint 66 //
0023 - IF Variable #5 is = 67 //
0024 - THEN Set RCS X10 A Setpoint 67 //
0025 - IF Variable #5 is = 68 //
0026 - THEN Set RCS X10 A Setpoint 68 //
0027 - IF Variable #5 is = 69 //
0028 - THEN Set RCS X10 A Setpoint 69 //
0029 - IF Variable #5 is = 70 //
0030 - THEN Set RCS X10 A Setpoint 70 //
0031 - IF Variable #5 is = 71 //
0032 - THEN Set RCS X10 A Setpoint 71 //
0033 - IF Variable #5 is = 72 //
0034 - THEN Set RCS X10 A Setpoint 72 //
0035 - IF Variable #5 is = 73 //
0036 - THEN Set RCS X10 A Setpoint 73 //
0037 - IF Variable #5 is = 74 //
0038 - THEN Set RCS X10 A Setpoint 74 //
0039 - IF Variable #5 is = 75 //
0040 - THEN Set RCS X10 A Setpoint 75 //
0041 - IF Variable #5 is = 76 //
0042 - THEN Set RCS X10 A Setpoint 76 //
0043 - IF Variable #5 is = 77 //
0044 - THEN Set RCS X10 A Setpoint 77 //
0045 - IF Variable #5 is = 78 //
0046 - THEN Set RCS X10 A Setpoint 78 //
0047 - IF Variable #5 is = 79 //
0048 - THEN Set RCS X10 A Setpoint 79 //
0049 - IF Variable #5 is = 80 //
0050 - THEN Set RCS X10 A Setpoint 80 //
0051 - IF Touch Object #6, Button Leopard is pressed //
0052 - THEN Send RCS X10 A Command: Cool Mode //
0053 - IF Touch Object #7, Button Leopard is pressed //
0054 - THEN Send RCS X10 A Command: Heat Mode //
0055 - IF Touch Object #8, Button Leopard is pressed //
0056 - THEN Variable# 64 / RCS Temp A = 65 //
0057 - IF Touch Object #9, Button Leopard is pressed //
0058 - THEN Set RCS X10 A Setpoint 70 //
0059 - IF Touch Object #10, Button Leopard is pressed //
0060 - THEN Set RCS X10 A Setpoint 75 //
0061 - IF Touch Object #11, Button Leopard is pressed //
0062 - THEN Set RCS X10 A Setpoint 80 //
0063 - IF Touch Object #12, Button Leopard is pressed //
0064 - THEN Send RCS X10 A Command: Request Temperature //
0065 - IF Touch Object #15, Button Leopard is pressed //
0066 - THEN Send RCS X10 A Command: Auto Mode //
0067 - IF Touch Object #17, Button Leopard is pressed //
0068 - THEN Send RCS X10 A Command: System OFF //
0069 - THEN Send RCS X10 A Command: Request Temperature //
0070 - End Program


Edited by garyblak (09/12/06 07:03 PM)

Top
#16414 - 09/13/06 08:12 AM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
One error I see is line #17. It should be skipping to line 51, not 18. The way it is now, the Leopard will be sending the setpoint on every pass, jamming X-10 communications.

For the setpoint display problem, as long as your screen text is embedding variable #5 correctly, it should work. Have you tried looking at variable #5 with the C-Max "debug timers and variables" utility? You would at least know if the buttons are working correctly. Another thing is that if this is your entire program, then you don't have an proper initial setpoint value (it will show as 0). You might want to add some initialization code at the beginning of your program so that the setpoint gets set to an initial value, something like this (volatile variables get set to 0 upon powerup or program reload):

IF Variable #1 is = 0 //if variables have reinitialized to 0
THEN Variable #5 = 72 //then set initial setpoint to 72
THEN Variable #1 = 1 //and set initialization flag to 1

Another problem is that the Leopard's setpoint value is not aware if someone changes the setpoint directly on the thermostat. There is a way to request the thermostat to send it current setpoint and decode it from the "preset dim" response. Another forum member (...also named Gary!) actually coded some routines to do that kind of thing. The code is quite long but here is a link to it if you want to see it:

http://www.appdigusers.com/forum/showflat.php/Cat/0/Number/188541/Main/17812/#Post188541

I'd suggest you get your initial program working well before trying to integrate the additionnal code in the link above.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16415 - 09/14/06 09:51 AM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
I have done all as explained and I can change the setpoint on the thermostat using the leopard, but the setpoint is not displaying on the leopard. I now have it with 2 text objects. One for temp. and the other for setpoint. I have the temp text object bound to variable 64 which is the correct one for the house code I am using and it is working. The other one is bound to variable 5 and I have opened the debug timers and variables window and looked at variable 5 and can see the number change, but it is not the actual setpoint that is on the thermostat. I want this on boot or program load to get the actual setpoint from the thermostat and display it.

I looked at Gary's request setpoint snippet, but really can't understand how to make that apply in my program. Here is my updated program, since I have added some other stuff to it. If you look at lines 5 and 6, that is something else I tried after breezing through the tx16b rcs protocol manual, but it did not work. Also, I have not yet implemented the code you last gave me for stabilizing it yet. Wanted to ask if ther is somewhere specific that I should put that and I took out the other code, since it was not working. I had increment buttons on the screen and they worked fine for changing the thermostat setpoint, but the correct setpoint never displayed on the screen.

0001 - IF Timer #0 becomes = 0 //
0002 - THEN Variable# 63 / Screen# = 1 //
0003 - THEN Send RCS X10 A Command: Autosend ON //
0004 - THEN Send RCS X10 A Command: Request Temperature //
0005 - IF Receive X10, A - Preset Dim 0 (27) //
0006 - THEN Load Data to: Variable #5 //
0007 - IF Touch Object #2, Button Leopard is pressed //
0008 - THEN Send RCS X10 A Command: Fan ON //
0009 - IF Touch Object #3, Button Leopard is pressed //
0010 - THEN Send RCS X10 A Command: Fan OFF //
0011 - IF Touch Object #4, Button Leopard is pressed //
0012 - THEN Send RCS X10 A Command: Increase 1 Degree //
0013 - THEN Variable #5 + 1 //
0014 - IF Touch Object #5, Button Leopard is pressed //
0015 - THEN Send RCS X10 A Command: Decrease 1 Degree //
0016 - THEN Variable #5 - 1 //
0017 - IF Touch Object #6, Button Leopard is pressed //
0018 - THEN Send RCS X10 A Command: Cool Mode //
0019 - IF Touch Object #7, Button Leopard is pressed //
0020 - THEN Send RCS X10 A Command: Heat Mode //
0021 - IF Touch Object #15, Button Leopard is pressed //
0022 - THEN Send RCS X10 A Command: Auto Mode //
0023 - IF Touch Object #17, Button Leopard is pressed //
0024 - THEN Send RCS X10 A Command: System OFF //
0025 - THEN Send RCS X10 A Command: Request Temperature //
0026 - IF Time of Day is > 00:00 //
0027 - THEN Load Data to: Variable #0 //
0028 - ELSE Load Data to: Variable #0 //
0029 - IF Variable #0 is = Variable #0 //
0030 - THEN Variable #1 = Variable #0 //
0031 - THEN Variable #1 / 60 //
0032 - THEN Variable #10 = Variable #1 //
0033 - THEN Variable #0 % 60 //
0034 - THEN Variable #11 = Variable #0 //
0035 - IF Month is = January (1) //
0036 - THEN Variable #12 = 74 //
0037 - THEN Variable #13 = 97 //
0038 - THEN Variable #14 = 110 //
0039 - IF Month is = February (2) //
0040 - THEN Variable #12 = 70 //
0041 - THEN Variable #13 = 101 //
0042 - THEN Variable #14 = 98 //
0043 - IF Month is = March (3) //
0044 - THEN Variable #12 = 77 //
0045 - THEN Variable #13 = 97 //
0046 - THEN Variable #14 = 114 //
0047 - IF Month is = April (4) //
0048 - THEN Variable #12 = 65 //
0049 - THEN Variable #13 = 112 //
0050 - THEN Variable #14 = 114 //
0051 - IF Month is = May (5) //
0052 - THEN Variable #12 = 77 //
0053 - THEN Variable #13 = 97 //
0054 - THEN Variable #14 = 121 //
0055 - IF Month is = June (6) //
0056 - THEN Variable #12 = 74 //
0057 - THEN Variable #13 = 117 //
0058 - THEN Variable #14 = 110 //
0059 - IF Month is = July (7) //
0060 - THEN Variable #12 = 74 //
0061 - THEN Variable #13 = 117 //
0062 - THEN Variable #14 = 108 //
0063 - IF Month is = August (8) //
0064 - THEN Variable #12 = 65 //
0065 - THEN Variable #13 = 117 //
0066 - THEN Variable #14 = 103 //
0067 - IF Month is = September (9) //
0068 - THEN Variable #12 = 83 //
0069 - THEN Variable #13 = 101 //
0070 - THEN Variable #14 = 112 //
0071 - IF Month is = October (10) //
0072 - THEN Variable #12 = 79 //
0073 - THEN Variable #13 = 99 //
0074 - THEN Variable #14 = 116 //
0075 - IF Month is = November (11) //
0076 - THEN Variable #12 = 78 //
0077 - THEN Variable #13 = 111 //
0078 - THEN Variable #14 = 118 //
0079 - IF Month is = December (12) //
0080 - THEN Variable #12 = 68 //
0081 - THEN Variable #13 = 101 //
0082 - THEN Variable #14 = 99 //
0083 - IF Day of Month is > 0 //
0084 - THEN Load Data to: Variable #15 //
0085 - IF Year is > 0 //
0086 - THEN Load Data to: Variable #0 //
0087 - THEN Variable #0 + 2000 //
0088 - THEN Variable #16 = Variable #0 //
0089 - End Program //

Top
#16416 - 09/14/06 01:14 PM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
You would need to provide a few more details with what you're seeing in variable #5 in the debug screen. You seem to say that you can change it from the Leopard ok but variable #5, (which is supposed to contain the current setpoint) is showing something else... What I'd like to know is: if you change the setpoint using the Leopard, does Variable #5 increment up and down, and eventually get sent to the thermostat when you haven't pressed a button for 4 seconds?

As for keeping track of the setpoint in the Leopard in case someone modifies it directly on the thermostat, this is what Gary's snippets are meant to do. If your addition of lines 5 and 6 are meant to do this, it won't work. Preset dim commands are quite special in that they contain no device address at all. When a device like the RCS thermostat responds with a preset dim command to tell you its setpoint, temperature, etc, its giving you one of 32 possible replies. It does that by responding with one of the 16 housecodes and either Preset Dim 0 or Preset Dim 1. So one of 16 "housecodes" with Preset Dim 0 gives you 16 possible responses and and other 16 possible responses with a Preset Dim 1, for a total of 32 possible replies. The house code field is decoded as a letter in C-Max, but it is not a housecode at all. Instead it is a 4 bit field representing one of 16 values. The "housecode" sequence representing the bit pattern doesn't increase from A to P either, because the bit pattern is both flipped over and also offset. Now you know why Gary's code snippets are so long! He needs to look for one of 32 possible responses in order to determine what the equivalent setting was. The RCS X-10 command table gives you a complete list of the possible responses and what they mean. Thus to use preset dims correctly, you need to send a request to the thermostat and then listen for the response in short time window (about 3 seconds is fine). The lack of any addressing in a preset dim makes the time window method very important in order to avoid misinterpreting commands.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16417 - 09/14/06 03:30 PM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
when i first start the leopard. I go directly to the debug screen and variable 5 shows 0 and my text object for variable 5 shows 0. when I press my up or down increment button the value of variable five changes accordingly and on the leopard the text object changes, and the thermostat recieves the change and changes the setpoint. Second looking at gary's snippet looks to me that it was written to work with the bobcat module, which I do not have or use.
So could you tell me which part of that code I would use and how to implement it into mine?

Top
#16418 - 10/31/06 05:22 PM Re: x10 thermostat [Re: garyblak]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
Hi Guy,

I looked at garys snippets, and it looks to me as if he wrote those to work with the bobcat. Is this so? If it is, then how can it work with my program since I am not using the bobcat.

Top
#16419 - 10/31/06 07:25 PM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
Gary's code does not use any bobcats. It is purely X-10 based. What his code essentially does is look for one of 32 possible replys (as X-10 preset dim commands) to a command that he first sends to the thermostat. If one particular code section is giving you a headache, just post it here and we'll figure it out.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16420 - 11/01/06 01:14 PM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
I really cannot figure out how to integrate it into my program. I have everything working fine except for if someone changes the setpoint on the thermostat, I need it to show on the leopard. My thermostat is set for house code A. If someone can integrate the code for me, I would appreciate it. Here is my code in text format. If you want the program file and touchscreen file, email me at gary.engelke@mail.vipsystems.us and I will send them to you.

0001 - IF Timer #0 becomes = 0 //
0002 - THEN Variable# 63 / Screen# = 1 //
0003 - THEN Variable #5 = 75 //
0004 - THEN Set RCS X10 A Setpoint 75 //
0005 - THEN Send RCS X10 A Command: Autosend ON //
0006 - THEN Send RCS X10 A Command: Request Temperature //
0007 - IF Receive X10, A - Preset Dim 0 (27) //
0008 - THEN Load Data to: Variable #5 //
0009 - IF Touch Object #2, Button Leopard is pressed //
0010 - THEN Send RCS X10 A Command: Fan ON //
0011 - IF Touch Object #3, Button Leopard is pressed //
0012 - THEN Send RCS X10 A Command: Fan OFF //
0013 - IF Touch Object #4, Button Leopard is pressed //
0014 - THEN Send RCS X10 A Command: Increase 1 Degree //
0015 - THEN Variable #5 + 1 //
0016 - IF Touch Object #5, Button Leopard is pressed //
0017 - THEN Send RCS X10 A Command: Decrease 1 Degree //
0018 - THEN Variable #5 - 1 //
0019 - IF Touch Object #6, Button Leopard is pressed //
0020 - THEN Send RCS X10 A Command: Cool Mode //
0021 - IF Touch Object #7, Button Leopard is pressed //
0022 - THEN Send RCS X10 A Command: Heat Mode //
0023 - IF Touch Object #12, Button Leopard is pressed //
0024 - THEN Send RCS X10 A Command: System OFF //
0025 - THEN Send RCS X10 A Command: Request Temperature //
0026 - IF Touch Object #15, Button Leopard is pressed //
0027 - THEN Send RCS X10 A Command: Auto Mode //
0028 - IF Time of Day is > 00:00 //
0029 - THEN Load Data to: Variable #0 //
0030 - ELSE Load Data to: Variable #0 //
0031 - IF Variable #0 is = Variable #0 //
0032 - THEN Variable #1 = Variable #0 //
0033 - THEN Variable #1 / 60 //
0034 - THEN Variable #10 = Variable #1 //
0035 - THEN Variable #0 % 60 //
0036 - THEN Variable #11 = Variable #0 //
0037 - IF Month is = January (1) //
0038 - THEN Variable #12 = 74 //
0039 - THEN Variable #13 = 97 //
0040 - THEN Variable #14 = 110 //
0041 - IF Month is = February (2) //
0042 - THEN Variable #12 = 70 //
0043 - THEN Variable #13 = 101 //
0044 - THEN Variable #14 = 98 //
0045 - IF Month is = March (3) //
0046 - THEN Variable #12 = 77 //
0047 - THEN Variable #13 = 97 //
0048 - THEN Variable #14 = 114 //
0049 - IF Month is = April (4) //
0050 - THEN Variable #12 = 65 //
0051 - THEN Variable #13 = 112 //
0052 - THEN Variable #14 = 114 //
0053 - IF Month is = May (5) //
0054 - THEN Variable #12 = 77 //
0055 - THEN Variable #13 = 97 //
0056 - THEN Variable #14 = 121 //
0057 - IF Month is = June (6) //
0058 - THEN Variable #12 = 74 //
0059 - THEN Variable #13 = 117 //
0060 - THEN Variable #14 = 110 //
0061 - IF Month is = July (7) //
0062 - THEN Variable #12 = 74 //
0063 - THEN Variable #13 = 117 //
0064 - THEN Variable #14 = 108 //
0065 - IF Month is = August (8) //
0066 - THEN Variable #12 = 65 //
0067 - THEN Variable #13 = 117 //
0068 - THEN Variable #14 = 103 //
0069 - IF Month is = September (9) //
0070 - THEN Variable #12 = 83 //
0071 - THEN Variable #13 = 101 //
0072 - THEN Variable #14 = 112 //
0073 - IF Month is = October (10) //
0074 - THEN Variable #12 = 79 //
0075 - THEN Variable #13 = 99 //
0076 - THEN Variable #14 = 116 //
0077 - IF Month is = November (11) //
0078 - THEN Variable #12 = 78 //
0079 - THEN Variable #13 = 111 //
0080 - THEN Variable #14 = 118 //
0081 - IF Month is = December (12) //
0082 - THEN Variable #12 = 68 //
0083 - THEN Variable #13 = 101 //
0084 - THEN Variable #14 = 99 //
0085 - IF Day of Month is > 0 //
0086 - THEN Load Data to: Variable #15 //
0087 - IF Year is > 0 //
0088 - THEN Load Data to: Variable #0 //
0089 - THEN Variable #0 + 2000 //
0090 - THEN Variable #16 = Variable #0 //
0091 - End Program //

Top
#16421 - 11/01/06 03:37 PM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
There are two ways you can get the current setpoint from the thermostat: either you request it periodically, or you put the thermostat in "Autosend" mode, which has it send X10 commands any time the temperature or the setpoint changes. The Autosend method is probably the best approach, unless you're concerned with excessive X-10 traffic over the power line. There is a C-Max command that allows you to set Autosend to ON if you want (THEN Set RCS...). You could sent it maybe once per day, during the night.

As for using Gary's code, let me look at it over the next day to figure out exactly how it works first.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16422 - 11/03/06 09:09 AM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
I have the autosend turned on in line 5 and it does not send the setpoint to the leopard.
Top
#16423 - 11/03/06 09:33 AM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
For the Leopard to receive the setpoint, it needs to look for the specific X10 commands. This is where Gary's code comes in. I have looked over the RCS documentation to try and match it with Gary's code but I still have some reading to do. Basically, it seems the thermostat will first send a status change notification followed by the actual setpoint value. The thing is, preset dim commands (which is what RCS uses) don't have an X10 address in them, so reception timing windows are very important. It could even happen that Gary's code might not support getting the setpoint via autosend, and that you might need to poll the thermostat periodically instead. Let me study this a bit more closely.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16424 - 11/03/06 03:08 PM Re: x10 thermostat [Re: Guy Lavoie]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
From what I can see, Gary's code was written with requesting the setpoint (as opposed to using Autosend) in mind. But it doesn't mean that we can't try to implement autosend instead. Lets try it one step at a time:

1. Assuming that autosend is on and working, you should see the LED on the PSC-05 connected to the termostat blink off a couple of time whenever you manually change the setpoint. This would indicate that the thermostat is autosending the setpoint. You should also see it blink off whenever the displayed room temperature changes.

2. If that works, then we should look for the "setpoint change" notification messages being received on the Leopard. This would be in the form of a house/unit address command for unit 6, followed by a preset dim command of "preset dim 11" according to the RCS command table. In C-Max, it would look like this (assuming house code A for the thermostat):

IF Receive X10 A/6 //look for Single X10 command
THEN Timer #1 = 1 //and start receive timing window

IF Receive X10, F - Preset Dim 0 //if preset dim 11 received
AND Timer #1 is > 0 //and receive window is active
THEN Variable #99 + 1 //then increment the test count by 1
THEN Timer #1 = 0 //and stop timer

IF Timer #1 becomes > 4 //after 4 seconds
THEN Timer #1 = 0 //if no response after 4 seconds, stop timer


You need to know how the preset dim command works to understand how the F - Preset Dim 0 command equates a preset dim level 11 but for now, just believe that it does.

If the above test code works then you will know that the termostat is sending setpoint update notifications and that the Leopard is receiving them, by seeing that variable #99 (or another test variable of your choice) is incrementing by one every time the setpoint is manually changed. If you can confirm that this works then report back and we'll look at the rest of the code needed to capture and decode the setpoint value.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16425 - 11/03/06 04:18 PM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
Ok...I did as you said and in looking at the variable 99 in debug timers and variables, when I change the setpoint on the thermostat the variable 99 increases by 1. Say the setpoint is at 75 and I increase it by 3 to 78, the variable 99 only increases by 1.
Top
#16426 - 11/03/06 04:45 PM Re: x10 thermostat [Re: garyblak]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
I don't know if this makes any difference, but i was watching the x10 monitor and when I pressed the up or down once on the thermostat to change the setpoint by 1 it showed this:

a/6
f/preset dim 0
a/15
c/preset dim 0

the last 2: a/15 and c/preset dim 0

are different depending on how many times I increment the setpoint by.

Top
#16427 - 11/03/06 10:23 PM Re: x10 thermostat [Re: garyblak]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6548
Loc: Montreal, QC, Canada
Yes, that indicates that its working! The last two lines are the setpoint itself, and in your example decodes as a setpoint of 72 deg. according to the RCS documentation.

So to expand on our previous code, try something like this:

IF Receive X10 A/6 //look for Single X10 command (setpoint status change)
THEN Timer #1 = 1 //and start receive timing window
THEN Variable #1 = 1 //this is step 1

IF Receive X10, F - Preset Dim 0 //if preset dim 11 received
AND Timer #1 is > 0 //and receive window is active
AND Variable #1 = 1 //and we are in step 1
THEN Variable #1 = 2 //then advance to step 2

IF Timer #1 becomes > 6 //after 6 seconds
THEN Timer #1 = 0 //if no response after 4 seconds, stop timer
THEN Variable #1 = 0 //and end step count

IF Receive X10 A/15 //look for single X10 command (setpoint value 68 to 99)
AND Variable #1 = 2 //and we are in step 2
THEN Variable #1 = 3 //then advance to step 3

IF Receive X10, M - Preset Dim 0 //if preset dim level 1 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 68 //then setpoint is 68
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, N - Preset Dim 0 //if preset dim level 2 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 69 //then setpoint is 69
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, O - Preset Dim 0 //if preset dim level 3 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 70 //then setpoint is 70
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, P - Preset Dim 0 //if preset dim level 4 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 71 //then setpoint is 71
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, C - Preset Dim 0 //if preset dim level 5 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 72 //then setpoint is 72
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, D - Preset Dim 0 //if preset dim level 6 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 73 //then setpoint is 73
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, A - Preset Dim 0 //if preset dim level 7 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 74 //then setpoint is 74
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, B - Preset Dim 0 //if preset dim level 8 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 75 //then setpoint is 75
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, E - Preset Dim 0 //if preset dim level 9 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 76 //then setpoint is 76
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, F - Preset Dim 0 //if preset dim level 10 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 77 //then setpoint is 77
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, G - Preset Dim 0 //if preset dim level 11 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 78 //then setpoint is 78
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, H - Preset Dim 0 //if preset dim level 12 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 79 //then setpoint is 79
THEN Variable #1 = 4 //and advance to step 4

IF Receive X10, K - Preset Dim 0 //if preset dim level 13 received
AND Variable #1 = 3 //and we are in step 3
THEN Variable #2 = 80 //then setpoint is 80
THEN Variable #1 = 4 //and advance to step 4

IF Variable #1 becomes = 4 //if we just received a setpoint
THEN Variable #1 = 0 //end the step sequence
THEN Timer #1 = 0 //stop the timing window
THEN Variable #99 = Variable #2 //and save the setpoint value in a final variable


This programming example assumes that you will never set your setpoint below 68 or above 80 degrees. I did this for simplicity, although it could be expanded to receive other values. This is not actual tested code but should likely work as-is. Make sure you select the correct house code letter for each preset dim 0 line. The "house code" letter is actually representing a temperature value in these instructions and has nothing to do that actual house codes. Set up a Leopard screen to display the value of variable #99 and it should show the current setpoint a few seconds after you change it manually on the thermostat.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#16428 - 11/06/06 11:10 AM Re: x10 thermostat [Re: Guy Lavoie]
garyblak Offline
newbie


Registered: 09/11/06
Posts: 12
Your a genius....thanks a bunch! Although there was a slight mistake I caught, but I don't know if you had looked at my code. You had variable 1 handling the steps and when I loaded it, it wouldn't work. I noticed my variable 1 in debug and timers was showing 11 all the time. Then I realized that I had already bound variable one to my time display for the hour of day. So, I just switched your variable 1 to another variable not being used. But, once I did that it worked. Then all I had to do was change your variable 99 to my variable 5 which I am using for the setpoint.

LET'S HERE IT FOR GUY!!!!!!!!! HIP HIP HOORAY!!!!!!

Top
Page 1 of 2 12>


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie, Bobkat 
Hop to:
Who's Online
0 registered and 56 anonymous users online.
Recent Posts
am pm
by edr
05/05/17 05:25 PM
Shout Box

Newest Members
brigiel, vevevie, zhutree, 416, saiqul
3003 Registered Users
Forum Stats
3003 Members
19 Forums
3999 Topics
23425 Posts

Max Online: 132 @ 11/13/16 10:07 AM
May
Su M Tu W Th F Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31