Données de consommation compteur Linky

C’est pas la que ça bloque ! Regarde plus loin dans le code ?

Dans ce test en particulier y’a rien plus, j’en ai mis un peu partout, plus de blocage :confused:

2022-06-27T18:59:53+0200 <log> handleMqttMessage.js:22 (Zigbee2mqttManager.handleMqttMessage) Getting config devices from Zigbee2mqtt
JSONParse: 0.158ms
Devices map: 0.034ms
Event: 1.05ms
handleMqttMessage: 2.165ms
    1) it should receive devices
2022-06-27T18:59:53+0200 <log> handleMqttMessage.js:49 (Zigbee2mqttManager.handleMqttMessage) Getting config from Zigbee2mqtt : permit_joint = true
BridgeConfig: 0.446ms
handleMqttMessage: 0.606ms
    ✓ it should get permit join from config
2022-06-27T18:59:54+0200 <log> handleMqttMessage.js:63 (Zigbee2mqttManager.handleMqttMessage) Getting permit_joint : true
ResponsePermitJoin: 0.444ms
handleMqttMessage: 0.607ms
    ✓ it should get permit join from response/permit_join
2022-06-27T18:59:54+0200 <log> handleMqttMessage.js:77 (Zigbee2mqttManager.handleMqttMessage) Getting permit_joint : true
PermitJoin: 0.995ms
handleMqttMessage: 1.395ms
    ✓ it should get permit join from config/permit_join
2022-06-27T18:59:55+0200 <warn> handleMqttMessage.js:90 (Zigbee2mqttManager.handleMqttMessage) Zigbee2mqtt topic zigbee2mqtt/anytopic empty message.
Convert: 0.399ms
handleMqttMessage: 0.656ms
    ✓ it should get empty message
2022-06-27T18:59:55+0200 <debug> findMatchingExpose.js:32 (Zigbee2mqttManager.findMatchingExpose) Device "device" not found
2022-06-27T18:59:55+0200 <error> handleMqttMessage.js:108 () Failed to convert value for device device: Error: Zigbee2mqqt expose not found on device "device" with property "battery".
    at Zigbee2mqttManager.readValue 
Convert: 1.259ms
handleMqttMessage: 1.439ms
    ✓ it should log error when bad message but not crash service
2022-06-27T18:59:56+0200 <log> handleMqttMessage.js:118 (Zigbee2mqttManager.handleMqttMessage) Zigbee2mqtt topic zigbee2mqtt/anytopic/wrongtopic not handled.
Convert: 0.397ms
handleMqttMessage: 0.568ms
    ✓ it should get bad topic
2022-06-27T18:59:56+0200 <warn> handleMqttMessage.js:111 () Zigbee2mqtt device 0x00158d00033e88d5, feature humidity not configured in Gladys.
Convert: 0.532ms
handleMqttMessage: 0.79ms
    ✓ it should get good topic
2022-06-27T18:59:57+0200 <warn> handleMqttMessage.js:115 (Zigbee2mqttManager.handleMqttMessage) Zigbee2mqtt device device not configured in Gladys.
Convert: 0.374ms
handleMqttMessage: 0.628ms
    ✓ it should get good topic but device not managed
2022-06-27T18:59:57+0200 <warn> handleMqttMessage.js:111 () Zigbee2mqtt device device, feature humidity not configured in Gladys.
Convert: 0.393ms
handleMqttMessage: 0.643ms
    ✓ it should get good topic but feature not managed
2022-06-27T18:59:58+0200 <warn> handleMqttMessage.js:115 (Zigbee2mqttManager.handleMqttMessage) Zigbee2mqtt device 0x00158d0005d29aa0 not configured in Gladys.
Convert: 0.464ms
handleMqttMessage: 0.723ms
    ✓ SPAM TEST

Je vais le faire sur ma prod sans whitelist

1 « J'aime »

Un petit log sympa

Le handle ressemble à ça avec les console.time

const logger = require('../../../utils/logger');
const { EVENTS, WEBSOCKET_MESSAGE_TYPES } = require('../../../utils/constants');
const { convertFeature } = require('../utils/convertFeature');

/**
 * @description Handle a new message receive in MQTT.
 * @param {string} topic - MQTT topic.
 * @param {Object} message - The message sent.
 * @returns {Object} Null.
 * @example
 * handleMqttMessage('stat/zigbee2mqtt/POWER', 'ON');
 */
