diff --git a/http-bridge/controllers/generalControllers.js b/http-bridge/controllers/generalControllers.js index 8ef5bd385a5960019517c1734ffca0ba78590e50..91fedefa63855f250a95a5e53a7a3627950a2ee9 100644 --- a/http-bridge/controllers/generalControllers.js +++ b/http-bridge/controllers/generalControllers.js @@ -114,7 +114,9 @@ const fetchRealTimeData = async (type, measurementTypes, params) => { params: { measurement_type: `in.(${measurementTypes.join(",")})`, order: "ts.desc", - limit: params.limit || 100, // Default to 100 if limit is not provided. (MEETING: Remove this? It will tank performance...) + // This is set in order to avoid fetching all data and not + // to overload the system. This can be adjusted as needed. + limit: params.limit || 1000, } }); diff --git a/http-bridge/typeMaps/deviceMeasurementTypeMap.js b/http-bridge/typeMaps/deviceMeasurementTypeMap.js index 35ecc974bcc21d0b32af0216322d9de21c0cfe6e..f8f8c56d109ce6b8f7bdf892b58f653a9622292c 100644 --- a/http-bridge/typeMaps/deviceMeasurementTypeMap.js +++ b/http-bridge/typeMaps/deviceMeasurementTypeMap.js @@ -2,55 +2,33 @@ const deviceMeasurementTypeMap = { /* Each entry in the map is a key-value pair where the key is the **type of measurement** and the value is an object with the following properties: - key: A string representing the name of the property in NGSI format. - - unit: A character string representing the measurement unit for the type (e.g. "C" for temperature, "%" for humidity). + - unit: A character string representing the measurement unit for the type. - min: Min is the minimum possible value for the measurement type. - max: Max is the maximum possible value for the measurement type. - slug: The slug is used as "attrs" in the controller, allowing for the selection of specific attributes to be returned in the response. */ - // TODO: Replace the numbers with the actual measurement types - "temperature": { key: "temperature", unit: "CEL", min: 0, max: 60, slug: "temperature" }, // Θερμοκρασία 836 στο αρχείο + "temperature": { key: "temperature", unit: "CEL", min: 0, max: 60, slug: "temperature" }, "humidity": { key: "humidity", unit: "P1", min: 0, max: 100, slug: "humidity" }, - "energy": { key: "energy", unit: "KWH", min: 0, max: 10000, slug: "energyconsumption" }, // Κατανάλωση ενέργειας 581 line - "power": { key: "power", unit: "WTT", min: 0, max: 10000, slug: "powerUsage" }, // Κατανάλωση ισχύος 1155 - "luminance": { key: "luminance", unit: "A24", min: 0, max: 1000, slug: "luminance" }, // Φωτεινότητα γραμμή 1231 - 6: { key: "volt", unit: "V", min: 0, max: 1000, slug: "volt" }, // Voltage γραμμή 1035 - 7: { key: "ampere", unit: "AMP", min: 0, max: 100, slug: "current" }, // Ampere γραμμή 980 - 8: { key: "frequency", unit: "HTZ", min: 0, max: 1000, slug: "frequency" }, // γραμμή 1191 - 9: { key: "hectopascal", unit: "A97", min: 0, max: 1200, slug: "pressure" }, - 10: { key: "windSpeed", unit: "KMH", min: 0, max: 50, slug: "wind-speed" }, - 11: { key: "windDirection", unit: "DD", min: 0, max: 359.9, slug: "wind-direction" }, + "energy": { key: "energy", unit: "KWH", min: 0, max: 10000, slug: "energy_consumption" }, + "power": { key: "power", unit: "WTT", min: 0, max: 10000, slug: "power_usage" }, + "luminance": { key: "luminance", unit: "A24", min: 0, max: 1000, slug: "luminance" }, + "barometric pressure": { key: "hectopascal", unit: "A97", min: 0, max: 1200, slug: "pressure" }, + "wind speed": { key: "windSpeed", unit: "KMH", min: 0, max: 50, slug: "wind_speed" }, + "wind angle": { key: "windDirection", unit: "DD", min: 0, max: 359.9, slug: "wind_direction" }, "CO2": { key: "carbonDioxide", unit: "P1", min: 0, max: 100, slug: "co2" }, - 13: { key: "decibel", unit: "2N", min: 0, max: 100, slug: "noise_level" }, - 14: { key: "motion", unit: "A99", min: 0, max: 1, slug: "motion_detection" }, - 15: { key: "door", unit: "A99", min: 0, max: 1, slug: "magnetic_switch" }, - //14: { key: "state", unit: "", min: null, max: null, slug: "state" } // Κατάσταση συσκευής 2N γραμμή 1289 + "noise level": { key: "decibel", unit: "2N", min: 0, max: 100, slug: "noise_level" }, + "motion detection switch": { key: "motion", unit: "A99", min: 0, max: 1, slug: "motion_detection" }, + "magnetic switch": { key: "door", unit: "A99", min: 0, max: 1, slug: "magnetic_switch" }, + "UV": { key: "UVIndex", unit: "C62", min: 0, max: 10, slug: "uv" }, }; /* NOTES * - Percentages are represented as "P1" in the unit field. * - Luminance is represented as "A24" in the unit field not candela per square meter. * - Decibels are represented as "2N" in the unit field. -* -* type / unit -* battery level % -* humidity % -* CO2 % -* temperature Celcius -* temperature apparent Celcius -* switch Off -* switch On -* switch On/Off -* motion detection switch On/Off -* magnetic switch On/Off -* UV UV -* power Watt -* luminance cd/m2 -* noise level dB -* wind angle degrees -* barometric pressure hPa -* energy kWh -* wind speed km/h +* - Switches are represented as "A99" in the unit field meaning '0' or '1' (bit). +* - UV Index is represented as "C62" in the unit field meaning 'one' (synonym: unit) since UV Index is unitless. */ module.exports = deviceMeasurementTypeMap;