From 922fd9f0e87437f4737b0d5d87f65de4f8f91338 Mon Sep 17 00:00:00 2001 From: William Deren Date: Mon, 11 Nov 2024 09:42:12 +0100 Subject: [PATCH] Zigbee2mqtt: Add specific features to Lixee TIC devices (#2141) --- front/src/config/i18n/de.json | 61 ++ front/src/config/i18n/en.json | 61 ++ front/src/config/i18n/fr.json | 61 ++ front/src/utils/consts.js | 60 ++ ...0241105200700-update-lixee-tic-features.js | 895 ++++++++++++++++++ .../zigbee2mqtt/exposes/numericType.js | 471 +++++---- server/utils/constants.js | 61 ++ 7 files changed, 1478 insertions(+), 192 deletions(-) create mode 100644 server/migrations/20241105200700-update-lixee-tic-features.js diff --git a/front/src/config/i18n/de.json b/front/src/config/i18n/de.json index 58ee0174cc..bd9aa85947 100644 --- a/front/src/config/i18n/de.json +++ b/front/src/config/i18n/de.json @@ -3133,6 +3133,67 @@ "index": "Index", "daily-consumption": "Tagesverbrauch" }, + "teleinformation": { + "shortCategoryName": "Teleinformation", + "binary": "Schalter", + "east": "Gesamt abgegebene Wirkleistung (EAST)", + "eait": "Gesamt eingespeiste Wirkleistung (EAIT)", + "easf01": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF01)", + "easf02": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF02)", + "easf03": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF03)", + "easf04": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF04)", + "easf05": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF05)", + "easf06": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF06)", + "easf07": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF07)", + "easf08": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF08)", + "easf09": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF09)", + "easf10": "Gesamt abgegebene Wirkleistung vom Anbieter (EASF10)", + "pref": "Referenz-Scheinleistung (PREF)", + "pcoup": "Scheinleistungsschwelle (PCOUP)", + "vtic": "Protokollversion (VTIC)", + "ccasn": "Aktueller Punkt der entnommenen Lastkurve (CCASN)", + "ccasn_1": "Vorheriger Punkt der entnommenen Lastkurve (CCASN-1)", + "umoy1": "Durchschnittliche Effektivspannung (UMOY1)", + "umoy2": "Durchschnittliche Effektivspannung (UMOY2)", + "umoy3": "Durchschnittliche Effektivspannung (UMOY3)", + "erq1": "Gesamt Blindleistung Q1 (ERQ1)", + "erq2": "Gesamt Blindleistung Q2 (ERQ2)", + "erq3": "Gesamt Blindleistung Q3 (ERQ3)", + "erq4": "Gesamt Blindleistung Q4 (ERQ4)", + "irms1": "Effektivstrom (IRMS1)", + "irms2": "Effektivstrom (IRMS2)", + "irms3": "Effektivstrom (IRMS3)", + "urms1": "Effektivspannung (URMS1)", + "urms2": "Effektivspannung (URMS2)", + "urms3": "Effektivspannung (URMS3)", + "easd01": "Entnommene Wirkenergie des Verteilers (EASD01)", + "easd02": "Entnommene Wirkenergie des Verteilers (EASD02)", + "easd03": "Entnommene Wirkenergie des Verteilers (EASD03)", + "easd04": "Entnommene Wirkenergie des Verteilers (EASD04)", + "ntarf": "Tarif-Indexnummer (NTARF)", + "ccain": "Punkt n der entnommenen Lastkurve (CCAIN)", + "ccain_1": "Punkt n-1 der entnommenen Lastkurve (CCAIN-1)", + "sinsti": "Momentan eingespeiste Scheinleistung (SINSTI)", + "smaxin": "Max. eingespeiste Scheinleistung n (SMAXIN)", + "smaxin_1": "Max. eingespeiste Scheinleistung n-1 (SMAXIN-1)", + "smaxn": "Max. abgegebene Scheinleistung (SMAXN)", + "smaxn2": "Max. abgegebene Scheinleistung (SMAXN2)", + "smaxn3": "Max. abgegebene Scheinleistung (SMAXN3)", + "sinsts": "Momentane abgegebene Scheinleistung (SINSTS)", + "sinsts2": "Momentane abgegebene Scheinleistung (SINSTS2)", + "sinsts3": "Momentane abgegebene Scheinleistung (SINSTS3)", + "smaxn_1": "Max. entnommene Scheinleistung n-1 (SMAXN-1)", + "smaxn2_1": "Max. entnommene Scheinleistung n-1 (SMAXN2-1)", + "smaxn3_1": "Max. entnommene Scheinleistung n-1 (SMAXN3-1)", + "hhphc": "HPHC-Programm (HHPHC)", + "imax": "Spitzenstrom (IMAX)", + "adps": "Warnung bei Überschreitung der Vertragsleistung (ADPS)", + "imax2": "Spitzenstrom (IMAX2)", + "imax3": "Spitzenstrom (IMAX3)", + "adir1": "Überstromwarnung (ADIR1)", + "adir2": "Überstromwarnung (ADIR2)", + "adir3": "Überstromwarnung (ADIR3)" + }, "volume-sensor": { "shortCategoryName": "Lautstärke-Sensor", "decimal": "Lautstärke (dezimal)", diff --git a/front/src/config/i18n/en.json b/front/src/config/i18n/en.json index 0ee6df62e6..dbb0249354 100644 --- a/front/src/config/i18n/en.json +++ b/front/src/config/i18n/en.json @@ -3133,6 +3133,67 @@ "index": "Index", "daily-consumption": "Daily Consumption" }, + "teleinformation": { + "shortCategoryName": "Teleinformation", + "binary": "Switch", + "east": "Total active power delivered (EAST)", + "eait": "Total active power injected (EAIT)", + "easf01": "Total provider active power delivered (EASF01)", + "easf02": "Total provider active power delivered (EASF02)", + "easf03": "Total provider active power delivered (EASF03)", + "easf04": "Total provider active power delivered (EASF04)", + "easf05": "Total provider active power delivered (EASF05)", + "easf06": "Total provider active power delivered (EASF06)", + "easf07": "Total provider active power delivered (EASF07)", + "easf08": "Total provider active power delivered (EASF08)", + "easf09": "Total provider active power delivered (EASF09)", + "easf10": "Total provider active power delivered (EASF10)", + "pref": "Apparent power of reference (PREF)", + "pcoup": "Apparent power threshold (PCOUP)", + "vtic": "Protocol version (VTIC)", + "ccasn": "Current point of the active load curve drawn (CCASN)", + "ccasn_1": "Previous point of the active load curve drawn (CCASN-1)", + "umoy1": "Average RMS voltage (UMOY1)", + "umoy2": "Average RMS voltage (UMOY2)", + "umoy3": "Average RMS voltage (UMOY3)", + "erq1": "Total reactive power Q1 (ERQ1)", + "erq2": "Total reactive power Q2 (ERQ2)", + "erq3": "Total reactive power Q3 (ERQ3)", + "erq4": "Total reactive power Q4 (ERQ4)", + "irms1": "RMS current (IRMS1)", + "irms2": "RMS current (IRMS2)", + "irms3": "RMS current (IRMS3)", + "urms1": "RMS voltage (URMS1)", + "urms2": "RMS voltage (URMS2)", + "urms3": "RMS voltage (URMS3)", + "easd01": "Active energy withdrawn Distributor (EASD01)", + "easd02": "Active energy withdrawn Distributor (EASD02)", + "easd03": "Active energy withdrawn Distributor (EASD03)", + "easd04": "Active energy withdrawn Distributor (EASD04)", + "ntarf": "Tarif index number (NTARF)", + "ccain": "Point n of the withdrawn active load curve (CCAIN)", + "ccain_1": "Point n-1 of the withdrawn active load curve (CCAIN-1)", + "sinsti": "Instantaneous apparent power injected (SINSTI)", + "smaxin": "Apparent power max. injected n (SMAXIN)", + "smaxin_1": "Apparent power max. injected n-1 (SMAXIN-1)", + "smaxn": "Apparent power delivered peak (SMAXN)", + "smaxn2": "Apparent power delivered peak (SMAXN2)", + "smaxn3": "Apparent power delivered peak (SMAXN3)", + "sinsts": "Immediate apparent power delivered (SINSTS)", + "sinsts2": "Immediate apparent power delivered (SINSTS2)", + "sinsts3": "Immediate apparent power delivered (SINSTS3)", + "smaxn_1": "Apparent power max. draw-off n-1 (SMAXN-1)", + "smaxn2_1": "Apparent power max. draw-off n-1 (SMAXN2-1)", + "smaxn3_1": "Apparent power max. draw-off n-1 (SMAXN3-1)", + "hhphc": "HPHC Program (HHPHC)", + "imax": "RMS current peak (IMAX)", + "adps": "Subscribed Power Exceeded Warning (ADPS)", + "imax2": "RMS current peak (IMAX2)", + "imax3": "RMS current peak (IMAX3)", + "adir1": "Overcurrent alert (ADIR1)", + "adir2": "Overcurrent alert (ADIR2)", + "adir3": "Overcurrent alert (ADIR3)" + }, "volume-sensor": { "shortCategoryName": "Volume sensor", "decimal": "Volume (decimal)", diff --git a/front/src/config/i18n/fr.json b/front/src/config/i18n/fr.json index cafd79f2f1..7d9ad6f9b1 100644 --- a/front/src/config/i18n/fr.json +++ b/front/src/config/i18n/fr.json @@ -3133,6 +3133,67 @@ "index": "Index", "daily-consumption": "Consommation journalière" }, + "teleinformation": { + "shortCategoryName": "Téléinformation", + "binary": "Relais", + "east": "Energie active soutirée totale (EAST)", + "eait": "Energie active injectée totale (EAIT)", + "easf01": "Energie active soutirée fournisseur (EASF01)", + "easf02": "Energie active soutirée fournisseur (EASF02)", + "easf03": "Energie active soutirée fournisseur (EASF03)", + "easf04": "Energie active soutirée fournisseur (EASF04)", + "easf05": "Energie active soutirée fournisseur (EASF05)", + "easf06": "Energie active soutirée fournisseur (EASF06)", + "easf07": "Energie active soutirée fournisseur (EASF07)", + "easf08": "Energie active soutirée fournisseur (EASF08)", + "easf09": "Energie active soutirée fournisseur (EASF09)", + "easf10": "Energie active soutirée fournisseur (EASF10)", + "pref": "Puissance apparente référence (PREF)", + "pcoup": "Puissance apparente coupure (PCOUP)", + "vtic": "Version du protocole (VTIC)", + "ccasn": "Position de la courbe charge active (CCASN)", + "ccasn_1": "Position de la courbe charge active (CCASN-1)", + "umoy1": "Tension moyenne (UMOY1)", + "umoy2": "Tension moyenne (UMOY2)", + "umoy3": "Tension moyenne (UMOY3)", + "erq1": "Energie réactive Q1 totale (ERQ1)", + "erq2": "Energie réactive Q2 totale (ERQ2)", + "erq3": "Energie réactive Q3 totale (ERQ3)", + "erq4": "Energie réactive Q4 totale (ERQ4)", + "irms1": "Courant efficace (IRMS1)", + "irms2": "Courant efficace (IRMS2)", + "irms3": "Courant efficace (IRMS3)", + "urms1": "Tension efficace (URMS1)", + "urms2": "Tension efficace (URMS2)", + "urms3": "Tension efficace (URMS3)", + "easd01": "Energie active soutirée distributeur (EASD01)", + "easd02": "Energie active soutirée distributeur (EASD02)", + "easd03": "Energie active soutirée distributeur (EASD03)", + "easd04": "Energie active soutirée distributeur (EASD04)", + "ntarf": "Numéro d'indice tarifaire (NTARF)", + "ccain": "Point n de la courbe de charge active injectée (CCAIN)", + "ccain_1": "Point n-1 de la courbe de charge active injectée (CCAIN-1)", + "sinsti": "Puissance apparente instantanée injectée (SINSTI)", + "smaxin": "Puissance apparente max. injectée n (SMAXIN)", + "smaxin_1": "Puissance apparente max. injectée n-1 (SMAXIN-1)", + "smaxn": "Puissance apparente max. soutirée (SMAXN)", + "smaxn2": "Puissance apparente max. soutirée (SMAXN2)", + "smaxn3": "Puissance apparente max. soutirée (SMAXN3)", + "sinsts": "Puissance apparente instantanée soutirée (SINSTS)", + "sinsts2": "Puissance apparente instantanée soutirée (SINSTS2)", + "sinsts3": "Puissance apparente instantanée soutirée (SINSTS3)", + "smaxn_1": "Puissance apparente max. soutirée n-1 (SMAXN-1)", + "smaxn2_1": "Puissance apparente max. soutirée n-1 (SMAXN2-1)", + "smaxn3_1": "Puissance apparente max. soutirée n-1 (SMAXN3-1)", + "hhphc": "Programme HPHC (HHPHC)", + "imax": "Intensité maximale (IMAX)", + "adps": "Alerte dépassement puissance souscrite (ADPS)", + "imax2": "Intensité maximale (IMAX2)", + "imax3": "Intensité maximale (IMAX3)", + "adir1": "Alerte de surcourant (ADIR1)", + "adir2": "Alerte de surcourant (ADIR2)", + "adir3": "Alerte de surcourant (ADIR3)" + }, "volume-sensor": { "shortCategoryName": "Capteur de volume", "decimal": "Volume (décimale)", diff --git a/front/src/utils/consts.js b/front/src/utils/consts.js index dc0a7a71b4..aa0206e016 100644 --- a/front/src/utils/consts.js +++ b/front/src/utils/consts.js @@ -281,6 +281,66 @@ export const DeviceFeatureCategoriesIcon = { [DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE]: 'zap', [DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX]: 'zap' }, + [DEVICE_FEATURE_CATEGORIES.TELEINFORMATION]: { + [DEVICE_FEATURE_TYPES.TELEINFORMATION.BINARY]: 'power', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EAST]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EAIT]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF01]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF02]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF03]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF04]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF05]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF06]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF07]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF08]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF09]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF10]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.PREF]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.PCOUP]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.VTIC]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.CCASN]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.CCASN_1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY3]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ3]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ4]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.IRMS1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.IRMS2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.IRMS3]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS3]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD01]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD02]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD03]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD04]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.NTARF]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.CCAIN]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.CCAIN_1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTI]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXIN]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXIN_1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN3]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS3]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN_1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN2_1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN3_1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.HHPHC]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ADPS]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX3]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ADIR1]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ADIR2]: 'zap', + [DEVICE_FEATURE_TYPES.TELEINFORMATION.ADIR3]: 'zap' + }, [DEVICE_FEATURE_CATEGORIES.SPEED_SENSOR]: { [DEVICE_FEATURE_TYPES.SPEED_SENSOR.DECIMAL]: 'wind', [DEVICE_FEATURE_TYPES.SPEED_SENSOR.INTEGER]: 'wind' diff --git a/server/migrations/20241105200700-update-lixee-tic-features.js b/server/migrations/20241105200700-update-lixee-tic-features.js new file mode 100644 index 0000000000..4b24fc077a --- /dev/null +++ b/server/migrations/20241105200700-update-lixee-tic-features.js @@ -0,0 +1,895 @@ +const Promise = require('bluebird'); +const db = require('../models'); +const logger = require('../utils/logger'); +const { DEVICE_FEATURE_CATEGORIES, DEVICE_FEATURE_TYPES } = require('../utils/constants'); + +module.exports = { + up: async (queryInterface, Sequelize) => { + // Get Zigbee2mqtt service + const service = await db.Service.findOne({ + where: { + name: 'zigbee2mqtt', + }, + }); + if (service === null) { + logger.info('Zigbee2mqtt service not found.'); + return; + } + logger.info(`Zigbee2mqtt migration: Found service zigbee2mqtt = ${service.id}`); + const zigbee2mqttDevices = await db.Device.findAll({ + where: { + service_id: service.id, + }, + }); + logger.info(`Zigbee2mqtt migration: Found ${zigbee2mqttDevices.length} zigbee2mqtt devices`); + + const lixeeTicdevices = await db.Device.findAll({ + where: { + model: `ZLinky_TIC`, + }, + }); + logger.info(`Zigbee2mqtt migration: Found ${lixeeTicdevices.length} lixee-tic devices`); + + await Promise.each(lixeeTicdevices, async (lixeeTicdevice) => { + // Load impacted features + const features = await db.DeviceFeature.findAll({ + where: { + device_id: lixeeTicdevice.id, + }, + }); + logger.info(`Zigbee2mqtt migration: Found ${features.length} Linky_TIC features`); + + await Promise.mapSeries(features, async (feature) => { + const { id, selector, name } = feature; + + // Modify EAST + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EAST, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active délivrée totale (EAST)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EAIT + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-summ-received` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EAIT, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active injectée totale (EAIT)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF01 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier1-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF01, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF01)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF02 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier2-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF02, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF02)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF03 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier3-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF03, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF03)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF04 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier4-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF04, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF04)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF05 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier5-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF05, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF05)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF06 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier6-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF06, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF06)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF07 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier7-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF07, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF07)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF08 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier8-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF08, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF08)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF09 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier9-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF09, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF09)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASF10 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-tier10-summ-delivered` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF10, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée fournisseur (EASF10)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify PREF + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT}-available-power` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.PREF, + }; + + if (name === 'Intensité') { + currentFields.name = 'Puissance apparente référence (PREF)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify PCOUP + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT}-power-threshold` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.PCOUP, + }; + + if (name === 'Intensité') { + currentFields.name = 'Puissance apparente coupure (PCOUP)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify CCASN + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-active-power` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCASN, + }; + + if (name === 'Puissance') { + currentFields.name = 'Position de la courbe charge active (CCASN)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify CCASN-1 Position de la courbe charge active (CCASN-1) + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-active-power-ph-b` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCASN_1, + }; + + if (name === 'Puissance') { + currentFields.name = 'Position de la courbe charge active (CCASN-1)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify UMOY1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE}-average-rms-voltage-meas-period` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY1, + }; + + if (name === 'Tension') { + currentFields.name = 'Tension moyenne (UMOY1)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify UMOY2 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE}-average-rms-voltage-measure-period-ph-b` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY2, + }; + + if (name === 'Tension') { + currentFields.name = 'Tension moyenne (UMOY2)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify UMOY3 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE}-average-rms-voltage-meas-period-ph-c` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY3, + }; + + if (name === 'Tension') { + currentFields.name = 'Tension moyenne (UMOY3)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify ERQ1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-total-reactive-power` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ1, + }; + + if (name === 'Puissance') { + currentFields.name = 'Puissance réactive Q1 totale (ERQ1)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify ERQ2 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-reactive-power` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ2, + }; + + if (name === 'Puissance') { + currentFields.name = 'Puissance réactive Q2 totale (ERQ2)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify ERQ3 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-reactive-power-ph-b` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ3, + }; + + if (name === 'Puissance') { + currentFields.name = 'Puissance réactive Q3 totale (ERQ3)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify ERQ4 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-reactive-power-ph-c` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ4, + }; + + if (name === 'Puissance') { + currentFields.name = 'Puissance réactive Q4 totale (ERQ4)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify IRMS1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT}-rms-current` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IRMS1, + }; + + if (name === 'Intensité') { + currentFields.name = 'Courant efficace (IRMS1)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify URMS1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE}-rms-voltage` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS1, + }; + + if (name === 'Tension') { + currentFields.name = 'Tension efficace (URMS1)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify URMS2 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE}-rms-voltage-ph-b` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS2, + }; + + if (name === 'Tension') { + currentFields.name = 'Tension efficace (URMS2)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify URMS3 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE}-rms-voltage-ph-c` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS3, + }; + + if (name === 'Tension') { + currentFields.name = 'Tension efficace (URMS3)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASD01 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-active-energy-out-d01` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD01, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée distributeur (EASD01)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASD02 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-active-energy-out-d02` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD02, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée distributeur (EASD02)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASD03 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-active-energy-out-d03` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD03, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée distributeur (EASD03)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify EASD04 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-active-energy-out-d04` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD04, + }; + + if (name === 'Index') { + currentFields.name = 'Energie active soutirée distributeur (EASD04)'; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify NTARF + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX}-current-index-tarif` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.NTARF, + }; + + if (name === 'Index') { + currentFields.name = `Numéro d'indice tarifaire (NTARF)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify CCAIN + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-injected-active-load-n` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCAIN, + }; + + if (name === 'Puissance') { + currentFields.name = `Point n de la courbe de charge active retirée (CCAIN)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify CCAIN-1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-injected-active-load-n1` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCAIN_1, + }; + + if (name === 'Puissance') { + currentFields.name = `Point n-1 de la courbe de charge active retirée (CCAIN-1)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SINSTI + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-injected-v-a` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTI, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente instantanée injectée (SINSTI)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXIN + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-injected-v-a-max-n` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXIN, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. injectée n (SMAXIN)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXIN-1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-injected-v-a-max-n1` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXIN_1, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. injectée n-1 (SMAXIN-1)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify RELAIS + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.BINARY}-relais` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.BINARY, + }; + + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXN + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-active-power-max` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. soutirée (SMAXN)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXN2 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-active-power-max-ph-b` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN2, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. soutirée (SMAXN2)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXN3 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-active-power-max-ph-c` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN3, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. soutirée (SMAXN3)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SINSTS + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-apparent-power` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente instantanée soutirée (SINSTS)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SINSTS2 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-apparent-power-ph-b` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS2, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente instantanée soutirée (SINSTS2)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SINSTS3 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-apparent-power-ph-c` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS3, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente instantanée soutirée (SINSTS3)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXN-1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-drawn-v-a-max-n1` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN_1, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. soutirée n-1 (SMAXN-1)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXN2-1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-drawn-v-a-max-n1-p2` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN2_1, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. soutirée n-1 (SMAXN2-1)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify SMAXN3-1 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER}-drawn-v-a-max-n1-p3` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN3_1, + }; + + if (name === 'Puissance') { + currentFields.name = `Puissance apparente max. soutirée n-1 (SMAXN3-1)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify IMAX + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT}-rms-current-max` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX, + }; + + if (name === 'Intensité') { + currentFields.name = `Intensité maximale (IMAX)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify IMAX2 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT}-rms-current-max-ph-b` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX2, + }; + + if (name === 'Intensité') { + currentFields.name = `Intensité maximale (IMAX2)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + + // Modify IMAX3 + if ( + selector === + `${service.selector}-${lixeeTicdevice.selector}-${DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR}-${DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT}-rms-current-max-ph-c` + ) { + const currentFields = { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX3, + }; + + if (name === 'Intensité') { + currentFields.name = `Intensité maximale (IMAX3)`; + } + await feature.update(currentFields); + logger.info(`Zigbee2mqtt migration: Updating device_feature ${id}`); + } + }); + }); + }, + down: async (queryInterface, Sequelize) => {}, +}; diff --git a/server/services/zigbee2mqtt/exposes/numericType.js b/server/services/zigbee2mqtt/exposes/numericType.js index aa142a0ad2..d3498fa0cb 100644 --- a/server/services/zigbee2mqtt/exposes/numericType.js +++ b/server/services/zigbee2mqtt/exposes/numericType.js @@ -270,73 +270,73 @@ module.exports = { }, }, // Lixee TIC Device - BASE: { + EAST: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EAST, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - ISOUSC: { + EAIT: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EAIT, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - HCHC: { + EASF01: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF01, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - HCHP: { + EASF02: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF02, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - BBRHCJW: { + EASF03: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF03, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - BBRHPJW: { + EASF04: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF04, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - BBRHCJR: { + EASF05: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF05, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - BBRHPJR: { + EASF06: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF06, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, @@ -344,8 +344,8 @@ module.exports = { }, EASF07: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF07, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, @@ -353,8 +353,8 @@ module.exports = { }, EASF08: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF08, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, @@ -362,8 +362,8 @@ module.exports = { }, EASF09: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF09, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, @@ -371,136 +371,142 @@ module.exports = { }, EASF10: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASF10, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - IINST: { + PREF: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.PREF, + unit: DEVICE_FEATURE_UNITS.KILOVOLT_AMPERE, }, }, - IINST2: { + PCOUP: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.PCOUP, + unit: DEVICE_FEATURE_UNITS.KILOVOLT_AMPERE, }, }, - IINST3: { + VTIC: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.VTIC, }, }, - IMAX: { + CCASN: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCASN, + unit: DEVICE_FEATURE_UNITS.WATT, }, }, - IMAX2: { + 'CCASN-1': { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCASN_1, + unit: DEVICE_FEATURE_UNITS.WATT, }, }, - IMAX3: { + UMOY1: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY1, + unit: DEVICE_FEATURE_UNITS.VOLT, }, }, - PMAX: { + UMOY2: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.WATT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY2, + unit: DEVICE_FEATURE_UNITS.VOLT, }, }, - SMAXN: { + UMOY3: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.UMOY2, + unit: DEVICE_FEATURE_UNITS.VOLT, }, }, - SMAXN2: { + ERQ1: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ1, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, }, }, - SMAXN3: { + ERQ2: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ2, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, }, }, - 'SMAXN-1': { + ERQ3: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ3, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, }, }, - 'SMAXN2-1': { + ERQ4: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ERQ4, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, }, }, - 'SMAXN3-1': { + IRMS1: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IRMS1, + unit: DEVICE_FEATURE_UNITS.AMPERE, }, }, - PAPP: { + IRMS2: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IRMS2, + unit: DEVICE_FEATURE_UNITS.AMPERE, }, }, - SINSTS: { + IRMS3: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IRMS3, + unit: DEVICE_FEATURE_UNITS.AMPERE, }, }, - SINSTS2: { + URMS1: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS1, + unit: DEVICE_FEATURE_UNITS.VOLT, }, }, - SINSTS3: { + URMS2: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS2, + unit: DEVICE_FEATURE_UNITS.VOLT, + }, + }, + URMS3: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.URMS3, + unit: DEVICE_FEATURE_UNITS.VOLT, }, }, EASD01: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD01, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, @@ -508,8 +514,8 @@ module.exports = { }, EASD02: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD02, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, @@ -517,8 +523,8 @@ module.exports = { }, EASD03: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD03, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, @@ -526,204 +532,285 @@ module.exports = { }, EASD04: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.EASD04, unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - URMS1: { + NTARF: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE, - unit: DEVICE_FEATURE_UNITS.VOLT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.NTARF, }, }, - URMS2: { + CCAIN: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE, - unit: DEVICE_FEATURE_UNITS.VOLT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCAIN, + unit: DEVICE_FEATURE_UNITS.WATT, }, }, - URMS3: { + 'CCAIN-1': { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE, - unit: DEVICE_FEATURE_UNITS.VOLT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.CCAIN_1, + unit: DEVICE_FEATURE_UNITS.WATT, }, }, SINSTI: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTI, unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, SMAXIN: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXIN, unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, 'SMAXIN-1': { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXIN_1, unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - CCAIN: { + RELAIS: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.WATT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.BINARY, }, }, - 'CCAIN-1': { + SMAXN: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.WATT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - CCASN: { + SMAXN2: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.WATT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN2, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - 'CCASN-1': { + SMAXN3: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.WATT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN3, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - UMOY1: { + SINSTS: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE, - unit: DEVICE_FEATURE_UNITS.VOLT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - UMOY2: { + SINSTS2: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE, - unit: DEVICE_FEATURE_UNITS.VOLT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS2, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - UMOY3: { + SINSTS3: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.VOLTAGE, - unit: DEVICE_FEATURE_UNITS.VOLT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SINSTS3, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - ERQ2: { + 'SMAXN-1': { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN_1, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - ERQ3: { + 'SMAXN2-1': { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN2_1, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - ERQ4: { + 'SMAXN3-1': { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.SMAXN3_1, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, }, }, - ERQ1: { + HHPHC: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, - unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE_REACTIVE, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.HHPHC, }, }, - EAIT: { + IMAX: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, - unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX, + unit: DEVICE_FEATURE_UNITS.AMPERE, }, }, - NTARF: { + IMAX2: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX2, + unit: DEVICE_FEATURE_UNITS.AMPERE, }, }, - IRMS1: { + IMAX3: { feature: { - category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.IMAX3, unit: DEVICE_FEATURE_UNITS.AMPERE, }, }, - PREF: { + ADPS: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ADPS, + unit: DEVICE_FEATURE_UNITS.AMPERE, + }, + }, + ADIR1: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ADIR1, + unit: DEVICE_FEATURE_UNITS.AMPERE, + }, + }, + ADIR2: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ADIR2, + unit: DEVICE_FEATURE_UNITS.AMPERE, + }, + }, + ADIR3: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.TELEINFORMATION, + type: DEVICE_FEATURE_TYPES.TELEINFORMATION.ADIR3, + unit: DEVICE_FEATURE_UNITS.AMPERE, + }, + }, + BASE: { feature: { category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.KILOVOLT_AMPERE, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, + min: 0, + max: 1000000, }, }, - PCOUP: { + ISOUSC: { feature: { category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, - unit: DEVICE_FEATURE_UNITS.KILOVOLT_AMPERE, + unit: DEVICE_FEATURE_UNITS.AMPERE, + min: 0, + max: 1000000, }, }, - RELAIS: { + HCHC: { feature: { category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, - type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.BINARY, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, + min: 0, + max: 1000000, }, }, - EAST: { + HCHP: { feature: { category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - EASF01: { + BBRHCJW: { feature: { category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - EASF02: { + BBRHPJW: { feature: { category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, - EASF03: { + BBRHCJR: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, + min: 0, + max: 1000000, + }, + }, + BBRHPJR: { feature: { category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.INDEX, + unit: DEVICE_FEATURE_UNITS.KILOWATT_HOUR, min: 0, max: 1000000, }, }, + IINST: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, + unit: DEVICE_FEATURE_UNITS.AMPERE, + }, + }, + IINST2: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, + unit: DEVICE_FEATURE_UNITS.AMPERE, + }, + }, + IINST3: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.CURRENT, + unit: DEVICE_FEATURE_UNITS.AMPERE, + }, + }, + PMAX: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, + unit: DEVICE_FEATURE_UNITS.WATT, + }, + }, + PAPP: { + feature: { + category: DEVICE_FEATURE_CATEGORIES.ENERGY_SENSOR, + type: DEVICE_FEATURE_TYPES.ENERGY_SENSOR.POWER, + unit: DEVICE_FEATURE_UNITS.VOLT_AMPERE, + }, + }, // End of Lixee TIC device voc: { feature: { diff --git a/server/utils/constants.js b/server/utils/constants.js index b9c70e5bd7..3f71779abf 100644 --- a/server/utils/constants.js +++ b/server/utils/constants.js @@ -483,6 +483,7 @@ const DEVICE_FEATURE_CATEGORIES = { SWITCH: 'switch', SPEED_SENSOR: 'speed-sensor', TAMPER: 'tamper', + TELEINFORMATION: 'teleinformation', TELEVISION: 'television', TEMPERATURE_SENSOR: 'temperature-sensor', THERMOSTAT: 'thermostat', @@ -627,6 +628,66 @@ const DEVICE_FEATURE_TYPES = { INDEX: 'index', DAILY_CONSUMPTION: 'daily-consumption', }, + TELEINFORMATION: { + BINARY: 'binary', + EAST: 'east', + EAIT: 'eait', + EASF01: 'easf01', + EASF02: 'easf02', + EASF03: 'easf03', + EASF04: 'easf04', + EASF05: 'easf05', + EASF06: 'easf06', + EASF07: 'easf07', + EASF08: 'easf08', + EASF09: 'easf09', + EASF10: 'easf10', + PREF: 'pref', + PCOUP: 'pcoup', + VTIC: 'vtic', + CCASN: 'ccasn', + CCASN_1: 'ccasn_1', + UMOY1: 'umoy1', + UMOY2: 'umoy2', + UMOY3: 'umoy3', + ERQ1: 'erq1', + ERQ2: 'erq2', + ERQ3: 'erq3', + ERQ4: 'erq4', + IRMS1: 'irms1', + IRMS2: 'irms2', + IRMS3: 'irms3', + URMS1: 'urms1', + URMS2: 'urms2', + URMS3: 'urms3', + EASD01: 'easd01', + EASD02: 'easd02', + EASD03: 'easd03', + EASD04: 'easd04', + NTARF: 'ntarf', + CCAIN: 'ccain', + CCAIN_1: 'ccain_1', + SINSTI: 'sinsti', + SMAXIN: 'smaxin', + SMAXIN_1: 'smaxin_1', + SMAXN: 'smaxn', + SMAXN2: 'smaxn2', + SMAXN3: 'smaxn3', + SINSTS: 'sinsts', + SINSTS2: 'sinsts2', + SINSTS3: 'sinsts3', + SMAXN_1: 'smaxn_1', + SMAXN2_1: 'smaxn2_1', + SMAXN3_1: 'smaxn3_1', + HHPHC: 'hhphc', + IMAX: 'imax', + ADPS: 'adps', + IMAX2: 'imax2', + IMAX3: 'imax3', + ADIR1: 'adir1', + ADIR2: 'adir2', + ADIR3: 'adir3', + }, SPEED_SENSOR: { DECIMAL: 'decimal', INTEGER: 'integer',