Page 1 of 1
x10 scripts
Posted: Sat Dec 31, 2005 1:59 pm
by ekraus
If I could just get a sample x10 script I think I would be in business. Just to get an idea of the structure.
I am not sure where to begin. I have created themes with buttons that can only send one command. With no feedback.
Something like a slider bar to control brightness. Or sending commands to several modules with one button.
I am new to Housebot and Medio.
So far it looks quite powerful but without a tutorial on scripts it may take me forever to get it working.
Posted: Sat Dec 31, 2005 5:47 pm
by spike5884
Scripts are basically Microsoft VB Script. Check the Script Device help for examples. Here is something I have done. Not x10 specific, but shows the power of HB and script.
[Edit by ScottBot]Stock Getter script attached
Posted: Mon Jan 02, 2006 9:32 pm
by spike5884
Evan contacted me off-line and I sent him an x10 example of mine. I have uploaded it to the following location for anybody elses use.
[Edit by ScottBot]Multiple x10 Changer script attached
Posted: Mon Jan 02, 2006 9:39 pm
by spike5884
Evan asked the following by private email. Thought it maybe of interest to the group, so I am posting my answer here.
I got it!
Its great!
Can I have that script fed different variables from another script then execute it?
This would also allow me to use the script for multiple buttons without duplicating it with the groups for each button.
My remote has a screen for whole house.
All bedrooms, Living room, Kitchen all have multiple devices
I hope this is not asking too much!
I have not written any code in 20 years so this is all net to me. Especially the conventions of VB.
Thanks Evan
Evan,
If you are talking about the MultX10Chgr, You would just need to set the "X10 Commands" Property, and then set the "State" Property to
Running. This can easily be done from any Task or another script.
States Disapearing
Posted: Sun Jan 08, 2006 5:53 am
by ekraus
The script works fine but my states are disapearing.
Example
Default=P;1;2;Off to P;1;2;On
P;1;2;On
Next State=P;1;2;On to P;1;2;Off
I put all my states in, save the Theme Run my software Remote
The script executes once.
I go back and look at the theme and the second state is gone.
Any Ideas?
The device was working BUT
Posted: Thu Jan 12, 2006 4:17 am
by ekraus
I had it working but now its not passing the commands to the Powerlinc.
Although the powerlinc will work with other multistate buttons.
Nice script device BUT
Posted: Fri Jan 13, 2006 5:23 am
by ekraus
This is a really nice script device but I can't figure out why it will not pass the command to the powerlinc controller.
Can anyone help me ?
Posted: Fri Jan 13, 2006 6:56 am
by spike5884
The MultX10Chgr script uses a brute force method. It does not "talk" to the PowerLinc directly. It goes thru your devices looking for the property "X10 House Code". When found and the house/unit code matches, it then changes the device's "Power State" property to the desired state.
So, if manually changing the power state works, this scipt should work. Does it work when you run it manually?
Posted: Sun Jan 15, 2006 7:53 am
by ekraus
I know the script executes but I see no commands on the PLC.
I can see the values change in the x10 Commands line.
I put a print statement in it and it executed to the end.
So I am not sure what is going on.
I thought that the way to configure the script was by creating a multi state button. With 2 states.
P1 On
P1 Off
Using the proper format P;1;On
I see the change when the button is pressed on the remote.
But no results
Can the MultX10Chgr be used for multiple buttons each having different house codes and different unit codes?
Thanks Evan
Posted: Sun Jan 15, 2006 7:59 pm
by spike5884
If the script is running and changing the correct x10 device, your problem is else where and not with the script.
Posted: Mon Jan 16, 2006 5:47 am
by ekraus
I cant get the script to start from my software remote.
Works fine manually.
Button Creation
Posted: Mon Jan 16, 2006 6:14 am
by ekraus
Was I correct about how to create the buttin?
Example:
Multi State Button
Property Change
Device = MultiX10Chgr
Property = X10 Commands
Preform Action when Button is pressed = Checked
States
1
If Value is: P;1;Off
Change Value To: P;1;On
2
If Value is: P;1;On
Change Value To: P;1;Off
Thanks Evan
Posted: Mon Jan 16, 2006 7:13 pm
by spike5884
If you are only changing one x10 device, why not just do it directly? The script was created to work on a bunch of devices with a single command.
Anyway, you are missing the step where the state of the script device needs to be changed to running.
Changing the state
Posted: Tue Jan 17, 2006 6:16 am
by ekraus
I am using it for multiple devices!
That was just an example.
Perhaps I have this all wrong.
Do I change the state of the script with the button press?
If so then the button creation is incorrect!.
Multi State Button
Property Change
Device = MultiX10Chgr
Property = X10 Commands
Preform Action when Button is pressed = Checked
States
1
If Value is: P;1;Off
Change Value To: P;1;On
2
If Value is: P;1;On
Change Value To: P;1;Off
Posted: Tue Jan 17, 2006 9:32 pm
by spike5884
This should help make your set-up work: Create a task so you end up with something like:
If ( 'MultiX10Chgr.X10 Commands' is Not Equal 'Something') Then
Change 'MultiX10Chgr.State' to 'Running'