Skip to content

Commit

Permalink
history storage(prototype) - feature #30 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rrada committed Mar 10, 2012
1 parent bb78237 commit 497f208
Show file tree
Hide file tree
Showing 9 changed files with 610 additions and 118 deletions.
2 changes: 2 additions & 0 deletions HouseAgent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# - False
# default: 5
# dbpath path to Sqlite DB file, leave empty for system default
# dbpatharchive path to Archive Sqlite DB file, leave empty for system default
# runasservice run as service under Windows
# default: False
# -----------------------------------------------------------------------------
Expand All @@ -22,6 +23,7 @@ logsize=1024
logcount=5
logconsole=True
dbpath=
dbpatharchive=

runasservice=False

Expand Down
10 changes: 8 additions & 2 deletions HouseAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from houseagent import config_file
from houseagent.core.coordinator import Coordinator
from houseagent.core.events import EventHandler
from houseagent.core.history import HistoryCollector, HistoryAggregator
from houseagent.core.web import Web
from houseagent.core.database import Database
from houseagent.core.databaseflash import DatabaseFlash
Expand All @@ -17,7 +18,6 @@ class MainWrapper():
def start(self):

self.log = pluginapi.Logging("Main")
self.log.set_level(config.general.loglevel)

self.log.debug("Starting HouseAgent database layer...")
if config.embedded.enabled:
Expand All @@ -32,7 +32,13 @@ def start(self):

self.log.debug("Starting HouseAgent event handler...")
event_handler = EventHandler(coordinator, database)


self.log.debug("Starting Houseagent history aggregator")
histagg = HistoryAggregator(database)

self.log.debug("Starting Houseagent history collector")
HistoryCollector(database, histagg)

self.log.debug("Starting HouseAgent web server...")
Web(self.log, config.webserver.host, config.webserver.port,\
config.webserver.backlog, coordinator, event_handler, database)
Expand Down
1 change: 1 addition & 0 deletions archive/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is directory for storing archive DB files
206 changes: 112 additions & 94 deletions houseagent/core/database.py

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions houseagent/core/databaseflash.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
@author: Daniel Berenguer
'''

from database import Database, DataHistory
from database import Database
#from database import Database, DataHistory
from twisted.internet import reactor, defer
from twisted.internet.defer import inlineCallbacks, returnValue
from twisted.internet.task import LoopingCall
Expand Down Expand Up @@ -78,7 +79,8 @@ def update_or_add_value(self, name, value, pluginid, address, time=None):
# Update value
curr_val.value = value
curr_val.last_update = updatetime


# XXX: need to be rewriten
# Log value?
if current_value[0][2] not in (0, None):
DataHistory("data", value_id, value, "GAUGE", 60, int(time))
Expand Down
Loading

0 comments on commit 497f208

Please sign in to comment.