summaryrefslogtreecommitdiff
path: root/ebus/web
diff options
context:
space:
mode:
Diffstat (limited to 'ebus/web')
-rw-r--r--ebus/web/model.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ebus/web/model.py b/ebus/web/model.py
index e7744df..e9fc04c 100644
--- a/ebus/web/model.py
+++ b/ebus/web/model.py
@@ -21,7 +21,6 @@ class Sensor(ModelBase):
-
class Value(ModelBase):
__tablename__ = 'value'
@@ -29,12 +28,17 @@ class Value(ModelBase):
timestamp = Column(DateTime)
sensor_id = Column(Integer, ForeignKey("sensor.id"))
sensor = relationship(Sensor, backref=backref('values', order_by=timestamp))
- value = Column(Float(precision=4))
- def __init__(self, sensor, value, timestamp=datetime.now()):
- self.sensor = sensor
- self.value = value
+ value_float = Column(Float(precision=4))
+ value_int = Column(Integer)
+ value_string = Column(String)
+
+ def __init__(self, sensor, value_float=None, value_int=None, value_string=None, timestamp=datetime.now()):
self.timestamp = timestamp
+ self.sensor = sensor
+ self.value_float = value_float
+ self.value_int = value_int
+ self.value_string = value_string
def __repr__(self):
return "<Value('%s','%s','%s','%s'>" % (self.id, self.sensor, self.value, self.timestamp)