Thursday, July 24, 2008

DNS Exploit Loose - Check Your DNS Server

To the 2 or 3 people that read my blog, make sure your DNS is secure. There is an exploit in the wild that can poison DNS settings (steering you to a malicious site instead of your banking site for example). Read this article for more details. There is a link to a DNS checker or better yet, just switch to OpenDNS. I've been using OpenDNS for years now. You should also look into using NoScript if you're running Firefox. It's an addon that only allows Javascript to run from sites on your whitelist. It's a pain in the ass at first because you have to whitelist everything you usually use, but it's one of the best ways to secure yourself from malicious websites (although if your DNS is poisoned, you're out of luck).

Tuesday, July 22, 2008

A Busy Month and a Half!

Wow. I just looked back at my archives and I've been busy the last 1.5 months! What I've done:

- Kicked off the addition of UPB by installing a UPB coupler
- Updated my xPL sCU bridge into a full xPL/xAP/sCU bridge, making this my xPL/xAP scripting engine and phasing out xAP floorplan
- Wrote an xPL app to send TTS to 3Com Audreys
- Put a full scripting engine into xPLHALi
- Wrote a HALi client/server app that passes VR from client HAL machine to server HAL machine and passes responses back down, which can be spoken in client HAL voice or SAPI voice.
- Deployed several UPB modules and integrated UPB functionality into sCU and xPL sCU by writing code to communicate with a UPB serial interface. Integration with X10 is seamless.
- Wrote xPL gameport app as a poorman's method of getting contact closures into the system (and learned some DirectX)
- Installed USB Cat-5 extender to connect HA server to gameport in the garage
- Deployed 8 1Wire sensors and converted system over from using LM34s
- Wrote 1Wire app using TMEX API to poll sensors and dump values into a mySQL table

That was fun! Now I'm wondering what else I'm going to work on next...

Saturday, July 19, 2008

1Wire Serial Adapter Hates EdgePort

Since I've had the 1Wire network running, I've encountered a few fatal system errors that caused an immediate reboot of my HA server. Digging in the Event Viewer, I found messages like this:

Error code 00000044, parameter1 89422548, parameter2 00000d63, parameter3 00000000, parameter4 00000000.

I Googled a bit and found that error code corresponds to a memory problem or a driver issue. I stumbled upon a thread that told about how to read minidump files created by crashes. The dump file pointed to the EdgePort and the most likely culprit was a Java application. That points to the 1Wire stuff since its OWAPI is based on Java and the DS9097U adapter is plugged into the EdgePort.

Rather than take the easy way and move the 1Wire to the motherboard's built in serial port, I decided to write a app to talk to 1Wire adapter using the TMEX API. This way, I could avoid using all of the convoluted Java/J# crap. The problem with this path is there wasn't a VB example to get the temps, but there was a Delphi example. Ugh. Finally, I managed to cobble the Delphi and VB sample code into one program to connect to the 1Wire network and read the temperatures. About 7 hours after deploying that, I got another fatal pointing to the EdgePort. Guess it's not the Java part of the 1Wire after all.

So I connected the DS9097U to the onboard serial port and moved the TC+ to the EdgePort. It's been 12 hours without a fatal reboot. Hopefully, this solves the problem.

Update: It's been over 3 days since I moved the DS9097U and there have been no crashes since. Yay!

Thursday, July 17, 2008

Noisy 1Wire Readings

Of the 8 sensors I installed, the last one on the chain fluctuates a little between readings. It's not bad, just not as accurate as the other 7 sensors. What's different about this one?

It's at the end of the 1Wire line - could there be signal issues? I originally wanted to create my 1Wire network in a star pattern as that would be the easiest to wire from the patch panel, but the 1Wire docs advised against it. So I ran the network as 1 giant wire with each sensor as a stub. I actually used 4 wires to run them (voltage and ground since I decided against powering them parasitically and a wire for network in and network out). I chose this method to control the length of the stubs - otherwise the stub length would be the wire distance from the patch panel to wherever the sensor is located, which would vary for each location as each Cat-5 run is some different, unknown length. This, of course, increases the network length, but should be well within the 700 meter limit.

