Help with AutoIt and HomeSeer please....

JohnWPB

Active Member
Ok, I could use a little help here, I did some searching on the forums, and see that "Dan the handyman" :unsure: is familiar with AutoIt.

What I am trying to do is control HomeSeer with AutoIt through the Com Interface. (Home seer 1.7x by the way)

I have been successful in getting device status from Home Seer, but can not seem to send a command to it. It is surely something to do with the syntax I am using to do this.

Here is the test script that I have thus far:

Code:
$hs = ObjCreate("homeseer.application")

; Get the status of a device (Working)
$MyDevice = $hs.devicestatus("A3")

if $MyDevice = 3 then $MyStatus = "Off"
if $MyDevice = 2 then $MyStatus = "On"
if $MyDevice = 4 then $MyStatus = "Dimmed"
MsgBox(0, "Status", $MyStatus)

; To this point, all above works, Below this line nothing works

; Execute an X10 Command

if $MyDevice = 3 then hs.execX10 "A3", "On" , 50
if $MyDevice = 2 then hs.execX10 "A3", "Off" , 50

.execX10 "A3", "On" , 50

When I run the script, I am getting a message box, with the status of the test device correctly.
AutoIt is choking at the part highlighted in green above.

Once I get this working, my plans are to use the Road Runner Front end to control HS from a Touch screen. Road Runner was developed for CarPC's but is a very powerful program and super easy to work with. Skinning it is just a matter of creating a jpg/png image of your interface, and then in it's skin editor, drawing a box around the buttons or "touch area's" of the image, and entering a command that you want executed when the area you selected is pressed. It also has a COM interface, so using AutoIt I can get info from HS and send to RR and visa versa.

I decided to go this route, as it has all music and video library management/playlists, viewing, weather, traffic, embedded web browser, games, and anything else you could think of already to go! Oh, and did I mention that it is free :lol:

Any help with this is greatly appreciated as always!
 
Ok, I could use a little help here, I did some searching on the forums, and see that "Dan the handyman" :unsure: is familiar with AutoIt.

What I am trying to do is control HomeSeer with AutoIt through the Com Interface. (Home seer 1.7x by the way)

I have been successful in getting device status from Home Seer, but can not seem to send a command to it. It is surely something to do with the syntax I am using to do this.

Here is the test script that I have thus far:

Code:
$hs = ObjCreate("homeseer.application")

; Get the status of a device (Working)
$MyDevice = $hs.devicestatus("A3")

if $MyDevice = 3 then $MyStatus = "Off"
if $MyDevice = 2 then $MyStatus = "On"
if $MyDevice = 4 then $MyStatus = "Dimmed"
MsgBox(0, "Status", $MyStatus)

; To this point, all above works, Below this line nothing works

; Execute an X10 Command

if $MyDevice = 3 then hs.execX10 "A3", "On" , 50
if $MyDevice = 2 then hs.execX10 "A3", "Off" , 50

.execX10 "A3", "On" , 50

When I run the script, I am getting a message box, with the status of the test device correctly.
AutoIt is choking at the part highlighted in green above.

Once I get this working, my plans are to use the Road Runner Front end to control HS from a Touch screen. Road Runner was developed for CarPC's but is a very powerful program and super easy to work with. Skinning it is just a matter of creating a jpg/png image of your interface, and then in it's skin editor, drawing a box around the buttons or "touch area's" of the image, and entering a command that you want executed when the area you selected is pressed. It also has a COM interface, so using AutoIt I can get info from HS and send to RR and visa versa.

I decided to go this route, as it has all music and video library management/playlists, viewing, weather, traffic, embedded web browser, games, and anything else you could think of already to go! Oh, and did I mention that it is free :lol:

Any help with this is greatly appreciated as always!

Instead of AutoIt you could try EventGhost, then you can run EG litely on each interface machine and have a more configured version on the server.

What are you using to communicate x10?
 
Since the problem seems to be with sending commands, can you try using hs.writelog and see if it still hangs.
 
Ok, I could use a little help here, I did some searching on the forums, and see that "Dan the handyman" :unsure: is familiar with AutoIt.

What I am trying to do is control HomeSeer with AutoIt through the Com Interface. (Home seer 1.7x by the way)

