Removed device object from database for simplification
This commit is contained in:
parent
836e286178
commit
72e680a515
2 changed files with 4 additions and 16 deletions
|
@ -1,13 +0,0 @@
|
||||||
from .base_model import BaseModel
|
|
||||||
from peewee import CharField, DateTimeField, ForeignKeyField, BooleanField
|
|
||||||
|
|
||||||
|
|
||||||
class Device(BaseModel):
|
|
||||||
friendly_name = CharField(max_length=200)
|
|
||||||
|
|
||||||
|
|
||||||
class Feature(BaseModel):
|
|
||||||
friendly_name = CharField(max_length=200)
|
|
||||||
device = ForeignKeyField(Device, backref="sensors")
|
|
||||||
type = CharField(max_length=150)
|
|
||||||
is_sensor = BooleanField()
|
|
|
@ -1,11 +1,12 @@
|
||||||
from .base_model import BaseModel
|
from .base_model import BaseModel
|
||||||
from .device import Feature
|
from peewee import DateTimeField, ForeignKeyField, DecimalField, CharField
|
||||||
from peewee import DateTimeField, ForeignKeyField, DecimalField, BooleanField
|
|
||||||
|
|
||||||
|
|
||||||
class StateLog(BaseModel):
|
class StateLog(BaseModel):
|
||||||
timestamp = DateTimeField()
|
timestamp = DateTimeField()
|
||||||
feature = ForeignKeyField(Feature, backref="values")
|
property = CharField(max_length=200, index=True)
|
||||||
|
device_id = CharField(max_length=200, index=True)
|
||||||
|
device_name = CharField(max_length=200, index=True)
|
||||||
char_value = DecimalField(5, 2, auto_round=True)
|
char_value = DecimalField(5, 2, auto_round=True)
|
||||||
numeric_value = DecimalField(12, 3, auto_round=True)
|
numeric_value = DecimalField(12, 3, auto_round=True)
|
||||||
previous_state = ForeignKeyField("StateLog")
|
previous_state = ForeignKeyField("StateLog")
|
||||||
|
|
Loading…
Reference in a new issue