summaryrefslogtreecommitdiff
path: root/bin/ebus_app.py
diff options
context:
space:
mode:
authorEbus-at-dockstar <ebus@dockstar>2013-03-25 10:24:28 +0100
committerEbus-at-dockstar <ebus@dockstar>2013-03-25 10:24:43 +0100
commit862282ce99760832d3e9e5b4b1171b861105e004 (patch)
tree0e229418e391917b79d42a8bdee46fb7a8612895 /bin/ebus_app.py
parent9522cdffa94f278eb5e1894600535986e22c2890 (diff)
downloadebus-alt-862282ce99760832d3e9e5b4b1171b861105e004.tar.gz
ebus-alt-862282ce99760832d3e9e5b4b1171b861105e004.zip
move old stuff away
Diffstat (limited to 'bin/ebus_app.py')
-rwxr-xr-xbin/ebus_app.py41
1 files changed, 0 insertions, 41 deletions
diff --git a/bin/ebus_app.py b/bin/ebus_app.py
deleted file mode 100755
index c9b89f6..0000000
--- a/bin/ebus_app.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-# -*- coding:utf-8 -*-
-# xapek.org, 2010
-import asyncore
-from sqlalchemy import create_engine
-from sqlalchemy.orm import sessionmaker
-from ebus.web import model
-from ebus import EbusReader
-
-#db_engine = create_engine('sqlite:///:memory:', echo=True)
-db_engine = create_engine("postgresql://yvesf:iii@10.2.2.13:5432/yvesf", echo=True)
-
-session = sessionmaker(bind=db_engine)()
-
-
-def insert(ebus_packet):
- try:
- for valueKey in ebus_packet.values().keys():
- print "Key", valueKey
- sensor = session.query(model.Sensor).filter(model.Sensor.name==valueKey).first()
- if not sensor:
- print "Add sensor %s" % valueKey
- sensor = model.Sensor(valueKey)
- session.add(sensor)
- print sensor
- m_value = model.Value(sensor, ebus_packet.values()[valueKey])
- session.add(m_value)
- print m_value
- session.commit()
- except Exception,e:
- session.rollback()
- try:
- print "Failed to insert %s -- reason %s" % (ebus_packet.name(), e)
- except Exception,e:
- print e
-
-reader = EbusReader()
-reader.handle_ebus = insert
-reader.debug = False
-
-asyncore.loop()