I have been successful in getting device status from Home Seer, but can not seem to send a command to it. It is surely something to do with the syntax I am using to do this.

Here is the test script that I have thus far:

Code:
$hs = ObjCreate("homeseer.application")

; Get the status of a device (Working)
$MyDevice = $hs.devicestatus("A3")

if $MyDevice = 3 then $MyStatus = "Off"
if $MyDevice = 2 then $MyStatus = "On"
if $MyDevice = 4 then $MyStatus = "Dimmed"
MsgBox(0, "Status", $MyStatus)

; To this point, all above works, Below this line nothing works

; Execute an X10 Command

if $MyDevice = 3 then hs.execX10 "A3", "On" , 50
if $MyDevice = 2 then hs.execX10 "A3", "Off" , 50

.execX10 "A3", "On" , 50

When I run the script, I am getting a message box, with the status of the test device correctly.
AutoIt is choking at the part highlighted in green above.

Once I get this working, my plans are to use the Road Runner Front end to control HS from a Touch screen. Road Runner was developed for CarPC's but is a very powerful program and super easy to work with. Skinning it is just a matter of creating a jpg/png image of your interface, and then in it's skin editor, drawing a box around the buttons or "touch area's" of the image, and entering a command that you want executed when the area you selected is pressed. It also has a COM interface, so using AutoIt I can get info from HS and send to RR and visa versa.

I decided to go this route, as it has all music and video library management/playlists, viewing, weather, traffic, embedded web browser, games, and anything else you could think of already to go! Oh, and did I mention that it is free :lol:

Any help with this is greatly appreciated as always!
John,
I'm not seeing the entire script. Can you edit it so it all shows up?
 
Wow, thanks for all the quick replies guys!

That is the whole script :unsure: It is just for testing purposes at the time being, so thats all that's needed.

The device is a test desk lamp on A3, and am setting to either on or off, so thats the only 2 cases for testing.

The msgbox is reporting the status of the device, so communication with HomeSeer is working to that point no problem.

When I said "Hangs" I meant the script, not the communication. When it gets to the line to send info to HS, the script errors out and the part in green above is the part that the error box is reporting. I know it is just a syntax problem, but cant seem to figure it out. as HS needs so many variables and such passed for a device, and not just a simple "a3On" type command ect.

I am using AutoIt as I know it pretty well inside and out, and have full bidirectional communication with Road Runner already with the scripts. When RR starts, it can actually poll HomeSeer and get all the correct device status's ect. (Well as accurate as they are in Home Seer anyways :lol:


I am looking to use THIS DEVICE for the touchscreen. It is almost a ghz, and gonna get the extra memory for it so it will have 768 Megs of mem. That is far more than enough to run Road Runner. Road RUnner runs smoothly on some of the old M1000 CarPC boards with no problem at all. It can also be used for remote desktop as well of course, as it is XP Tablet edition installed on it.
 
Yes, AutoIt seems very impressive. :unsure:


I meant what hardware device are you talking x10 with? The CM11a or the USB version or the OEMable transmitter?
 
Yea, Autoit is really nice as you can compile stand alone exe's. I have been programming with AUtoIt for a year now, and have become quite good at it. I am using a CM11a with Home Seer 1.7x. There are lots of CM11a command line programs, but I want to do this with Home Seer, so I can keep status on devices, as well as fire an event in HS on certain button presses ect.

Currently in ROad Runner, I have been able to skin a screen that displays the status of my devices. Now if I could only control them! :unsure:


I know it is just a syntax problem with the code, but Cocoon, HS forums and AutoIt forums have turned up nothing, as the commands to HS have to be in a certain format. Sending in that format is where the syntax problem is coming into play.
 
Did you just try a normal on like hs.execX10 "A3", "On" , 0, 0

I have now, same spot that it errors out in the script:
autoiterrorfs6.jpg
 
I know nothing about AutoIt, but it looks almost as if it doesn't understand the "then" part is a command. The other IF statements in the script are simple assignments. Is there another form of the IF statement in AutoIt that might understand that you are executing the hs.execx10 command? Like maybe IF ... ELSE ... ENDIF or where you can put multiple statements in a portion of the IF statement?

