I have uploaded a new version with a lot of new features (I will describe all of that later). However, as indicated before, the database you have now is not compatible anymore
So to start:
1) Take a screen shot or make a note of your macro configurations you have done for the rain collection part
2) Delete those macros...
3) Stop EG and delete your databases found in the EventGhost folder (rainData.db, humData.db, tempData.db)
4) Update the ClimateDataCalculation plugin files with the latest, you find them here
http://sto.hopto.org/Under%20constructi ... 20version/
5) Start EG again, re-configure your previous macros and data will start to be collected again
When you configure an action to capture data, you will get a dialog like below. I'll just explain some new settings, the plugin is getting more mature:
- you can now configure how frequently you want to save readings (default every 10 minutes)
- the plugin calculates two moving averages, one fast and one slow. This is then used to create events when the lines are crossing each other. The more readings you select, the slower the response to changes. This is a very useful function to avoid too many status changes when for instance controlling heaters (you might temporary open a door or window but the heater should not react immediately)
- in addition you can add a hysteresis value that will be subtracted from the fast moving average
- you can select if you want to use the rule evaluation that will generate those events or not. Currently I have only one rule 'equal-less-greater' that will generate events when the fast moving average gets equal, less or greater than the slow moving average.
- all this works for rain, temperature and humidity data
- rain, temperature and humidity data can be collected with a RFXtrx
- temperature and humidity data can be collected with a TellStick Duo (I am lacking a TellStick Duo log sample from a rain sensor)
- data from other devices like z-wave and 1wire can easily be added but I need sample events from the EG log.
Now, your eg.globals....
I think the script below should work. Just create a macro where you put it and change the name of the table 'RainSensor on roof' to what you have named to.
Everytime you trigger it, your eg.globals will be updated (so you need to add a suitable event that triggers it on a regular base, i.e. you could use the SchedulGhost plugin for that purpose. If you need more or other intervals you can easily add more or change them. You get the idea when you look at the syntax.
Code: Select all
import datetime
now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M")
start_of_today = datetime.date.today().strftime("%Y-%m-%d %H:%M")
sevenDaysAgo = (datetime.datetime.now() + datetime.timedelta(-7)).strftime("%Y-%m-%d %H:%M")
thirtyDaysAgo = (datetime.datetime.now() + datetime.timedelta(-30)).strftime("%Y-%m-%d %H:%M")
eg.globals.Regn_dag = eg.plugins.ClimateDataCalculation.RainRequestQuery(u'RainSensor on roof', start_of_today, now)
eg.globals.Regn_uke = eg.plugins.ClimateDataCalculation.RainRequestQuery(u'RainSensor on roof', sevenDaysAgo, now)
eg.globals.Regn_maaned = eg.plugins.ClimateDataCalculation.RainRequestQuery(u'RainSensor on roof', thirtyDaysAgo, now)
Walter