Hi all!
I am looking for some ideas as to how best to integrate Indigo with some other homebrew automation tools that I have already running on a Linux server. But first: kudos to Matt for putting together this phenomenal bit of software - this makes Insteon vastly more useful... and usable.
To give a little bit of background: I started work on my home automation system with the premise that there did not already exist a good way to rapidly glue together all the disparate scripts and tools that I expected I would need. To that end, I came up with a concept which I called "homefs" - basically, something just like the Linux procfs, but for your house instead of your kernel. So I could have one script which extracts data from TED (the energy detective), another which polls temperature and relay states from the HVAC system, another which keeps track of the AV equipment, another to receive state changes from the security system, another to dump data into rrdtool, and so on. All these scripts just independently dump their data into a directory tree under /homefs/. Then to implement any kind of smart control logic, all I have to do is make a trivial script which cats the appropriate files to get its input data/events, and then does whatever it wants with it. For example, if I want to know the temperature at thermostat #3, I would just read the file "/homefs/hvac/aprilaire/data/3/TEMP", and to get events I could use tail -F with select, or use inode monitoring. Such scripts could run continuously or be triggered by cron or whatever.
However, after seeing how Indigo supports dumping all its state data out to a mysql database, I am thinking that maybe this might be a better model than "/homefs" to use for all my other scripts too. The thing is, I'm pretty green when it comes to databases so I'm not really sure of what I'm getting into at this point.
So i have a few dumb beginner questions about the mysql feature, and mysql in general.
- Currently this is strictly a one-way data dump, right? So if I have some other tool which wants bidirectional access to Indigo, it should use mysql to query device states, and HTTP requests to send commands to Indigo?
- Would it make sense to, or is there any plan to make the mysql connection bidirectional?
- Would it make sense for Indigo to perhaps adopt MySQL at some point as its own internal data store, as well as a means of integrating with external tools?
- Could an event-driven system comprised of many separate processes be built around a mysql database? For example, could I make a tool which connects to the database and then waits for one of some set of values to be updated, and then take some action? I've heard of "triggers" in SQL but that's only for doing calculations internal to the database, right? I am wondering if mysql could effectively serve as the machinery for dispatching events, rather than everybody having to continuously poll the data they're interested in.
- Is there anything else on the roadmap for Indigo that I should be thinking about?
Basically, I expect I am going to need to implement a SQL interface anyway in order to communicate with Indigo, and I'm wondering if while I'm at it, I should just plan to adopt the same model for all of my tools. Or is there is some other model that I should consider? I'm really trying to keep it simple but if there is significant capability to be gained by introducing a database then I'll go for it... any thoughts or advice on how to approach this would be most welcome. Thanks![/b]