Sending X-10 code ONLY when condition changes
Falcon
Posts: 191
Hello,
I am working on a security system project for my house using microswitches to monitor the condition of the door locks. Currently I have a microswitch attached to an X-10 Powerflash module that sends signals to my PC via a CM15A. I have Active Home Pro on my PC with the Active Phone Pro plug-in. I have the Active Phone Pro app on my Droid X that will let me change the modules, and will also display the current condition of all modules (ON or OFF.) I want to eventually monitor 6 doors and windows so I want to use the BS2e wto gather the condition of the sensors and send it to the PC, and ultimately my Droid X using the XOUT command. I want to avoid a bank of 6 Powerflash modules tying up all those outlets.
I have the basis of the code written but have the following question:
I want to minimize the number of XOUT commands sent to my phone so it doesn't continually receive updates that the same door is still locked. I want to ONLY send the ON and OFF codes when the condition changes. I assume I need to monitor the current condition of each door lock and set that as a variable but I'm at a loss for how to switch to monitoring the opposite condition once the lock condition in changed.
I have successfully used the XOUT commands before for a thermostat but that was several years ago and I haven't written any code since.
See code I've written so far in attachment, but not tested with circuit.
All replies are appreciated.
Falcon
I am working on a security system project for my house using microswitches to monitor the condition of the door locks. Currently I have a microswitch attached to an X-10 Powerflash module that sends signals to my PC via a CM15A. I have Active Home Pro on my PC with the Active Phone Pro plug-in. I have the Active Phone Pro app on my Droid X that will let me change the modules, and will also display the current condition of all modules (ON or OFF.) I want to eventually monitor 6 doors and windows so I want to use the BS2e wto gather the condition of the sensors and send it to the PC, and ultimately my Droid X using the XOUT command. I want to avoid a bank of 6 Powerflash modules tying up all those outlets.
I have the basis of the code written but have the following question:
I want to minimize the number of XOUT commands sent to my phone so it doesn't continually receive updates that the same door is still locked. I want to ONLY send the ON and OFF codes when the condition changes. I assume I need to monitor the current condition of each door lock and set that as a variable but I'm at a loss for how to switch to monitoring the opposite condition once the lock condition in changed.
I have successfully used the XOUT commands before for a thermostat but that was several years ago and I haven't written any code since.
See code I've written so far in attachment, but not tested with circuit.
All replies are appreciated.
Falcon
Comments
HTH,
--Rich
Thanks for the help RiJoRi
Sorry for the delayed response. I'm out of the US right now with sporadic internet access.
I initially used the X-10 function to monitor my sensors over the internet using the Active Phone Pro software and app. It's actually a nice app but I want to eventually expand to more functions.
I've since switched to a PINK module and wrote a simple webpage to view the status changes. You can see a recent version of code in a thread called "Read state if INPUT in loop."
I'm a noob code writer so it's probably pretty clunky as far as efficiency...but I'm working on that.
falcon