def sensors_get(sensor_type=[]): """ method to get sensors by type """ resultlist = [] items=[] if sensor_type: items = Sensor.scan(type__contains=sensor_type) else: items = Sensor.scan() for item in items: resultlist.append(item.attribute_values) return resultlist
def sensors_delete(sensor_type=[]): """ method to delete sensors by type """ resultlist = [] items=[] if sensor_type: items = Sensor.scan(type__contains=sensor_type) else: items = Sensor.scan() for item in items: resultlist.append(item.delete()) return "%s items deleted." % len(resultlist)
def buildings_building_id_sensors_get(buildingId, room=[], type=[]): """ method to get sensors using building id """ resultlist = [] items = [] if room and type: items = Sensor.scan(buildingId__eq=buildingId,room__eq=room,type__eq=type) elif room: items = Sensor.scan(buildingId__eq=buildingId,room__eq=room) elif type: items = Sensor.scan(buildingId__eq=buildingId,type__eq=type) else: items = Sensor.scan(buildingId__eq=buildingId) for item in items: resultlist.append(item.attribute_values) return resultlist
def buildings_building_id_sensors_get(buildingId, room=[], type=[]): """ method to get sensors using building id """ resultlist = [] items = [] if room and type: items = Sensor.scan(buildingId__eq=buildingId, room__eq=room, type__eq=type) elif room: items = Sensor.scan(buildingId__eq=buildingId, room__eq=room) elif type: items = Sensor.scan(buildingId__eq=buildingId, type__eq=type) else: items = Sensor.scan(buildingId__eq=buildingId) for item in items: resultlist.append(item.attribute_values) return resultlist
def sensors_get() -> str: resultList = [] for item in Sensor.scan(): resultList.append(item.attribute_values) return resultList
def sensors_delete() -> str: temp = [] for item in Sensor.scan(): temp.append(item.delete()) return "%s items deleted." % len(temp)
def buildings_building_id_sensors_delete(buildingId): """ method to delete sensor using building id """ resultlist = [] for item in Sensor.scan(buildingId__eq=buildingId): resultlist.append(item.delete()) return "%s items deleted." % len(resultlist)
def sensors_delete(): """ method to delete sensor """ temp = [] for item in Sensor.scan(): temp.append(item.delete()) return "%s items deleted." % len(temp)
def sensors_get(): """ method to get all sensors """ resultlist = [] for item in Sensor.scan(): resultlist.append(item.attribute_values) return resultlist
def buildings_building_id_sensors_get(buildingId) -> str: resultList = [] for item in Sensor.scan(buildingId__eq=buildingId): resultList.append(item.attribute_values) return (resultList)
def buildings_building_id_sensors_delete(buildingId) -> str: resultList = [] for item in Sensor.scan(buildingId__eq=buildingId): resultList.append(item.delete()) return "%s items deleted." % len(resultList)
def buildings_building_id_sensors_get(buildingId) -> str: resultList = [] for item in Sensor.scan(buildingId__eq=buildingId): resultList.append(item.attribute_values) return ( resultList )