Example #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') if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8') if metadata['device_model'] else '',
         outside_damper_pos=self.outside_damper_position,
         bypass_damper_pos=self.bypass_damper_position,
         zone=zone_req,
         nickname=self.nickname.encode('utf-8') if self.nickname else '',
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         device_type=metadata['device_type'].encode('utf-8') if metadata['device_type'] else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices']
     )
Example #2
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()
         if self.nickname else '',
         device_type=metadata['device_type'].encode('utf-8')
         if metadata['device_type'] else '',
         device_model_id=metadata['device_model_id'],
         identifiable=metadata['identifiable'],
         device_model=metadata['device_model'].encode('utf-8')
         if metadata['device_model'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8')
         if metadata['vendor_name'] else '',
         # bemoss=metadata['bemoss'],
         mac_address=metadata['mac_address'].encode('utf-8')
         if metadata['mac_address'] else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #3
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') if self.thermostat_mode else '',
         fan_mode=self.fan_mode.encode('utf-8') if self.fan_mode else '',
         device_model_id=metadata['device_model_id'],
         device_type=metadata['device_type'].encode('utf-8') if metadata['device_type'] else '',
         identifiable=metadata['identifiable'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8') if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8') if metadata['device_model'] else '',
         battery=self.battery,
         override=self.override,
         hold=self.hold,
         # bemoss=metadata['bemoss'],
         zone=zone_req,
         zone_id=zone_req['id'],
         nickname=self.nickname.encode('utf-8').title() if self.nickname else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #4
0
 def data_dashboard(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(
         device_id=self.lighting_id,
         device_type=metadata['device_type'].encode('utf-8')
         if metadata['device_type'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8')
         if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8')
         if metadata['device_model'] else '',
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8')
         if metadata['mac_address'] else '',
         nickname=self.nickname.encode('utf-8').title()
         if self.nickname else '',
         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,
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #5
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()
         if self.nickname else '',
         device_type=metadata['device_type'].encode('utf-8')
         if metadata['device_type'] else '',
         device_model_id=metadata['device_model_id'],
         # bemoss=metadata['bemoss'],
         identifiable=metadata['identifiable'],
         mac_address=metadata['mac_address'].encode('utf-8')
         if metadata['mac_address'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8')
         if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8')
         if metadata['device_model'] else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #6
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')
         if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8')
         if metadata['device_model'] else '',
         outside_damper_pos=self.outside_damper_position,
         bypass_damper_pos=self.bypass_damper_position,
         zone=zone_req,
         nickname=self.nickname.encode('utf-8') if self.nickname else '',
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8')
         if metadata['mac_address'] else '',
         device_type=metadata['device_type'].encode('utf-8')
         if metadata['device_type'] else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #7
0
 def data_side_nav(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(
         device_id=self.rtu_id,
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         nickname=self.nickname.encode('utf-8').title() if self.nickname else '',
         zone_id=zone_req['id'],
         zone_nickname=zone_req['zone_nickname'],
         network_status=self.network_status.capitalize(),
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #8
0
 def data_side_nav(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(
         device_id=self.vav_id,
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         nickname=self.nickname.encode('utf-8').title() if self.nickname else '',
         zone_id=zone_req['id'],
         zone_nickname=zone_req['zone_nickname'],
         network_status=self.network_status.capitalize(),
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #9
0
 def device_status(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,
         nickname=self.nickname.encode('utf-8').title() if self.nickname else '',
         device_model=metadata['device_model'],
         date_added=metadata['date_added'],
         zone_id=zone_req['id'],
         zone_nickname=zone_req['zone_nickname'],
         network_status=self.network_status.capitalize(),
         last_scanned=self.last_scanned_time,
         last_offline=self.last_offline_time,
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #10
0
 def device_status(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,
         nickname=self.nickname.encode('utf-8').title() if self.nickname else '',
         device_model=metadata['device_model'],
         date_added=metadata['date_added'],
         zone_id=zone_req['id'],
         zone_nickname=zone_req['zone_nickname'],
         network_status=self.network_status.capitalize(),
         last_scanned=self.last_scanned_time,
         last_offline=self.last_offline_time,
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #11
0
 def data_dashboard(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(
         device_id=self.rtu_id,
         device_type=metadata['device_type'].encode('utf-8') if metadata['device_type'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8') if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8') if metadata['device_model'] else '',
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         nickname=self.nickname.encode('utf-8').title() if self.nickname else '',
         date_added=metadata['date_added'],
         identifiable=metadata['identifiable'],
         zone_id=zone_req['id'],
         zone_nickname=zone_req['zone_nickname'],
         network_status=self.network_status.capitalize(),
         last_scanned=self.last_scanned_time,
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #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() if self.nickname else '',
         device_type=metadata['device_type'].encode('utf-8') if metadata['device_type'] else '',
         device_model_id=metadata['device_model_id'],
         # bemoss=metadata['bemoss'],
         identifiable=metadata['identifiable'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8') if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8') if metadata['device_model'] else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #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() if self.nickname else '',
         device_type=metadata['device_type'].encode('utf-8') if metadata['device_type'] else '',
         device_model_id=metadata['device_model_id'],
         identifiable=metadata['identifiable'],
         device_model=metadata['device_model'].encode('utf-8') if metadata['device_model'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8') if metadata['vendor_name'] else '',
         # bemoss=metadata['bemoss'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices'])
Example #14
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') if self.nickname else '',
         device_model_id=metadata['device_model_id'],
         mac_address=metadata['mac_address'].encode('utf-8') if metadata['mac_address'] else '',
         device_type=metadata['device_type'].encode('utf-8') if metadata['device_type'] else '',
         vendor_name=metadata['vendor_name'].encode('utf-8') if metadata['vendor_name'] else '',
         device_model=metadata['device_model'].encode('utf-8') if metadata['device_model'] else '',
         approval_status=metadata['approval_status'],
         approval_status_choices=metadata['approval_status_choices']
     )