Please login or register.

Login with username, password and session length
Advanced search  

News:

The X10Hub (PiX10Hub) is here! Created by the Community, for the Community.:)% #:)

Author Topic: Anyone got a simple python script?  (Read 5572 times)

queequeeg

  • Jr. Member
  • **
  • Helpful Post Rating: 0
  • Posts: 10
Anyone got a simple python script?
« on: February 16, 2011, 07:09:18 PM »

I am trying to learn python, and I would love to get my hands on a simple python script. I am currently using just devices and just need something i can dim, turn on, or turn off.

If not can someone give me a advice on what language that a beginner could learn?
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 265
  • Posts: 9456
  • I don't work for X10, I use it successfuly!
    • Tuicemen Software
Re: Anyone got a simple python script?
« Reply #1 on: February 16, 2011, 07:23:00 PM »

If not can someone give me a advice on what language that a beginner could learn?
I'd recommend VB.net express, It's  free from Microsoft.
 >!
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum

jaraco

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 8
Re: Anyone got a simple python script?
« Reply #2 on: March 01, 2011, 05:41:23 AM »

I am trying to learn python, and I would love to get my hands on a simple python script. I am currently using just devices and just need something i can dim, turn on, or turn off.

The best way to do this currently is to use the COM interfaces, supplied by the SDK. Assuming you have the SDK installed properly, and also 32-bit Python with the pywin32 extensions, you should be able to start sending commands to your device with something like the following:

Code: [Select]
from win32com.client import Dispatch
ah = Dispatch('X10.ActiveHome')
ah.SendAction("sendrf", "a1 on")

That should get you started. Just look for other COM interface examples - they should work similarly in Python as in VB or other languages.

You might also find that some people have chosen to call the ahcmd.exe as a subprocess in order to get things to work. In Python, you can do this:

Code: [Select]
import subprocess
subprocess.check_call(['ahcmd', 'sendrf', 'A1', 'on'])

Hope that helps!
Logged

EL34

  • Hero Member
  • *****
  • Helpful Post Rating: 21
  • Posts: 278
    • My X-10 projects
Re: Anyone got a simple python script?
« Reply #3 on: March 18, 2011, 04:19:11 PM »

I 2nd Tuices post

I used to try and do all my X10 programming with perl

Then I switched to VB2008 express (free)
The world of windows programming opened up and the X10 stuff was way easier to do.

VB2010 express is available now.
My advice is to bite the bullet and get into VB.net programming.
Logged
W10 - CM15A - AHP 3.301 - i Witness - MyHouse online - Smart Macros - SDK using Visual Basic express 2008
My X10 page-> http://www.el34world.com/Misc/home/X10_0.htm
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.