function handleMqttMessage(topic, message) {
  console.time('handleMqttMessage');
  this.zigbee2mqttConnected = true;
  this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
    type: WEBSOCKET_MESSAGE_TYPES.ZIGBEE2MQTT.STATUS_CHANGE,
  });

  switch (topic) {
    case 'zigbee2mqtt/bridge/devices': {
      logger.log('Getting config devices from Zigbee2mqtt');
      console.time('Devices parse');
      const devices = JSON.parse(message);
      console.timeEnd('Devices parse');
      this.discoveredDevices = {};
      console.time('Devices map friendly_name');
      devices
        // Remove Coordinator
        .filter((d) => d.supported)
        .forEach((device) => {
          this.discoveredDevices[device.friendly_name] = device;
        });
        console.timeEnd('Devices map friendly_name');
        console.time('Event');
      this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
        type: WEBSOCKET_MESSAGE_TYPES.ZIGBEE2MQTT.DISCOVER,
        payload: this.getDiscoveredDevices(),
      });
      console.timeEnd('Event');
      break;
    }
    case 'zigbee2mqtt/bridge/config': {
      // Keep only "permit_join" value
      console.time('BridgeConfig')
      const config = JSON.parse(message);
      this.z2mPermitJoin = config.permit_join;

      logger.log('Getting config from Zigbee2mqtt : permit_joint =', this.z2mPermitJoin);

      this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
        type: WEBSOCKET_MESSAGE_TYPES.ZIGBEE2MQTT.PERMIT_JOIN,
        payload: this.z2mPermitJoin,
      });
      console.timeEnd('BridgeConfig');
      break;
    }
    case 'zigbee2mqtt/bridge/response/permit_join': {
      console.time('ResponsePermitJoin');
      const config = JSON.parse(message);
      this.z2mPermitJoin = config.data.value;

      logger.log('Getting permit_joint :', this.z2mPermitJoin);

      this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
        type: WEBSOCKET_MESSAGE_TYPES.ZIGBEE2MQTT.PERMIT_JOIN,
        payload: this.z2mPermitJoin,
      });
      console.timeEnd('ResponsePermitJoin');
      break;
    }
    case 'zigbee2mqtt/bridge/config/permit_join': {
      console.time('PermitJoin');
      const config = JSON.parse(message);
      this.z2mPermitJoin = config;

      logger.log('Getting permit_joint :', this.z2mPermitJoin);

      this.gladys.event.emit(EVENTS.WEBSOCKET.SEND_ALL, {
        type: WEBSOCKET_MESSAGE_TYPES.ZIGBEE2MQTT.PERMIT_JOIN,
        payload: this.z2mPermitJoin,
      });
      console.timeEnd('PermitJoin');
      break;
    }
    default: {
      console.time('Convert');
      const splittedTopic = topic.split('/');
      if (!message) {
        logger.warn(`Zigbee2mqtt topic ${topic} empty message.`);
      } else if (splittedTopic.length === 2) {
        const deviceName = splittedTopic[1];
        console.time('Incoming Features');
        const incomingFeatures = JSON.parse(message);
        console.timeEnd('Incoming Features');
        // Fetch device from name
        console.time('Fetch device from name');
        const device = this.gladys.stateManager.get('deviceByExternalId', `zigbee2mqtt:${deviceName}`);
        console.timeEnd('Fetch device from name');
        if (device) {
          Object.keys(incomingFeatures).forEach((zigbeeFeatureField) => {
            // Find the feature regarding the field name
            const feature = convertFeature(device.features, zigbeeFeatureField);
            if (feature) {
              try {
                console.time('New state ' + feature.external_id);
                const newState = {
                  device_feature_external_id: `${feature.external_id}`,
                  state: this.readValue(deviceName, zigbeeFeatureField, incomingFeatures[zigbeeFeatureField]),
                };
                this.gladys.event.emit(EVENTS.DEVICE.NEW_STATE, newState);
                console.timeEnd('New state ' + feature.external_id);
              } catch (e) {
                logger.error(`Failed to convert value for device ${deviceName}:`, e);
              }
            } else {
              logger.warn(`Zigbee2mqtt device ${deviceName}, feature ${zigbeeFeatureField} not configured in Gladys.`);
            }
          });
        } else {
          logger.warn(`Zigbee2mqtt device ${deviceName} not configured in Gladys.`);
        }
      } else {
        logger.log(`Zigbee2mqtt topic ${topic} not handled.`);
      }
      console.timeEnd('Convert');
    }
  }
  console.timeEnd('handleMqttMessage');
  return null;
}

