示例#1
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())
示例#2
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'),
     )
示例#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())
示例#4
0
 def data_dashboard(self):
     zone_req = Building_Zone.as_json(self.associated_zone)
     return dict(device_id=self.node_id,
                 device_name=self.node_name.encode('utf-8').title(),
                 device_model=self.node_model.encode('utf-8').title(),
                 device_type=self.node_type.encode('utf-8').title(),
                 mac_address=self.mac_address.encode('utf-8'),
                 device_status=self.node_status.encode('utf-8').title(),
                 associated_zone=zone_req,
                 ip_address=self.ip_address,
                 date_added=self.date_added,
                 last_scanned=self.last_scanned_time,
                 last_offline=self.last_offline_time)
示例#5
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())
示例#6
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)
示例#7
0
 def data_dashboard(self):
     zone_req = Building_Zone.as_json(self.associated_zone)
     return dict(
         device_id=self.node_id,
         device_name=self.node_name.encode('utf-8').title(),
         device_model=self.node_model.encode('utf-8').title(),
         device_type=self.node_type.encode('utf-8').title(),
         mac_address=self.mac_address.encode('utf-8'),
         device_status=self.node_status.encode('utf-8').title(),
         associated_zone=zone_req,
         ip_address=self.ip_address,
         date_added=self.date_added,
         last_scanned=self.last_scanned_time,
         last_offline=self.last_offline_time)
示例#8
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)
示例#9
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'])
示例#10
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'))
示例#11
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)
示例#12
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'))
示例#13
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'))
示例#14
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'))
示例#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)
示例#16
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'))
示例#17
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'))
示例#18
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'))
示例#19
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'),
     )
示例#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())
示例#21
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())
示例#22
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'))
示例#23
0
 def get_zone(self):
     zone_req = Building_Zone.as_json(self.zone)
     return zone_req
示例#24
0
smartthings_multisensor = DeviceModel(device_model_id='4STM', device_model_name='Smartthings Multisensor')
smartthings_multisensor.save()

proteus_motion_sensor = DeviceModel(device_model_id='4PRM', device_model_name='Proteus Motion Sensor')
proteus_motion_sensor.save()

wattnode = DeviceModel(device_model_id='5WTN', device_model_name='WattNode')
wattnode.save()

dent_powermeter = DeviceModel(device_model_id='5DNT', device_model_name='Dent Power Meter')
dent_powermeter.save()

print "device_model table updated with device model information."

zone_999 = Building_Zone(zone_id=999, zone_nickname="BEMOSS Core")
zone_999.save()
'''
zone_1 = Building_Zone(zone_id=1, zone_nickname="Zone 1")
zone_1.save()

zone_2 = Building_Zone(zone_id=2, zone_nickname="Zone 2")
zone_2.save()

zone_3 = Building_Zone(zone_id=3, zone_nickname="Zone 3")
zone_3.save()

zone_4 = Building_Zone(zone_id=4, zone_nickname="Zone 4")
zone_4.save()
'''
示例#25
0
modlet_smart_plug = DeviceModel(device_model_id='3MOD', device_model_name='Modlet Smart Plug')
modlet_smart_plug.save()

wattstopper_plugload = DeviceModel(device_model_id='3WP', device_model_name='Wattstopper Plugload')
wattstopper_plugload.save()

vt_load_controller = DeviceModel(device_model_id='3VTH', device_model_name='VT Load Controller')
vt_load_controller.save()

digi_smart_plug = DeviceModel(device_model_id='3DSP', device_model_name='Digi Smart Plug')
digi_smart_plug.save()

print "device_model table updated with device model information."

zone_999 = Building_Zone(zone_id=999, zone_nickname="BEMOSS Core")
zone_999.save()
#Adding global settings

gz999 = GlobalSetting(id=999,heat_setpoint=70, cool_setpoint=72, illuminance=67, zone_id=999)
gz999.save()


#User groups

tenant = Group(id=1, name="Tenant")
tenant.save()

zonemgr = Group(id=2, name="Zone Manager")
zonemgr.save()