The sensor is also the only one outside. It's installed sticking out of the wall of our enclosed porch. It was exposed, but after seeing the fluctuations, I covered it up with electrical tape. It still fluctuates. I tucked it behind the porch speaker. It still fluctuates. I'm not sure what else to try at this point. Maybe that's the way it is outside?

Here's an RRD graph of the master bedroom temperature vs. the outside temperature. Starting Wednesday evening, after I got all the graphing and data gathering correctly set up, you can see the very smooth curve for the master bedroom sensor. The outdoor sensor, however, has fluctuations, on the order of a degree or more at times. The readings are accurate - they just don't make for a pretty picture.

Wednesday, July 16, 2008

1Wire Installation Completed

I put in the final four sensors Monday night and started trying to integrate things into the system. I decided to have the temps dumped into mySQL and all other applications can get the temps for there. For now, I've modified the GetTemps.js jscript sample from the 1Wire SDK to poll the sensors, update their values in mySQL and then sleep for 5 minutes.

My next step is getting the temps into the TimeCommander+ since it controls HVAC. The TC+ previously relied on the LM34 sensors connected directly to its analog inputs, so it directly knew the temperatures around the house. With 1Wire, I had to create variables in the TC+ for the temperatures it needs and have starCOMUltra periodically update them.

Finally, I had to update my RRD scripts for graphing temps. Since the 1Wire temps are digital values, there's no need to do any smoothing or error checking that I occasionally had to do with the analog LM34s. Once I had the RRD scripts up and running, I was able to see how nice 0.1 degree accuracy looks. I happened to have 2 DS18B20s, while the others were different flavors of DS18S20s. The rooms with the more accurate DS18B20s had much smoother curves compared to the DS18S20s with their 0.5 degree accuracy. I discovered, though, that you can calculate more accurate values using extra data bits stored in the device. I just added that code to my script and set it off running.

Monday, July 14, 2008

1Wire Deployment

The last few days, I started deploying 1Wire temperature sensors around the house. I've had the serial port interface and a bunch of DS18S20 sensors lying around for a while but I never got around to installing them. Our current system uses LM34 sensors hooked to the analog inputs of the JDS TimeCommander+, but they only have 2 degree accuracy and I've lived with that for 10+ years. Since I've been on my automation surge of late, I figured it was time to install the 1Wire stuff.

I tried putting the serial interface on an EdgePort at the end of the extended USB run in the garage, but for whatever reasons, the PC was unable to communicate consistently with it. It ended up back in the office, near the HA server. I decided I was going to gradually phase them in, which meant leaving the LM34s wired and running, while I tested out 1Wire. This made me clear out more wires in the wiring closet, at least temporarily, until I can shut down the LM34s. While I was cleaning that up, I decided to map out every wire in each of the 15 Cat-5 cables connected to the patch panel. (When we bought the house in 1999, 15 runs of Cat-5 seemed plenty. Now, I know better... *sigh*). I was able to free up some extra wires everywhere I needed them.

After the cleaning and mapping was done, I had time to solder and wire up 4 sensors - the living room, the master bedroom, the office and our daughter's room. There's still our son's room, the family room, the garage and outside left to do. If there's extra sensors, and I'm feeling adventurous drilling holes and running wire, I may try putting one in the attic.

Installing the 1Wire software wasn't as easy as the wiring. The 1Wire API, OWAPI, is some Java stuff and it relied on the Microsoft JVM, which they are no longer allowed to distribute. Anyway, after digging around the 'Net and iterating on the install process, I was able to get OWAPI operational. I had planned to integrate this all into starCOMUltra, but there's so much lag polling the sensors, I'm probably going to write a separate app to poll the sensors. I'm leaning toward making it directly interface it to sCU instead of using xPL as an intermediate step.

Thursday, July 10, 2008

New USB Cat-5 Extender

I grabbed a couple USB extenders ( called Remote KVM USB Extender up to 300 FT CAT5 ) from this seller on eBay and they arrived yesterday. I was going to test connecting the gameport in the garage to the HA server in the office. I already have 3 runs of Cat-5 in the garage, but they are all used for various things. The guest room is adjacent to the garage and I pulled wires from its closet into the garage before. Luckily I had one full Cat-5 cable left and that was used to connect the gameport in the garage to my homemade USB extension over the Cat-5 cable into the guestroom.

