Skip to content

Commit

Permalink
Add surface device feature (#1811)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles authored Jun 9, 2023
1 parent 774a740 commit 13205dc
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 4 deletions.
14 changes: 12 additions & 2 deletions front/src/config/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,10 @@
"megabytes-per-second": "Megabytes per second (MB/s)",
"gigabytes-per-second": "Gigabytes per second (GB/s)",
"aqi": "Air Quality Index",
"microgram-per-cubic-meter": "Microgram per cubic meter (µg/m³)"
"microgram-per-cubic-meter": "Microgram per cubic meter (µg/m³)",
"square-centimeter": "Square centimer (cm2)",
"square-meter": "Square meter (m2)",
"square-kilometer": "Square kilometer (km2)"
},
"deviceFeatureUnitShort": {
"celsius": "°C",
Expand Down Expand Up @@ -2009,7 +2012,10 @@
"megabytes-per-second": "MB/s",
"gigabytes-per-second": "GB/s",
"aqi": "AQI",
"microgram-per-cubic-meter": "µg/m³"
"microgram-per-cubic-meter": "µg/m³",
"square-centimeter": "cm2",
"square-meter": "m2",
"square-kilometer": "km2"
},
"deviceFeatureAction": {
"category": {
Expand Down Expand Up @@ -2324,6 +2330,10 @@
"shortCategoryName": "Text",
"text": "Text"
},
"surface": {
"shortCategoryName": "Surface",
"decimal": "Surface"
},
"unknown": {
"shortCategoryName": "Unknown",
"unknown": "Unknown"
Expand Down
14 changes: 12 additions & 2 deletions front/src/config/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1936,7 +1936,10 @@
"megabytes-per-second": "Megaoctets par seconde (Mo/s)",
"gigabytes-per-second": "Gigaoctets par seconde (Go/s)",
"aqi": "Indice de Qualité de l'Air",
"microgram-per-cubic-meter": "Microgramme par mètre cube (µg/m³)"
"microgram-per-cubic-meter": "Microgramme par mètre cube (µg/m³)",
"square-centimeter": "Centimètre carré (cm2)",
"square-meter": "Mètre carré (m2)",
"square-kilometer": "Kilomètre carré (km2)"
},
"deviceFeatureUnitShort": {
"celsius": "°C",
Expand Down Expand Up @@ -2009,7 +2012,10 @@
"megabytes-per-second": "Mo/s",
"gigabytes-per-second": "Go/s",
"aqi": "AQI",
"microgram-per-cubic-meter": "µg/m³"
"microgram-per-cubic-meter": "µg/m³",
"square-centimeter": "cm2",
"square-meter": "m2",
"square-kilometer": "km2"
},
"deviceFeatureAction": {
"category": {
Expand Down Expand Up @@ -2324,6 +2330,10 @@
"shortCategoryName": "Texte",
"text": "Texte"
},
"surface": {
"shortCategoryName": "Surface",
"decimal": "Surface"
},
"unknown": {
"shortCategoryName": "Inconnu",
"unknown": "Inconnu"
Expand Down
3 changes: 3 additions & 0 deletions front/src/utils/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,9 @@ export const DeviceFeatureCategoriesIcon = {
[DEVICE_FEATURE_CATEGORIES.TEXT]: {
[DEVICE_FEATURE_TYPES.TEXT.TEXT]: 'type'
},
[DEVICE_FEATURE_CATEGORIES.SURFACE]: {
[DEVICE_FEATURE_TYPES.SURFACE.DECIMAL]: 'crop'
},
[DEVICE_FEATURE_CATEGORIES.UNKNOWN]: {
[DEVICE_FEATURE_TYPES.UNKNOWN.UNKNOWN]: 'help-circle'
}
Expand Down
13 changes: 13 additions & 0 deletions server/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ const DEVICE_FEATURE_CATEGORIES = {
SISMIC_SENSOR: 'sismic-sensor',
SMOKE_SENSOR: 'smoke-sensor',
SOIL_MOISTURE_SENSOR: 'soil-moisture-sensor',
SURFACE: 'surface',
SWITCH: 'switch',
SPEED_SENSOR: 'speed-sensor',
TELEVISION: 'television',
Expand Down Expand Up @@ -436,6 +437,9 @@ const DEVICE_FEATURE_TYPES = {
MODE: 'mode',
TARGET_TEMPERATURE: 'target-temperature',
},
SURFACE: {
DECIMAL: 'decimal',
},
TELEVISION: {
BINARY: 'binary',
SOURCE: 'source',
Expand Down Expand Up @@ -562,6 +566,10 @@ const DEVICE_FEATURE_UNITS = {
CM: 'cm',
M: 'm',
KM: 'km',
// surface units
SQUARE_CENTIMETER: 'square-centimeter',
SQUARE_METER: 'square-meter',
SQUARE_KILOMETER: 'square-kilometer',
// Degree units
DEGREE: 'degree',
// Volume units
Expand Down Expand Up @@ -733,6 +741,11 @@ const DEVICE_FEATURE_UNITS_BY_CATEGORY = {
[DEVICE_FEATURE_CATEGORIES.AIRQUALITY_SENSOR]: [DEVICE_FEATURE_UNITS.AQI],
[DEVICE_FEATURE_CATEGORIES.PM25_SENSOR]: [DEVICE_FEATURE_UNITS.MICROGRAM_PER_CUBIC_METER],
[DEVICE_FEATURE_CATEGORIES.FORMALDEHYD_SENSOR]: [DEVICE_FEATURE_UNITS.MICROGRAM_PER_CUBIC_METER],
[DEVICE_FEATURE_CATEGORIES.SURFACE]: [
DEVICE_FEATURE_UNITS.SQUARE_CENTIMETER,
DEVICE_FEATURE_UNITS.SQUARE_METER,
DEVICE_FEATURE_UNITS.SQUARE_KILOMETER,
],
};

const ACTIONS_STATUS = {
Expand Down

0 comments on commit 13205dc

Please sign in to comment.