This has really got me confused. First let me point out that my programing level is non-existent so I am barely able to figure out the basic stuff.
I've got a cheap motorized video screen from Ebay which I can not get the remote to work. Not a big deal since I want to add it to my automation anyway. So I put a AM466 Appliance module on each AC feed to the screen motor, up and down, and have tried writing scripts to control the movement. Should be simple enough. Example, the up script first turns off the the down module and then turns on the up module and vice versa for the down script. The stop script simple turns off both modules.
The problem is the stop script works when I'm testing with a lamp and a fan but not always when plugged into the screen. For instance when lowering and trying to stop the screen jerks as if the up module was activated and then continues moving down. The module is not stopped, power is still going to the screen.
I know this may be a hardware issue, not a SDK issue but I wanted to know if there is a better way of doing what I'm doing. Here are the scripts.
Down script, (up is the same with the module numbers reversed).
Loop,3
{
Run C:\X10\ahcmd.exe sendplc m15 off
}
IfWinExist X10 ActiveHome Scripting Commandline
{
WinActivate
sleep, 5
winkill
}
else
{
}
Sleep, 250
Run C:\X10\Screen\Down
Sleep, 60000
IfWinExist X10 ActiveHome Scripting Commandline
{
WinActivate
sleep, 5
winkill
}
else
{
}
Loop,3
{
Run C:\X10\ahcmd.exe sendplc m16 off
}
IfWinExist X10 ActiveHome Scripting Commandline
{
WinActivate
sleep, 5
winkill
}
else
{
}
Explanation,
1. First I send the off command three times to be damn sure both modules are never running at the same time.
2. Then kill the SDK crash window, short pause to make sure this happens.
3. Lower screen with a pause long enough to get it to the level I need.
4. Kill crash screen.
5. Send off command three times to be sure the screen stops.
6. Kill crash window, script exits automatically.
Stop script. Used to stop movement before other scripts end if needed.
IfWinExist X10 ActiveHome Scripting Commandline
{
WinActivate
sleep, 5
winkill
}
else
{
}
process, close, Up.exe
process, close, Down.exe
Sleep, 250
Run C:\X10\ahcmd.exe sendplc m allunitsoff
IfWinExist X10 ActiveHome Scripting Commandline
{
WinActivate
sleep, 5
winkill
}
else
{
Exit
}
1. Kill the crash window the other script may have caused.
2. Kill the other scripts in case they are still causing the movement.
3. Short pause to sure this is done.
4. Turn off all units on the M band.
5. Kill crash window, script exits.
My method is using a simple shortcut, because I can change the icon, to call the script which is done in "Auto Hot Keys", A cool little program I found for doing short cuts and hot keys and I can almost understand. I use that because as far as I can tell I can only use one command per windows short cuts.
As I said this works with a light and a fan, still does, it worked sometimes with the screen but now it never gets the modules to turn off. The screen jumps as if the up module has been activated then continues down. Why does the power turn off when plugged into other appliances but not with the screen?
Oh, the AHP monitor shows all the commands being sent correctly.
Also if someone can tell me a better way to do this I would appreciate it.
Thanks in advance for any help.
Rich
Update;
I've started grasping the concept of how macros can be loaded into the interface and this makes the programing much easier. So using Active Home I've figured out that it is only when I try to use the stop command to stop movement either direction. When the working module receives the stop command for the other module it causes a stutter. It sounds like the relay trips and turns off the power but then sets back again. If I separate the off commands out and delay the second one, the module still stutters when the first one is received then may or may not respond when it gets it's off command.
The only so solution I can find is to separate the two off commands and never uses one while the other module is running.