#20271 - 09/17/08 08:12 PM
checking status for a house code
|
jaetawright
newbie
Registered: 04/27/08
Posts: 15
|
Is there any way to check the status of a particular house code - here is what I want to do and my pseudocode:
If Var1=1 skip to X elseif recieve Status On from housecodes C,D,K,L send D8 Status On, set Var1 = 1
If all above housecodes are in Status OFF send D8 Status Off, set var1=0
Basically, All of my switches and dimmers report their status using the status on and status off transmission. I have an 8 button transmitter (its an A-10 tk184) that is addressed D1 through D8. I want to toggle the on-state of the D8 LED, and then if I am leaving the home, and D8 is on, I can then push it and cause the "all lights off" to fire for each housecode.
Thanks, Jon
P.S. Guy if you read this, thanks for the OLD version of Cmax, but could never get the CPU-XA working, so now Ive got me an Ocelot.
_________________________
I say HA is fun, my wife says that it's overrated, but she still picks up the remote!
|
|
Top
|
|
|
|
#20275 - 09/18/08 07:22 AM
Re: checking status for a house code
[Re: Guy Lavoie]
|
jaetawright
newbie
Registered: 04/27/08
Posts: 15
|
Hi guy, I was afraid you were going to say that. do you see any issues with looking for x-10 "C / Status on" and setting var1 to 1, then I know that some light in C has turned on. do it similarly for all other house codes, then the first time any light is on, send the D8 on to toggle the switch. Finally, everyday at say 1 am or so, send C,D,K,L all off, reset all the vars, and send D8 off, because presumably everything will be off at that time.
I know that it leaves the possibility of indicating that all lights are off when in fact some are on, but the function of D8 is to be able to kill all lights as we are leaving with one button. I know that this scenario has the limitations mentinoed above - did I miss any. I just dont want to set a var for every housecode/number that i have, although it would be possible because I only have 22 devices, just that it would take a lot of code to track all 22 with Cmax
Jon
_________________________
I say HA is fun, my wife says that it's overrated, but she still picks up the remote!
|
|
Top
|
|
|
|
#20282 - 09/19/08 07:42 AM
Re: checking status for a house code
[Re: Guy Lavoie]
|
jaetawright
newbie
Registered: 04/27/08
Posts: 15
|
Good Morning Guy, and everyone else.
Well, so much for the simple way out. In discussing this with my wife last night, she doesn't want "that stupid little LED on all the time" So it looks as if i am going to have to track the state of each x10 address through variables. I will simply toggle it between 0 and 1, and then I will increment or decriment a final variable so that if it becomes not 0, the LED goes on, and if it becomes 0 the LED goes off. Having said that, here is the question.
What exactly is the Ocelot aware of? What I mean is that if a light is switched locally, the switch reports Address/Status, can I intercept that as "Turns On" or "Is On". The other way a light is switched is by a wall controller sending the "on command pair" followed by a status request, to which the switch will respond as if it was swiched locally.
Something like this 0001 - IF Entryway-Light, Turns ON // 0002 - THEN Front-Entry = 1 // 0003 - THEN Any-Light-is-On + 1 // 0004 - IF Entryway-Light, Turns OFF // 0005 - THEN Front-Entry = 0 // 0006 - THEN Any-Light-is-On - 1 //
Thanks
Jon
_________________________
I say HA is fun, my wife says that it's overrated, but she still picks up the remote!
|
|
Top
|
|
|
|
#20283 - 09/19/08 11:27 AM
Re: checking status for a house code
[Re: jaetawright]
|
Guy Lavoie
Beyond All Hope
   
Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
|
The Ocelot maintains a X10 status table that allows you to test if a specific X10 address is deemed to be on or off. It updates the status of a device whenever it sees it being turned on or off by a command pair (or by a multiple addressing command sequence such as A/1, A/2, A/3, A/ON). If the switch would send a ON or OFF command pair instead of a status update, then it could track that.
To track the status yourself by observing the status updates, you would need to create your own code and track the status using variables. Since your switches send out an addressing command followed by a status update, you would need look for the two single X10 transmissions occurring within a short interval. So you could look for an addressing command and if that occurs, start a timer to look for a status update within a couple of seconds for the same house code. Something like this:
IF Receive Single X10 A/1 THEN Timer #1 = 1 //start the timer
IF Timer #1 is > 0 //see if timer is running ELSE Skip to line xxx //else skip the whole routine
IF Receive Single X10 A/Status ON THEN Variable #1 = 1 //set status for A/1 to on IF Receive Single X10 A/Status OFF THEN Variable #1 = 0 //set status for A/1 to off
(line xxx) IF Timer #1 becomes > 3 THEN Timer #1 = 0 //after 3 seconds, stop the timer
IF Receive Single X10 A/2 THEN Timer #2 = 1 //start the timer
IF Timer #2 is > 0 //see if timer is running ELSE Skip to line yyy //else skip the whole routine
IF Receive Single X10 A/Status ON THEN Variable #2 = 1 //set status for A/2 to on IF Receive Single X10 A/Status OFF THEN Variable #2 = 0 //set status for A/2 to off
(line yyy)
IF Timer #2 becomes > 3 THEN Timer #2 = 0 //after 3 seconds, stop the timer
...
IF Variable #20 = Variable #20 //always true... THEN Variable #20 = Variable #1 //add up all the variables THEN Variable #20 + Variable #2 THEN Variable #20 + Variable #3
...
IF Variable #20 becomes > 0 //if all added statuses becomes 1 or more THEN X10 House D/ Unit 8 Turn ON //turn on the LED
IF Variable #20 becomes = 0 //if all added statuses becomes 0 THEN X10 House D/ Unit 8 Turn OFF //turn off the LED
The routine could be optimized to use less timers, etc but I just wanted to show you the general idea here.
_________________________
"If you don't know what you're doing, do it neatly..."
|
|
Top
|
|
|
|
Moderator: Dan Smith, Monte G, ADI Tech Support, Guy Lavoie
|
0 registered
and 26 anonymous users online.
|
|
2747 Members
19 Forums
3835 Topics
22711 Posts
Max Online: 67 @ 08/16/11 03:08 PM
|
|
|
|
|
|
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
|
|
|
|
|
|