Esempio n. 1
0
 def as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.rtu_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         id=self.rtu_id,
         outside_temp=self.outside_temperature,
         supply_temp=self.supply_temperature,
         return_temp=self.return_temperature,
         pressure=self.pressure,
         cooling_mode=self.cooling_mode,
         cooling_status=self.cooling_status,
         fan_status=self.fan_status,
         heating=self.heating,
         heat_setpoint=self.heat_setpoint,
         cool_setpoint=self.cool_setpoint,
         identifiable=metadata['identifiable'],
         vendor_name=metadata['vendor_name'].encode('utf-8'),
         device_model=metadata['device_model'].encode('utf-8'),
         outside_damper_pos=self.outside_damper_position,
         bypass_damper_pos=self.bypass_damper_position,
         zone=zone_req,
         nickname=self.nickname.encode('utf-8'),
         device_model_id=metadata['device_model_id'],
         bemoss=metadata['bemoss'],
         mac_address=metadata['mac_address'].encode('utf-8'),
         device_type=metadata['device_type'].encode('utf-8'),
     )
Esempio n. 2
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(
         device_id=self.weather_sensor_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.weather_sensor_id,
                 noise=self.noise,
                 temperature=self.temperature,
                 humidity=self.humidity,
                 pressure=self.pressure,
                 co2=self.co2,
                 date_max_temp=self.date_max_temp,
                 date_min_temp=self.date_min_temp,
                 max_temp=self.max_temp,
                 min_temp=self.min_temp,
                 outdoor_temperature=self.outdoor_temperature,
                 outdor_humidity=self.outdoor_humidity,
                 outdoor_date_max_temp=self.outdoor_date_max_temp,
                 outdoor_date_min_temp=self.outdoor_date_min_temp,
                 outdoor_max_temp=self.outdoor_max_temp,
                 outdoor_min_temp=self.outdoor_min_temp,
                 device_model_id=metadata['device_model_id'],
                 device_type=metadata['device_type'].encode('utf-8'),
                 identifiable=metadata['identifiable'],
                 mac_address=metadata['mac_address'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 bemoss=metadata['bemoss'],
                 zone=zone_req,
                 zone_id=zone_req['id'],
                 nickname=self.nickname.encode('utf-8').title())
Esempio n. 3
0
 def data_side_nav(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.hub_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(device_id=self.hub_id,
                 device_model_id=metadata['device_model_id'],
                 mac_address=metadata['mac_address'].encode('utf-8'),
                 nickname=self.nickname.encode('utf-8').title(),
                 zone_id=zone_req['id'],
                 bemoss=metadata['bemoss'],
                 zone_nickname=zone_req['zone_nickname'],
                 network_status=self.network_status.capitalize())
Esempio n. 4
0
 def data_side_nav(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.thermostat_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         device_id=self.thermostat_id,
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8'),
         nickname=self.nickname.encode('utf-8').title(),
         zone_id=zone_req['id'],
         bemoss=metadata['bemoss'],
         zone_nickname=zone_req['zone_nickname'],
         network_status=self.network_status.capitalize())
Esempio n. 5
0
 def device_status(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.hub_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.hub_id,
                 nickname=self.nickname.encode('utf-8').title(),
                 device_model=metadata['device_model'],
                 date_added=metadata['date_added'],
                 zone=zone_req,
                 zone_nickname=zone_req['zone_nickname'],
                 bemoss=metadata['bemoss'],
                 network_status=self.network_status.capitalize(),
                 last_scanned=self.last_scanned_time,
                 last_offline=self.last_offline_time)
Esempio n. 6
0
 def device_status(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.plugload_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         id=self.plugload_id,
         nickname=self.nickname.encode('utf-8').title(),
         device_model=metadata['device_model'],
         date_added=metadata['date_added'],
         zone=zone_req,
         bemoss=metadata['bemoss'],
         network_status=self.network_status.capitalize(),
         zone_nickname=zone_req['zone_nickname'],
         last_scanned=self.last_scanned_time,
         last_offline=self.last_offline_time)
Esempio n. 7
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(
         device_id=self.occupancy_sensor_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.occupancy_sensor_id,
                 space_occupied=self.space_occupied,
                 zone=zone_req,
                 nickname=self.nickname.encode('utf-8').title(),
                 device_type=metadata['device_type'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 mac_address=metadata['mac_address'].encode('utf-8'),
                 identifiable=metadata['identifiable'],
                 bemoss=metadata['bemoss'])
Esempio n. 8
0
 def data_dashboard(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.hub_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(device_id=self.hub_id,
                 device_type=metadata['device_type'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 mac_address=metadata['mac_address'].encode('utf-8'),
                 nickname=self.nickname.encode('utf-8').title(),
                 date_added=metadata['date_added'],
                 zone_id=zone_req['id'],
                 bemoss=metadata['bemoss'],
                 zone_nickname=zone_req['zone_nickname'],
                 network_status=self.network_status.capitalize(),
                 last_scanned=self.last_scanned_time)
Esempio n. 9
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.plugload_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.plugload_id,
                 status=self.status,
                 power=self.power,
                 energy=self.energy,
                 zone=zone_req,
                 nickname=self.nickname.encode('utf-8').title(),
                 device_type=metadata['device_type'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 bemoss=metadata['bemoss'],
                 identifiable=metadata['identifiable'],
                 mac_address=metadata['mac_address'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'))
Esempio n. 10
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(
         device_id=self.presence_sensor_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.presence_sensor_id,
                 presence=self.presence,
                 battery=self.battery,
                 lqi=self.lqi,
                 rssi=self.rssi,
                 zone=zone_req,
                 nickname=self.nickname.encode('utf-8').title(),
                 device_type=metadata['device_type'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 bemoss=metadata['bemoss'],
                 mac_address=metadata['factory_id'].encode('utf-8'))
Esempio n. 11
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.lighting_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.lighting_id,
                 status=self.status,
                 brightness=self.brightness,
                 color=self.color,
                 multiple_on_off=self.multiple_on_off,
                 zone=zone_req,
                 nickname=self.nickname.encode('utf-8').title(),
                 device_type=metadata['device_type'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 identifiable=metadata['identifiable'],
                 device_model=metadata['device_model'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 bemoss=metadata['bemoss'],
                 mac_address=metadata['mac_address'].encode('utf-8'))
Esempio n. 12
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.plugload_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         id=self.plugload_id,
         status=self.status,
         power=self.power,
         energy=self.energy,
         zone=zone_req,
         nickname=self.nickname.encode('utf-8').title(),
         device_type=metadata['device_type'].encode('utf-8'),
         device_model_id=metadata['device_model_id'],
         bemoss=metadata['bemoss'],
         identifiable=metadata['identifiable'],
         mac_address=metadata['mac_address'].encode('utf-8'),
         vendor_name=metadata['vendor_name'].encode('utf-8'),
         device_model=metadata['device_model'].encode('utf-8'))
Esempio n. 13
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.lighting_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         id=self.lighting_id,
         status=self.status,
         brightness=self.brightness,
         color=self.color,
         multiple_on_off=self.multiple_on_off,
         zone=zone_req,
         nickname=self.nickname.encode('utf-8').title(),
         device_type=metadata['device_type'].encode('utf-8'),
         device_model_id=metadata['device_model_id'],
         identifiable=metadata['identifiable'],
         device_model=metadata['device_model'].encode('utf-8'),
         vendor_name=metadata['vendor_name'].encode('utf-8'),
         bemoss=metadata['bemoss'],
         mac_address=metadata['mac_address'].encode('utf-8'))
Esempio n. 14
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.hub_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.hub_id,
                 location=self.location,
                 firmware_version=self.firmware_version,
                 factory_id=self.factory_id,
                 firmware_update_availabile=self.firmware_update_available,
                 battery=self.battery,
                 signal_strength=self.signal_strength,
                 zone=zone_req,
                 bemoss=metadata['bemoss'],
                 nickname=self.nickname.encode('utf-8').title(),
                 device_type=metadata['device_type'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 mac_address=metadata['mac_address'].encode('utf-8'))
Esempio n. 15
0
 def data_dashboard(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.plugload_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         device_id=self.plugload_id,
         device_type=metadata['device_type'].encode('utf-8'),
         vendor_name=metadata['vendor_name'].encode('utf-8'),
         device_model=metadata['device_model'].encode('utf-8'),
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8'),
         nickname=self.nickname.encode('utf-8').title(),
         date_added=metadata['date_added'],
         identifiable=metadata['identifiable'],
         zone_id=zone_req['id'],
         bemoss=metadata['bemoss'],
         zone_nickname=zone_req['zone_nickname'],
         network_status=self.network_status.capitalize(),
         last_scanned=self.last_scanned_time)
Esempio n. 16
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(
         device_id=self.multi_sensor_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.multi_sensor_id,
                 acceleration=self.acceleration,
                 contact=self.contact,
                 battery=self.battery,
                 temperature=self.temperature,
                 lqi=self.lqi,
                 rssi=self.rssi,
                 three_axis=self.three_axis,
                 zone=zone_req,
                 nickname=self.nickname.encode('utf-8').title(),
                 device_type=metadata['device_type'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 bemoss=metadata['bemoss'],
                 mac_address=metadata['factory_id'].encode('utf-8'))
Esempio n. 17
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.thermostat_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(id=self.thermostat_id,
                 temperature=self.temperature,
                 heat_setpoint=self.heat_setpoint,
                 cool_setpoint=self.cool_setpoint,
                 thermostat_mode=self.thermostat_mode.encode('utf-8'),
                 fan_mode=self.fan_mode.encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 device_type=metadata['device_type'].encode('utf-8'),
                 identifiable=metadata['identifiable'],
                 mac_address=metadata['mac_address'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 battery=self.battery,
                 override=self.override,
                 bemoss=metadata['bemoss'],
                 zone=zone_req,
                 zone_id=zone_req['id'],
                 nickname=self.nickname.encode('utf-8').title())
Esempio n. 18
0
 def as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.vav_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         id=self.vav_id,
         temperature=self.temperature,
         supply_temp=self.supply_temperature,
         heat_setpoint=self.heat_setpoint,
         cool_setpoint=self.cool_setpoint,
         flap_override=self.flap_override,
         identifiable=metadata['identifiable'],
         flap_position=self.flap_position,
         zone=zone_req,
         nickname=self.nickname.encode('utf-8'),
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8'),
         device_type=metadata['device_type'].encode('utf-8'),
         vendor_name=metadata['vendor_name'].encode('utf-8'),
         bemoss=metadata['bemoss'],
         device_model=metadata['device_model'].encode('utf-8'),
     )
Esempio n. 19
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.power_meter_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     print self.real_power
     print self.energy
     return dict(id=self.power_meter_id,
                 real_power=self.real_power,
                 reactive_power=self.energy,
                 apparent_power=self.apparent_power,
                 energy=self.energy,
                 voltage=self.voltage,
                 current=self.current,
                 power_factor=self.power_factor,
                 zone=zone_req,
                 identifiable=metadata['identifiable'],
                 nickname=self.nickname.encode('utf-8').title(),
                 device_type=metadata['device_type'].encode('utf-8'),
                 vendor_name=metadata['vendor_name'].encode('utf-8'),
                 device_model=metadata['device_model'].encode('utf-8'),
                 device_model_id=metadata['device_model_id'],
                 bemoss=metadata['bemoss'],
                 mac_address=metadata['mac_address'].encode('utf-8'))
Esempio n. 20
0
 def data_as_json(self):
     zone_req = Building_Zone.as_json(self.zone)
     device_info = DeviceMetadata.objects.get(device_id=self.thermostat_id)
     metadata = DeviceMetadata.data_as_json(device_info)
     return dict(
         id=self.thermostat_id,
         temperature=self.temperature,
         heat_setpoint=self.heat_setpoint,
         cool_setpoint=self.cool_setpoint,
         thermostat_mode=self.thermostat_mode.encode('utf-8'),
         fan_mode=self.fan_mode.encode('utf-8'),
         device_model_id=metadata['device_model_id'],
         device_type=metadata['device_type'].encode('utf-8'),
         identifiable=metadata['identifiable'],
         mac_address=metadata['mac_address'].encode('utf-8'),
         vendor_name=metadata['vendor_name'].encode('utf-8'),
         device_model=metadata['device_model'].encode('utf-8'),
         battery=self.battery,
         override=self.override,
         bemoss=metadata['bemoss'],
         zone=zone_req,
         zone_id=zone_req['id'],
         nickname=self.nickname.encode('utf-8').title())
Esempio n. 21
0
from lighting.models import Lighting
from smartplug.models import Plugload
from admin.models import NetworkStatus

print "Adding database records for device_info table."

zone_999 = Building_Zone.objects.get(zone_id=999)

#Thermostat device_model objects
device_model_nest = DeviceModel.objects.get(device_model_id='1NST')
device_model_radio_th = DeviceModel.objects.get(device_model_id='1TH')


#Thermostats
device_info_th1 = DeviceMetadata(device_id="Thermostat1", device_type="thermostat", vendor_name="Google",
                                 device_model="Nest", device_model_id=device_model_nest, mac_address="ASDKJH1310",
                                 min_range=20, max_range=95, identifiable=True, communication="Wifi",
                                 date_added=datetime.datetime.now(), bemoss=True)
device_info_th1.save()

device_info_th2 = DeviceMetadata(device_id="Thermostat2", device_type="thermostat", vendor_name="Radio",
                                 device_model="CT30", device_model_id=device_model_radio_th, mac_address="ASASJH1310",
                                 min_range=20, max_range=95, identifiable=True, communication="Wifi",
                                 date_added=datetime.datetime.now(), bemoss=True)
device_info_th2.save()


#Lighting Controllers' Device Models
device_model_db = DeviceModel.objects.get(device_model_id='2DB')
device_model_sdb = DeviceModel.objects.get(device_model_id='2SDB')
device_model_hue = DeviceModel.objects.get(device_model_id='2HUE')
device_model_wl = DeviceModel.objects.get(device_model_id='2WL')
Esempio n. 22
0
print "Adding database records for device_info table."

zone_999 = Building_Zone.objects.get(zone_id=999)

#Thermostat device_model objects
device_model_nest = DeviceModel.objects.get(device_model_id='1NST')
device_model_radio_th = DeviceModel.objects.get(device_model_id='1TH')

#Thermostats
device_info_th1 = DeviceMetadata(device_id="Thermostat1",
                                 device_type="thermostat",
                                 vendor_name="Google",
                                 device_model="Nest",
                                 device_model_id=device_model_nest,
                                 mac_address="ASDKJH1310",
                                 min_range=20,
                                 max_range=95,
                                 identifiable=True,
                                 communication="Wifi",
                                 date_added=datetime.datetime.now(),
                                 bemoss=True)
device_info_th1.save()

device_info_th2 = DeviceMetadata(device_id="Thermostat2",
                                 device_type="thermostat",
                                 vendor_name="Radio",
                                 device_model="CT30",
                                 device_model_id=device_model_radio_th,
                                 mac_address="ASASJH1310",
                                 min_range=20,
                                 max_range=95,
Esempio n. 23
0
from admin.models import NetworkStatus

print "Adding database records for device_info table."

zone_999 = Building_Zone.objects.get(zone_id=999)

#Thermostat device_model objects
device_model_nest = DeviceModel.objects.get(device_model_id='1NST')
device_model_radio_th = DeviceModel.objects.get(device_model_id='1TH')
device_model_vav = DeviceModel.objects.get(device_model_id='1VAV')
device_model_rtu = DeviceModel.objects.get(device_model_id='1RTU')


#Thermostats
device_info_th1 = DeviceMetadata(device_id="Thermostat1", device_type="thermostat", vendor_name="Google",
                                 device_model="Nest", device_model_id=device_model_nest, mac_address="ASDKJH1310",
                                 min_range=20, max_range=95, identifiable=True, communication="Wifi",
                                 date_added=datetime.datetime.now(), bemoss=True)
device_info_th1.save()

device_info_th2 = DeviceMetadata(device_id="Thermostat2", device_type="thermostat", vendor_name="Radio",
                                 device_model="CT30", device_model_id=device_model_radio_th, mac_address="ASASJH1310",
                                 min_range=20, max_range=95, identifiable=True, communication="Wifi",
                                 date_added=datetime.datetime.now(), bemoss=True)
device_info_th2.save()

device_info_th3 = DeviceMetadata(device_id="Thermostat3", device_type="vav", vendor_name="VAV",
                                 device_model="VAV", device_model_id=device_model_vav, mac_address="DFASJH1310",
                                 min_range=20, max_range=95, identifiable=True, communication="Wifi",
                                 date_added=datetime.datetime.now(), bemoss=True)
device_info_th3.save()