module.exports = {
  handleMqttMessage,
};

Côté zigbee j’ai juste remis à zero ce paramètre

Gladys est lente !

L’impact sur les performance

Mon serveur peut encaisser bien plus mais l’interface est lente

@pierre-gilles tu me dira si t’as un pic similaire sur G-plus

Super intéressant @VonOx !! :slight_smile:

On a notre réponse, pour le Lixee TIC:

Convert: 67.706ms
handleMqttMessage: 69.399ms

L’étape de lecture de l’objet Z2M prend 67ms à s’exécuter, et c’est une tâche synchrone bloquante, ce qui bloque Gladys entièrement pendant ce même temps. ça fait beaucoup quand même 70ms de temps bloquant

Je serais intéressé que tu m’envoie la string « message » dans ce cas là chez toi en prod.

Celui à cette ligne là :

 const incomingFeatures = JSON.parse(message);

Ouai et je ne suis pas sur un pi :sweat_smile:

{
  "active_enerfy_out_d01": 8252,
  "active_enerfy_out_d02": 10819,
  "active_enerfy_out_d03": 4081,
  "active_enerfy_out_d04": 5549,
  "active_power": 248,
  "active_power_max": 3790,
  "active_power_ph_b": 322,
  "apparent_power": 243,
  "available_power": 6,
  "average_rms_voltage_meas_period": 231,
  "current_date": "E220524164514",
  "current_index_tarif": 2,
  "current_price": "HEURE PLEINE",
  "current_summ_delivered": 28998,
  "current_tarif": "H PLEINE/CREUSE",
  "current_tier10_summ_delivered": 0,
  "current_tier1_summ_delivered": 12334,
  "current_tier2_summ_delivered": 16665,
  "current_tier3_summ_delivered": 0,
  "current_tier4_summ_delivered": 0,
  "current_tier5_summ_delivered": 0,
  "current_tier6_summ_delivered": 0,
  "current_tier7_summ_delivered": 0,
  "current_tier8_summ_delivered": 0,
  "current_tier9_summ_delivered": 0,
  "device": {
    "applicationVersion": 4,
    "dateCode": "20220217",
    "friendlyName": "Lixee TIC",
    "hardwareVersion": 1,
    "ieeeAddr": "0x00158d0005d29aa0",
    "manufacturerID": 4151,
    "manufacturerName": "LiXee",
    "model": "ZLinky_TIC",
    "networkAddress": 32871,
    "powerSource": "Mains (single phase)",
    "softwareBuildID": "4000-0005",
    "stackVersion": 2,
    "type": "Router",
    "zclVersion": 3
  },
  "drawn_v_a_max_n1": 2940,
  "last_seen": "2022-06-28T12:55:07+00:00",
  "linkquality": 84,
  "message1": "PAS DE MESSAGE",
  "message2": "",
  "meter_serial_number": "XXXXXXXXXX",
  "power_threshold": 6,
  "relais": 1,
  "rms_current": 1,
  "rms_voltage": 233,
  "site_id": "XXXXXXXXXXXXXX",
  "software_revision": 2,
  "status_register": "003A4401",
  "update": {
    "state": "idle"
  },
  "update_available": false
}

ça correspond à l’état côté Z2M

Merci !

Est-ce que tu pourrais rajouter 2 console.time supplémentaire pour mieux comprendre exactement le point lent ?

console.time("readValue");
const newState = {
  device_feature_external_id: `${feature.external_id}`,
  state: this.readValue(
    deviceName,
    zigbeeFeatureField,
    incomingFeatures[zigbeeFeatureField]
  ),
};
console.timeEnd("readValue");
console.time('gladysEventEmit')
this.gladys.event.emit(EVENTS.DEVICE.NEW_STATE, newState);
console.timeEnd("gladysEventEmit");

C’est pas là que ça bloque c’est avant.

