hybridview/xefil,
I posted in the help section about using MySQL in a c# sharp script... but haven't heard anything back. I'd much rather be using my database, but for the short-term I just wrote a simple script to log data to a csv file that I display and do some things with via perl scripts after that.
It logs power and outside temp every 20 seconds to a file, make sure you use the try/catch at this rate otherwise you'll have issues with the file being in use. I do the same with a multisensor inside the coop, that one logs every 15 minutes, the file system is much happier at this rate. The multisensor I did have to also add a line to automatically grab the node info from the multisensor, since it seemed to stop communicating after about an hour once I moved it to the coop... Manually querying the node info would make it work again, not sure if it's distance or temperature out there. It is on AC power, and responds to node id query, so it'd not sleeping. Who knows, I've had these issues with industrial hardware before too though.
I did move my cat water fountain switch outside to monitor/control the power going to my chicken coop (for the heated waterers over the winter). that's why the names...
"
//Get outside temperature from weather module
var weatherModule = Modules.WithName("Weather Underground").Get();
var outsideTemp = weatherModule.Parameter("Conditions.TemperatureF").Value;
//Read and save Coop Power (catWaterFountain) values
var catWaterFountain = Modules.WithName("Cat Water Fountain").Get();
var wattage = catWaterFountain.Parameter("Meter.Watts").DecimalValue;
var level = catWaterFountain.Parameter("Status.Level").DecimalValue*100;
//Program.Notify("Cat Water Fountain", outsideTemp+"F "+level+"% "+wattage+"W");
try
{
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"/var/house/chickenCoopPower", true))
{
file.WriteLine(DateTime.Now.ToString("yyyyMMdd HH:mm:ss")+","+outsideTemp+","+level+","+wattage);
}
}
catch
{
Program.Notify("chickenCoopPower", "File in use. Will try again in 20s.");
}
"