summaryrefslogtreecommitdiff
path: root/bin/ebus_dump.py
diff options
context:
space:
mode:
Diffstat (limited to 'bin/ebus_dump.py')
-rwxr-xr-xbin/ebus_dump.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/bin/ebus_dump.py b/bin/ebus_dump.py
deleted file mode 100755
index c170849..0000000
--- a/bin/ebus_dump.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-# -*- coding:utf8 -*-
-import asyncore
-import time
-from ebus import EbusReader
-from ebus.model.sql import ModelBase, EbusSQL, Value
-from ebus.model.sql import EbusSQL
-from sqlalchemy import create_engine
-from sqlalchemy.orm import sessionmaker
-import logging
-
-logging.basicConfig()
-
-#logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
-logging.getLogger('sqlalchemy.engine').setLevel(logging.WARNING)
-
-logger = logging.getLogger('ebus.dump')
-logger.setLevel(logging.INFO)
-
-#engine = create_engine('sqlite:///:memory:', echo=True)
-engine = create_engine("postgresql:///ebus")
-
-ModelBase.metadata.create_all(engine)
-
-Session = sessionmaker()
-Session.configure(bind=engine)
-session = Session()
-
-
-class MyEbusReader(EbusReader):
- def __init__(self,*args,**kwargs):
- EbusReader.__init__(self,*args,**kwargs)
- self.debug = True
- self.sql = EbusSQL(session)
- def handle_ebus(self,ebus_packet):
- for field in self.sql.get_values(ebus_packet):
- session.add(field)
-
- session.commit()
-
- logger.info("packet %s" % ebus_packet.name())
-
-MyEbusReader()
-try:
- asyncore.loop()
-except KeyboardInterrupt:
- pass
-# for data in session.query(Value).all():
-# print data