diff --git a/front/src/components/boxs/device-in-room/device-features/sensor-value/BadgeNumberDeviceValue.jsx b/front/src/components/boxs/device-in-room/device-features/sensor-value/BadgeNumberDeviceValue.jsx index 6235bd0711..de46b0591c 100644 --- a/front/src/components/boxs/device-in-room/device-features/sensor-value/BadgeNumberDeviceValue.jsx +++ b/front/src/components/boxs/device-in-room/device-features/sensor-value/BadgeNumberDeviceValue.jsx @@ -35,9 +35,21 @@ const getAqiColor = value => { return 'danger'; }; +const getVocIndexColor = value => { + if (value < 150) { + return 'success'; + } else if (value < 250) { + return 'warning'; + } else if (value < 400) { + return 'orange'; + } + return 'danger'; +}; + const BADGE_CATEGORIES = { [DEVICE_FEATURE_CATEGORIES.CO2_SENSOR]: value => colorLowAsGreen(value, 600, 1200), [DEVICE_FEATURE_CATEGORIES.VOC_SENSOR]: value => colorLowAsGreen(value, 250, 2000), + [DEVICE_FEATURE_CATEGORIES.VOC_INDEX_SENSOR]: value => getVocIndexColor(value), [DEVICE_FEATURE_CATEGORIES.PM25_SENSOR]: value => colorLowAsGreen(value, 12, 35), [DEVICE_FEATURE_CATEGORIES.FORMALDEHYD_SENSOR]: value => colorLowAsGreen(value, 50, 120), [DEVICE_FEATURE_CATEGORIES.AIRQUALITY_SENSOR]: value => getAqiColor(value) diff --git a/front/src/config/i18n/en.json b/front/src/config/i18n/en.json index 9a185284f7..522acbc353 100644 --- a/front/src/config/i18n/en.json +++ b/front/src/config/i18n/en.json @@ -2702,6 +2702,10 @@ "shortCategoryName": "VOC Sensor", "decimal": "VOC (decimal)" }, + "voc-index-sensor": { + "shortCategoryName": "VOC Index", + "integer": "VOC Index (integer)" + }, "shutter": { "shortCategoryName": "Shutter", "state": "Shutter state", diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index 4cc234b364..8ba6f0924b 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -2704,6 +2704,10 @@ "shortCategoryName": "Capteur de pollution COV", "decimal": "COV (Décimale)" }, + "voc-index-sensor": { + "shortCategoryName": "Indice COV", + "integer": "Indice COV (entier)" + }, "shutter": { "shortCategoryName": "Volet", "state": "Etat du volet", diff --git a/front/src/utils/consts.js b/front/src/utils/consts.js index d344680196..203705dda8 100644 --- a/front/src/utils/consts.js +++ b/front/src/utils/consts.js @@ -288,6 +288,9 @@ export const DeviceFeatureCategoriesIcon = { [DEVICE_FEATURE_CATEGORIES.VOC_SENSOR]: { [DEVICE_FEATURE_TYPES.VOC_SENSOR.DECIMAL]: 'bar-chart-2' }, + [DEVICE_FEATURE_CATEGORIES.VOC_INDEX_SENSOR]: { + [DEVICE_FEATURE_TYPES.VOC_INDEX_SENSOR.INTEGER]: 'bar-chart-2' + }, [DEVICE_FEATURE_CATEGORIES.DATA]: { [DEVICE_FEATURE_TYPES.DATA.SIZE]: 'hard-drive' }, diff --git a/server/services/zigbee2mqtt/exposes/numericType.js b/server/services/zigbee2mqtt/exposes/numericType.js index f98f3475d6..3a8471befe 100644 --- a/server/services/zigbee2mqtt/exposes/numericType.js +++ b/server/services/zigbee2mqtt/exposes/numericType.js @@ -702,6 +702,14 @@ module.exports = { max: 5500, }, }, + voc_index: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.VOC_INDEX_SENSOR, + type: DEVICE_FEATURE_TYPES.VOC_INDEX_SENSOR.INTEGER, + min: 1, + max: 500, + }, + }, soil_moisture: { feature: { category: DEVICE_FEATURE_CATEGORIES.SOIL_MOISTURE_SENSOR, diff --git a/server/utils/constants.js b/server/utils/constants.js index 4f4d4a8d70..e34688d856 100644 --- a/server/utils/constants.js +++ b/server/utils/constants.js @@ -433,6 +433,7 @@ const DEVICE_FEATURE_CATEGORIES = { UV_SENSOR: 'uv-sensor', VIBRATION_SENSOR: 'vibration-sensor', VOC_SENSOR: 'voc-sensor', + VOC_INDEX_SENSOR: 'voc-index-sensor', VOLUME_SENSOR: 'volume-sensor', TEXT: 'text', }; @@ -578,6 +579,9 @@ const DEVICE_FEATURE_TYPES = { VOC_SENSOR: { DECIMAL: 'decimal', }, + VOC_INDEX_SENSOR: { + INTEGER: 'integer', + }, SHUTTER: { STATE: 'state', POSITION: 'position',