2022-06-28T18:33:57+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature update_available not configured in Gladys.
Convert: 69.102ms
handleMqttMessage: 71.778ms
Blocked for 72.24794189453125ms, operation started here: [
  '    at Socket.connect (net.js:970:7)',
  '    at Object.connect (net.js:201:17)',
  '    at Object.streamBuilder (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/connect/tcp.js:18:14)',
  '    at MqttClient.wrapper [as streamBuilder] (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/connect/index.js:154:36)',
  '    at MqttClient._setupStream (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:298:22)',
  '    at new MqttClient (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:277:8)',
  '    at Object.connect (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/connect/index.js:156:16)',
  '    at Zigbee2mqttManager.connect (/src/server/services/zigbee2mqtt/lib/connect.js:16:40)',
  '    at Zigbee2mqttManager.init (/src/server/services/zigbee2mqtt/lib/init.js:88:18)',
  '    at async Object.start (/src/server/services/zigbee2mqtt/index.js:17:5)',
  '    at async Service.start (/src/server/lib/service/service.start.js:33:7)'
]
2022-06-28T18:34:00+0200 <info> scene.checkCalendarTriggers.js:24 (SceneManager.checkCalendarTriggers) Checking calendar triggers at Tue, 28 Jun 2022 16:34:00 GMT
Convert: 0.03ms
handleMqttMessage: 4.972ms
Incoming Features: 0.045ms
Fetch device from name: 0.02ms
readValue: 0.038ms
gladysEventEmit: 5.459ms

J’ai ajouté un peu de contexte pour le readvalue

2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature update_available not configured in Gladys.
Convert: 49.732ms
handleMqttMessage: 50.613ms
Blocked for 50.7988359375ms, operation started here: [
  '    at nextTick (internal/process/task_queues.js:133:5)',
  '    at nextTickWork (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:307:7)',
  '    at MqttClient.handleMessage (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:1297:3)',
  '    at MqttClient._handlePublish (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:1278:12)',
  '    at MqttClient._handlePacket (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:410:12)',
  '    at work (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:321:12)',
  '    at processTicksAndRejections (internal/process/task_queues.js:77:11)'
]
Convert: 0.009ms
handleMqttMessage: 1.227ms
Incoming Features: 0.036ms
Fetch device from name Lixee TIC: 0.01ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:index:active_enerfy_out_d01: 0.016ms
gladysEventEmit: 3.695ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:index:active_enerfy_out_d02: 0.017ms
gladysEventEmit: 2.432ms
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature active_enerfy_out_d03 not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature active_enerfy_out_d04 not configured in Gladys.
readValue zigbee2mqtt:Lixee TIC:energy-sensor:power:active_power: 0.018ms
gladysEventEmit: 2.318ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:power:active_power_max: 0.018ms
gladysEventEmit: 2.306ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:power:active_power_ph_b: 0.018ms
gladysEventEmit: 2.284ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:power:apparent_power: 0.018ms
gladysEventEmit: 2.285ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:current:available_power: 0.017ms
gladysEventEmit: 2.27ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:voltage:average_rms_voltage_meas_period: 0.018ms
gladysEventEmit: 2.243ms
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_date not configured in Gladys.
readValue zigbee2mqtt:Lixee TIC:energy-sensor:index:current_index_tarif: 0.015ms
gladysEventEmit: 2.292ms
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_price not configured in Gladys.
readValue zigbee2mqtt:Lixee TIC:energy-sensor:index:current_summ_delivered: 0.017ms
gladysEventEmit: 2.513ms
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tarif not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier10_summ_delivered not configured in Gladys.
readValue zigbee2mqtt:Lixee TIC:energy-sensor:index:current_tier1_summ_delivered: 0.016ms
gladysEventEmit: 2.308ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:index:current_tier2_summ_delivered: 0.016ms
gladysEventEmit: 2.253ms
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier3_summ_delivered not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier4_summ_delivered not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier5_summ_delivered not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier6_summ_delivered not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier7_summ_delivered not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier8_summ_delivered not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature current_tier9_summ_delivered not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature device not configured in Gladys.
readValue zigbee2mqtt:Lixee TIC:energy-sensor:power:drawn_v_a_max_n1: 0.019ms
gladysEventEmit: 2.329ms
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature last_seen not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature linkquality not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature message1 not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature message2 not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature meter_serial_number not configured in Gladys.
readValue zigbee2mqtt:Lixee TIC:energy-sensor:current:power_threshold: 0.018ms
gladysEventEmit: 2.427ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:binary:relais: 0.023ms
gladysEventEmit: 2.395ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:current:rms_current: 0.016ms
gladysEventEmit: 2.383ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:voltage:rms_voltage: 0.021ms
gladysEventEmit: 2.368ms
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature site_id not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature software_revision not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature status_register not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature update not configured in Gladys.
2022-06-28T18:42:35+0200 <warn> handleMqttMessage.js:123 () Zigbee2mqtt device Lixee TIC, feature update_available not configured in Gladys.
Convert: 54.657ms
handleMqttMessage: 55.593ms
Blocked for 55.67570068359375ms, operation started here: [
  '    at nextTick (internal/process/task_queues.js:133:5)',
  '    at nextTickWork (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:307:7)',
  '    at MqttClient.handleMessage (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:1297:3)',
  '    at MqttClient._handlePublish (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:1278:12)',
  '    at MqttClient._handlePacket (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:410:12)',
  '    at work (/src/server/services/zigbee2mqtt/node_modules/mqtt/lib/client.js:321:12)',
  '    at processTicksAndRejections (internal/process/task_queues.js:77:11)'
]

