ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#20271 - 09/17/08 08:12 PM checking status for a house code
jaetawright Offline
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
#20273 - 09/18/08 06:43 AM Re: checking status for a house code [Re: jaetawright]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
The problem is that you want to keep track if an entire house code has all it's devices OFF or not. Unfortunately, the "Status ON/OFF" messages sent by each device does not update the internal X10 status table, so you could not use a "IF A/1 is OFF AND IF A/2 is OFF..." series of statements to test for this. Since the status update message is only sent by any given switch about itself, there is no way you can know the status of the whole house code unless you create a scheme using flags to track each individual device. This could be done however, using a variable for each unit code status and looking for status updates for each unit code in order to set it's variable to 0 or 1. Not pretty, but possible.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#20275 - 09/18/08 07:22 AM Re: checking status for a house code [Re: Guy Lavoie]
jaetawright Offline
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
#20277 - 09/18/08 08:06 AM Re: checking status for a house code [Re: jaetawright]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
Yes you could do that, although it appears (to me anyways) that the D8 status LED would almost always be on, unless your plan is to use this when leaving in the morning and you sometimes don't turn on any lights at all since you first got up.

Let's suppose that you want getting Status ON from any of those house codes to turn on the D8 status. You could code it something like this:

IF Receive Single X10 C/Status ON
OR Receive Single X10 D/Status ON
OR Receive Single X10 K/Status ON
OR Receive Single X10 L/Status ON
AND Variable #1 = 0
THEN Variable #1 = 1
THEN X10 House D/ Unit 8 Turn ON

IF Time of Day becomes = 1:00
THEN Variable #1 = 0
THEN Tranmsit Single X10 C/All Units Off
THEN Tranmsit Single X10 D/All Units Off
THEN Tranmsit Single X10 K/All Units Off
THEN Tranmsit Single X10 L/All Units Off
(and if the D/8 LED doesn't respond to the all off command):
THEN X10 House D/ Unit 8 Turn OFF
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#20282 - 09/19/08 07:42 AM Re: checking status for a house code [Re: Guy Lavoie]
jaetawright Offline
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 Administrator Offline
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
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
0 registered and 26 anonymous users online.
Recent Posts
how to post an icon
by manu
02/03/12 03:40 AM
Command Pair
by kuro
02/01/12 12:49 AM
Does anyone have a copy of the latest TSE?
by sevenzenith1
01/30/12 05:17 AM
Have HAL2000 do the work or the Ocelot?
by khem
01/28/12 02:49 PM
Ocelot + Powermid = Fail
by Guy Lavoie
01/27/12 03:37 PM
Shout Box

Newest Members
dfgg, manu, kuro, sevenzenith1, chuck214
2748 Registered Users
Forum Stats
2747 Members
19 Forums
3835 Topics
22711 Posts

Max Online: 67 @ 08/16/11 03:08 PM
February
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