from djongo import models


class MongoNL_Device(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(u'设备号',default=0,max_length=50)  # 设备id
    device_data = models.TextField(u'具体状态数据',default='')  # 具体历史状态数据
    protocolType =  models.CharField(u'配置属性',max_length=50)  # 设备 3为 计数上报   2为控制器和轮训上报
    addtime = models.IntegerField(default=0)  # 新增时间
    at = models.CharField(u'环境温度',max_length=50) 
    ah = models.CharField(u'环境湿度',max_length=50)
    class Meta:
        db_table = "sa_nl_device"


class MongoNL_Device_Status(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(u'设备号',default=0,max_length=50)  # 设备id
    addtime = models.IntegerField(default=0)  # 新增时间
    at = models.CharField(u'环境温度',max_length=50) 
    ah = models.CharField(u'环境湿度',max_length=50)
    rain = models.CharField(u'是否下雨',max_length=50)
    wind = models.CharField(u'风速风向',max_length=50)
    weather = models.CharField(u'天气',max_length=50)
    warn = models.CharField(u'害虫预警情况',max_length=50)
    lure = models.CharField(u'诱芯',max_length=50)
    xy_uptime = models.IntegerField(default=0)  # 诱芯更换时间
    xy_expire_time = models.IntegerField(default=0)  # 诱芯到期时间

    class Meta:
        db_table = "sa_nl_device_status"