In the office, I connected one end of the new USB extender to my HA server and the other to a Cat-5 cable, connected that to the patch panel that led to an unused jack in the nook area. From the nook wall plate, I rolled my own Cat-5 cable (stripped off the wire casing) and ran it under the rug to the guestroom closet. I terminated that end and connected it into the receiver of the USB extender. Finally, I plugged in a powered USB hub and connected the gameport to it. While I was doing that, I also moved the bluetooth adapter into the closet and plugged that into the USB hub.

Everything showed up in the device manager and I started up the bluetooth and gameport apps. It's running great so my next project may be to put an EdgePort USB to Serial device on the hub and move the RFID reader here (or into the garage if I put a hub in there). I am also looking at using 1Wire instead of the LM34s I use for temperatures - and may end up putting a 1Wire serial adapter on the EdgePort as well.

Wednesday, July 9, 2008

xPL GamePort Deployed

Yesterday, I picked up some DB15 cables to cut up and plug into the gameport box to test out multiple joysticks with my gameport app. It found the extra joysticks nicely so I was able to start installing. The first place I'm putting a gameport module is in the garage where I have a few things monitored by DS10As - like the garage door, the doorbell, etc. I connected the gameport in the garage via the cheap cat-5 USB extension I wrote about before and plugged that into a test machine. I terminated one end of a gameport cable to a terminal strip to allow for easy wiring. Finally, I ran some cat-5 to one set of reed switches on a door to try it out and that worked great. Hopefully, I'll have some time today after work to connect a few more things. The doorbell never really worked with a DS10A - maybe it toggles too fast for the DS10A to see it. In any case, that'll be my next thing to wire up. I also have to decide if I'm going to leave this connected to a new machine or try to connect it all the way up to the HA server. I'm going to need a better method than my cheap cat-5 USB extender because it will not work this far.

Monday, July 7, 2008

xPL Gameport is Alive

The gameport app is up and running tonight after some technical difficulties - I discovered that I have to install the DirectX redistributable on whatever machine the app gets installed in. That's the pain of using DirectX but it made writing the app much easier. I added in xPL so the app will issue sensor.basic messages in response to button presses. I also added in a configuration file where you specify nice names for each button, like "GarageDoor", "Doorbell", etc., and those will be the device names in the xPL messages. One thing left to do is try using more than 1 gameport. I'll need to pick up some extra joystick extension cables to connect to the other 3 ports. I also need to add a selectable polling interval, probably something I'll add to the GUI.

Go Buy Those Gadgets...Now! It's Good For You!

Apparently, splurging is good for your health. So what are you waiting for? Go buy that new HDTV or whatever you've been pining for. I just picked up some Edgeport USB to serial adapters off of eBay - hardly a luxury so I guess this doesn't count. I have been resisting the call of the HDTV mainly because I'm trying to keep our electricity usage under the 300% of baseline threshold, at which the rates increase significantly. We're not that far under it and an HDTV would push us over for sure.

Sunday, July 6, 2008

Gameport Project

I started development on a new project to use the gameport as a source of contact closure inputs. This is something that has been done by others before, but their apps were never anything I could use. So I decided write one myself. All my other VB projects were done in Visual Basic 2008 Express making them usable only in Windows XP and later, but this one I really wanted to run on an old Windows 2000 machine. Luckily, I've got Visual Basic 2003 lying around.

On to coding...or so I thought. It turns out I need the DirectX SDK to access the gameports, but after some time digging around Microsoft's site, I was able to find a version of the DirectX 9.0C SDK compatible with Win2k. I'll be writing my app to connect to a "Super Joy Box 8" USB game port adapter, which has 4 gameports on it, but I assume it should work with others as well. Each gameport will provide up to 4 contact closure inputs for a total of 16 inputs for the device.

Wednesday, July 2, 2008

Bluetooth Antenna Hack

Even with the Cat-5 extension, the bluetooth adapter wasn't picking up our phones consistently. I ran across this site where the author soldered a wifi antenna onto the bluetooth dongle. My adapter is different - it has a trace on the pc board as the antenna - so i soldered the center wire of the antenna cable to that trace and soldered the shield to ground. I went one step further and put on a Windsurfer wifi antenna booster. Now, coverage is really good.