[IronPython] Accessing Serial Port from IronPython driven Webpage
vernondcole at gmail.com
Wed Aug 25 18:29:53 PDT 2010
What x.10 misses in reliability, it makes up for by being inexpensive. I
have had the x.10 devices miss a command, sometimes, probably less than 1%.
It's not a problem with brighten or dim commands, the temperature feedback
will just repeat the command next loop if neeed. To turn things on or off,
the following code completely cures the problem. ;-)
"""Send "controlSring" to x.10 home automation transmitter."""
controlString = controlString.upper()
lastToken = controlString.rsplit(' ',1)
if lastToken in ['ON','OFF']: #auto retry for "on" or "off"
time.sleep(0.2) # just in case the first one did not work
I missed your comment about a web BROWSER. Somehow, I read it as a web
SERVER. Yes, direct control of serial ports would be a serious security
risk from a browser, and probably SHOULD be hard or impossible to do. I
think it might be much easier to roll a custom program using Sockets for
your home controller. IMHO, people tend to use browser-based technology a
lot because it's the first idea that comes to mind. The first idea may not
be the best. Using Python sockets may be simpler and is SURE to have a
On Wed, Aug 25, 2010 at 5:56 PM, Kurt A. Richardson <kurt at kurtrichardson.com
> On 8/25/2010 4:53 PM, Kurt A. Richardson wrote:
>> Thanks Vernon
>> I did look at Pyserial, but then I realized that with IronPython I could
>> just use System.IO.Ports.SerialPort to do it all anyway... then it seemed
>> pointless to use PySerial if the capability is already available in
>> IronPython. It works fine on Mono too, and I have run successful tests in
>> Linux Juanty (which my PlugPC runs). The problem I have now is not talking
>> to the serial port per se... it is doing it from within a web browser, which
>> as I understand it is a security issue. The browser security policy just
>> won't give me access to the serial port whatever library I might be using.
>> The link I posted earlier shows how to overcome the security restrictions
>> in C# - I just don't know how to translate this into an IronPython class :-(
>> Bye for now, Kurt
> BTW Your project sounds pretty cool - not wishing to clutter this thread,
> but how reliable are you finding the X10. I have a TED5000 which just
> monitors my total load, and it sux - this is why I chose wireless ZigBees
> when putting together my Smart Home Network.
> Ta ta for now, Kurt
> Users mailing list
> Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Users