Node.js, Raspberry Pi and irrigation control
This is my first post in a long time! I've experienced some severe burn out from a great many things. So after about 9 months I'm starting to get back to normal. So let's get back to Home Automation.
I have an ancient but working sprinkler controller. It's a very simple device and can control: 6 zones and 3, 14 day programs. For most of my needs it's fine (but when has that stopped me?). Also my wife could use a few more custom zones for her potted plants. The problem with the irrigation system is that it sometimes loses it's program and it isn't flexible enough (odd/even days, temperature, rain, wind, etc.) and no web interface. So I have a nice Raspberry Pi which can easily handle the control of a few zones (heck it could handle half a dozen easily). I've already completed one project with the Raspberry Pi, Python and the ADAFruit 16 port PWM driver. I've decided that I like Python and that's it's a nice language to work with. Now I have a tendency to want to play with new technology (it helps to keep up with things) and I've noticed node.js (Squirrel!). So far I've done simple things with node.js and it's been fun but I've decided to jump head first into node.js and use it to interface between the User Interface in the browser and the Raspberry Pi GPIO . I've found a nice Raspberry Pi GPIO library, a nice cron scheduling library and I've begun writing code. I've quickly learned that event based program is confusing when you are not used to it. I'm not convinced that node.js is perfect for many of my projects. I know I won't be using it for my home automation system as I need event based and real concurrency but I think node.js and the Raspberry Pi Irrigation Controller is perfect for this. So far I've been confused by callbacks, anonymous functions, variable scope, and a few other things. Loops are a real pain to do in node.js (forget for and while loops). Obviously I'm doing somethings very wrong as I have no experience with node.js but I must say I'm not too comfortable with event programming. It feels very unnatural especially when you have to wait for the callbacks to finish before you can go onto the next thing (config information that's needed for the rest of the program is not asynchronous). I really need to sit down and read a bit more but I have managed to get some basic parts working. I'm no where near done and I hope to have something operational within the week. Expect a lot of beginner mistakes and some kludges but working code. I'll correct things later.
As far as my main home automation system? I may look at Twisted and Python for the primary programming language for the home automation system of course we have Pytomation which may be a pretty good option.