Si justement, tu as 17 states envoyés par le Lixee TIC, et chaque emit consume 3-5ms = environ 70ms

J’ai extrait la donnée d’exécution (read+emit) de chaque feature, le read étant négligeable, c’est quasiment que de l’emit !

1 « J'aime »

Par curiosité, tu as beaucoup de scènes ou pas ?

Non , certaines sont inactives

Ok, après active ou non, chaque scène sera « parcourue » pour vérifier si elle est active ou pas, donc ça impacte quand même

Je serais curieux de faire un petit test chez toi, afin de laisser à Gladys le temps de « respirer » entre chaque event, remplace la ligne:

this.gladys.event.emit(EVENTS.DEVICE.NEW_STATE, newState);

Par:

setImmediate(() => this.gladys.event.emit(EVENTS.DEVICE.NEW_STATE, newState));

C’est juste un test (c’est pas ce qu’on fera en prod), mais l’idée c’est qu’au lieu de gérer un gros bloc synchrone en une fois, on ajoute l’émission de l’event à la fin de l’event loop pour être traitée « plus tard », et laisser le temps à Gladys de traiter d’autres demandes potentiellement prioritaire (comme une requête du front)

Radical

readValue zigbee2mqtt:Lixee TIC:energy-sensor:current:power_threshold: 0.016ms
gladysEventEmit: 0.143ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:binary:relais: 0.017ms
gladysEventEmit: 0.142ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:current:rms_current: 0.014ms
gladysEventEmit: 0.141ms
readValue zigbee2mqtt:Lixee TIC:energy-sensor:voltage:rms_voltage: 0.017ms
gladysEventEmit: 0.139ms

Ca c’était sur, mais est-ce que ça améliore l’expérience sur Gladys ou est-ce que c’est toujours ultra lent ? :slight_smile:

Oui clairement, je ne ressens pas de lenteurs ou en tout cas c’est beaucoup mieux

Ok cool ! Maintenant 2 pistes pour fixer ça sur Gladys, faut faire des tests et voir:

  • Soit on rajoute ce genre de callback (setImmediate) carrément dans le code du listener de l’event (côté core), si ça marche ça serait le mieux parce que du coup ça améliorerait les performances pour toutes les intégrations
  • Soit si ça suffit pas (si par exemple c’est le fait d’exécuter de .emit en lui même qui est lent), alors là il faudra faire le changement dans le code de l’intégration Z2M, un peu comme la ligne que je t’ai mise ici

Le 3ème point, c’est que le check des triggers de scènes peut aussi être optimisé à mon avis, j’avais créé une issue dans le passé mais comme personne n’était gêné j’avais pas dédié de temps à ça, après là maintenant ça peut valoir le coup d’investir un peu de temps dessus :slight_smile:

Ouai je vois l’idée vu qu’il y a plein d’évent en même temps ça fait autant de check de scène.

Dis moi moi si tu veux que je test dans le core vu que mon instance de prod est hybride :sweat_smile:

2 « J'aime »

@VonOx Je veux bien que tu test ce changement:

Hello !
Je m’interroge sur cette integration, juste pour ma curiosité, quel genre de scene cette intégration permettra ?
Y aura til des graph un peu plus spécifiques a ces données ? Ou cest juste des données envoyées en mode hey maintenant je vais me monter un grafana a côté et je prend les données dans gladys.

Je m’interroge plus précisément pour ma futur utilisation ^^