x10 scripts

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

x10 scripts

Post 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.
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Post 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
Attachments
StockGetter.zip
(2.81 KiB) Downloaded 399 times
Thanks,
Scott J
aka spike5884
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Post 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
Attachments
MultX10Chgr.zip
(1.42 KiB) Downloaded 376 times
Thanks,
Scott J
aka spike5884
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Post 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.
Thanks,
Scott J
aka spike5884
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

States Disapearing

Post 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?
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

The device was working BUT

Post 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.
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

Nice script device BUT

Post 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 ?
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Post 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?
Thanks,
Scott J
aka spike5884
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

Post 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
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Post by spike5884 »

If the script is running and changing the correct x10 device, your problem is else where and not with the script.
Thanks,
Scott J
aka spike5884
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

Post by ekraus »

I cant get the script to start from my software remote.

Works fine manually.
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

Button Creation

Post 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
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Post 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.
Thanks,
Scott J
aka spike5884
ekraus
Member
Posts: 13
Joined: Sat Dec 31, 2005 3:14 am

Changing the state

Post 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
spike5884
Senior Member
Posts: 129
Joined: Thu Aug 26, 2004 8:08 am
Location: WI

Post 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'
Thanks,
Scott J
aka spike5884
Post Reply