Try putting parentheses around the entire hs.exec... command? Or is it a missing $ in front of the hs.execx10? I forget how it needs to be in this context.

Might it be that AutoIt only understands single parameters being passed. like older HS versions?
 
I know nothing about AutoIt, but it looks almost as if it doesn't understand the "then" part is a command. The other IF statements in the script are simple assignments. Is there another form of the IF statement in AutoIt that might understand that you are executing the hs.execx10 command? Like maybe IF ... ELSE ... ENDIF or where you can put multiple statements in a portion of the IF statement?

Try putting parentheses around the entire hs.exec... command? Or is it a missing $ in front of the hs.execx10? I forget how it needs to be in this context.

Might it be that AutoIt only understands single parameters being passed. like older HS versions?


It's definitely nothing to do with the if/then/else statements. If you look at the top portion of the script, that is working fine, it's the same exact if/then/else logic being used. I have been programming in AutoIt for a while and have written some pretty complex scripts. One is over 500 lines of code. It does come down to the syntax of the multiple commands on the line being passed. I have tried surrounding the entire line in parentheses as you suggested, and other variations of quotes and such, with no luck yet. I was hoping someone with HS had already tackled something like this with AutoIt.

For those not familiar with AutoIt, It's code is very similar to VB script, but it is a lot more powerful. It can get a lock on a programs GUI, meaning it can press a button in just about any application, even when that application is minimized. This is why it is used so mych in Road Runner, as you can put a command for instance on the GPS screen for the CarPC, with code to access iGuidance (Mainly used GPS nav program) that will step through the menu's and access that command with a single press. Fo instance you can create a "Favorites" button in the skin to access the favorites with a single tap. The alternative to do this with iGuidance would be to press a button to bring up the iGuidance menu screen, then press the destination button, then press the favorites button. While driving, its much easier to use a single press of a button for sure :D

I know this is a bit off topic for here, but ties in nicely with any touchscreen front end, as it minimizes the screen taps, and such to control just about any embedded program easily in a touch screen environment. It can screen scrape URL's, you can create impressive GUI's and tons of other stuff.

The main plus is that you right click on the script icon when you are done with it and choose "Compile EXE" and that program will then run on any system with or without AutoIt installed.
 
Finally! Got an answer from the AutoIt forums, it needed to be surrounded in Parantheses. Here is the line that now works perfectly!

if $MyDevice = 2 then $hs.execX10 ("A3", "On" , 50)

Fixing the code, I now have a Road Runner screen, that when "Test Lamp" button is tapped, it turns off the light if it's on, and off if it is on, and shows the status of the light, weather on or off.

This is going to be making a touch screen interface so easy! As I can pass the device number from the button to the script. Meaning a simple:

if $MyDevice($DevNumber) = 2 then $hs.execX10 ("A3", "On" , 50)

So only 4-5 lines of code will be needed in the script to work for ANY device, as long as I just put the device number to pass to the script on the button code.

Thanks for all the help guys!

Attached is a small exe file, that when ran, will control an A3 device code through Home Seer. (You do not need AutoIt installed for the exe to work) If the A3 device on on it will turn it off, if off will turn it on ect. If you have AutoIt installed, you can decompile the scrip, to edit, or see how it works ect.

EDIT:

I just added the code to pass the information to the script from Road Runner. The button code in Road Runner looks like this:

Code:
"RUNQW;$SkinPath$Scripts\test.exe|A7"

Now, all that is needed, is to change the "A7" in the above line to any other device code. in less than 2 minutes, I have all devices in the mater bedroom working, as all I had to do was copy the button, drag it to a new area on the screen, and change the device code in the Road Runner WYSIWYG editor. This is going to be so sweet when completed!

As I have been using Road Runner in the car for a couple years, I already have email, DVD's, Music, Weather, TV, Video Camera (Backup cam in the car) and all set up already. I just have to finish adding all the buttons and graphics for the Home Automation screens.

If anyone else is interested in this, let me know and I will gladly share the code and such. you can already download my skin for Road Runner for in car use from johnwpb.com.
 

Attachments

  • Control_A3_Device.zip
    190.8 KB · Views: 16
Back
Top