Données de consommation compteur Linky

Je vais essayer de me débrouiller.

Non pas de test sur la PR le type numeric est déjà couvert.

Bon je vois pas comment faire ( j’ai regarder comment c’était fait ) mais je ne sais pas comment spammer le service.

De plus d’après la sortie de la lib ( et si je comprends bien ) , c’est la lib mqtt qui bloque non ?

Blocked for 36.14090771484375ms, 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)'
]

D’ailleurs je ne comprends pas bien le lifecycle ici , pourquoi y’a t il un connect à chaque publish d’un device.

Pour spammer le service, tu appelles depuis un test cette fonction avec l’objet Z2M de ton Lixee TIC:

Le test associé:

Dans les tests, le device Z2M qui est envoyé ressemble à ça:

Essaie de chopper le même message Z2M pour le Lixee TIC, créé un nouveau fichier JSON et créé un nouveau test qui envoie ce JSON.

Ensuite c’est de la mesure ligne par ligne pour comprendre ce qui se passe / ce qui est trop lourd à faire.

J’ai juste ajouter mon device dans les json et ajouter ce test ( pire que mieux )

  it('BIG PAYLOAD', async () => {
    // PREPARE
    stateManagerGetStub = sinon.stub();
    stateManagerGetStub.onFirstCall().returns(null);
    zigbee2mqttManager.gladys.stateManager.get = stateManagerGetStub;
    // EXECUTE
    await zigbee2mqttManager.handleMqttMessage('zigbee2mqtt/0x00158d0005d29aa0', `{"active_enerfy_out_d01":8015,"active_enerfy_out_d02":10819,"active_enerfy_out_d03":4081,"active_enerfy_out_d04":5549,"active_power":1126,"active_power_max":2360,"active_power_ph_b":464,"apparent_power":415,"available_power":6,"average_rms_voltage_meas_period":233,"current_date":"E220524164514","current_index_tarif":2,"current_price":"HEURE PLEINE","current_summ_delivered":28947,"current_tarif":"H PLEINE/CREUSE","current_tier10_summ_delivered":0,"current_tier1_summ_delivered":12307,"current_tier2_summ_delivered":16640,"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-24T15:33:28+00:00","linkquality":78,"message1":"PAS DE MESSAGE","message2":"","meter_serial_number":"811775803140","power_threshold":6,"relais":1,"rms_current":2,"rms_voltage":231,"site_id":"XXXXXX","software_revision":2,"status_register":"003A4401","update":{"state":"idle"},"update_available":false}`);
    // ASSERT
    assert.calledOnce(gladys.event.emit);
  });

ça fout en l’air tous les tests. ( discover et handlemqtt )

Bref c’est pas mon domaine. ( très frustrant j’y comprend rien )

1 Like

C’est dans ton code ça ou c’est une erreur de copier coller sur le forum ?

Dans le code, je vais remplacer par un single quote

Ah mais attend en fait censé être un string j’imagine, donc ça peut-être normal.

Tu as quoi comme erreur sinon?

Ouai je viens de check les autres tests sont comme ça

Le fail complet, j’ai l’impression que les features se « décalle » ( GIST car ça passe pas sur le fofo )

Problème de taille de tableau a priori

Du coup ce qui est normal, quel est le problème ?

Si tu modifie l’input des tests, c’est normal que l’output soit différent.

Après en soit là on s’en fout que les tests passent ou non sur le CI, l’idée c’était juste d’avoir ce test localement pour pouvoir tester comment réagissait l’intégration Z2M en recevant ce gros payload, et comprendre quel bout de code créé ces blocages de l’event loop.

Après je reconnais que c’est une démarche il faut s’y connaitre un peu :sweat_smile:

Si j’ignore les autres tests pas de blocage sur le gros payload

Là où ça bloque, je ne sais pas si ça aide ( pas de stack )

Rien d’autre

Pas de surprise, c’est le JSON.parse qui bloque, c’est un classique, JSON.parse est une opération synchrone bloquante en Javascript, sur les gros payload ça prend du temps.

Par curiosité, il ressemble à quoi ce JSON ?

Le Lixee en +

[
  {
    "external_id": "zigbee2mqtt:0x00158d00033e88d5",
    "features": [
      {
        "category": "battery",
        "external_id": "zigbee2mqtt:0x00158d00033e88d5:battery:integer:battery",
        "has_feedback": false,
        "max": 100,
        "min": 0,
        "name": "Battery",
        "read_only": true,
        "selector": "zigbee2mqtt-0x00158d00033e88d5-battery-integer-battery",
        "type": "integer",
        "unit": "percent"
      },
      {
        "category": "button",
        "external_id": "zigbee2mqtt:0x00158d00033e88d5:button:click:action",
        "has_feedback": false,
        "max": 7,
        "min": 0,
        "name": "Action",
        "read_only": true,
        "selector": "zigbee2mqtt-0x00158d00033e88d5-button-click-action",
        "type": "click",
        "unit": null
      },
      {
        "category": "switch",
        "external_id": "zigbee2mqtt:0x00158d00033e88d5:switch:voltage:voltage",
        "has_feedback": false,
        "max": 10000,
        "min": 0,
        "name": "Voltage",
        "read_only": true,
        "selector": "zigbee2mqtt-0x00158d00033e88d5-switch-voltage-voltage",
        "type": "voltage",
        "unit": "millivolt"
      }
    ],
    "model": "WXKG01LM",
    "name": "0x00158d00033e88d5",
    "service_id": "f87b7af2-ca8e-44fc-b754-444354b42fee",
    "should_poll": false
  },
  {
    "name": "0x00158d0004019127",
    "model": "WXKG11LM",
    "external_id": "zigbee2mqtt:0x00158d0004019127",
    "features": [
      {
        "name": "Battery",
        "read_only": true,
        "has_feedback": false,
        "min": 0,
        "max": 100,
        "category": "battery",
        "type": "integer",
        "unit": "percent",
        "external_id": "zigbee2mqtt:0x00158d0004019127:battery:integer:battery",
        "selector": "zigbee2mqtt-0x00158d0004019127-battery-integer-battery"
      },
      {
        "name": "Voltage",
        "read_only": true,
        "has_feedback": false,
        "min": 0,
        "max": 10000,
        "category": "switch",
        "type": "voltage",
        "unit": "millivolt",
        "external_id": "zigbee2mqtt:0x00158d0004019127:switch:voltage:voltage",
        "selector": "zigbee2mqtt-0x00158d0004019127-switch-voltage-voltage"
      }
    ],
    "should_poll": false,
    "service_id": "f87b7af2-ca8e-44fc-b754-444354b42fee"
  },
  {
    "name": "0x00158d00045b2740",
    "model": "WSDCGQ11LM",
    "external_id": "zigbee2mqtt:0x00158d00045b2740",
    "features": [
      {
        "name": "Battery",
        "read_only": true,
        "has_feedback": false,
        "min": 0,
        "max": 100,
        "category": "battery",
        "type": "integer",
        "unit": "percent",
        "external_id": "zigbee2mqtt:0x00158d00045b2740:battery:integer:battery",
        "selector": "zigbee2mqtt-0x00158d00045b2740-battery-integer-battery"
      },
      {
        "name": "Temperature",
        "read_only": true,
        "has_feedback": false,
        "min": -100,
        "max": 150,
        "category": "temperature-sensor",
        "type": "decimal",
        "unit": "celsius",
        "external_id": "zigbee2mqtt:0x00158d00045b2740:temperature-sensor:decimal:temperature",
        "selector": "zigbee2mqtt-0x00158d00045b2740-temperature-sensor-decimal-temperature"
      },
      {
        "name": "Humidity",
        "read_only": true,
        "has_feedback": false,
        "min": 0,
        "max": 100,
        "category": "humidity-sensor",
        "type": "decimal",
        "unit": "percent",
        "external_id": "zigbee2mqtt:0x00158d00045b2740:humidity-sensor:decimal:humidity",
        "selector": "zigbee2mqtt-0x00158d00045b2740-humidity-sensor-decimal-humidity"
      },
      {
        "name": "Alarm",
        "read_only": false,
        "has_feedback": true,
        "min": 0,
        "max": 1,
        "category": "siren",
        "type": "binary",
        "unit": null,
        "external_id": "zigbee2mqtt:0x00158d00045b2740:siren:binary:alarm",
        "selector": "zigbee2mqtt-0x00158d00045b2740-siren-binary-alarm"
      },
      {
        "name": "Pressure",
        "read_only": true,
        "has_feedback": false,
        "min": 0,
        "max": 10000,
        "category": "pressure-sensor",
        "type": "decimal",
        "unit": "hPa",
        "external_id": "zigbee2mqtt:0x00158d00045b2740:pressure-sensor:decimal:pressure",
        "selector": "zigbee2mqtt-0x00158d00045b2740-pressure-sensor-decimal-pressure"
      },
      {
        "name": "Voltage",
        "read_only": true,
        "has_feedback": false,
        "min": 0,
        "max": 10000,
        "category": "switch",
        "type": "voltage",
        "unit": "millivolt",
        "external_id": "zigbee2mqtt:0x00158d00045b2740:switch:voltage:voltage",
        "selector": "zigbee2mqtt-0x00158d00045b2740-switch-voltage-voltage"
      }
    ],
    "should_poll": false,
    "service_id": "f87b7af2-ca8e-44fc-b754-444354b42fee"
  },
  {
    "service_id": "f87b7af2-ca8e-44fc-b754-444354b42fee",
    "name": "0x00158d0005d29aa0",
    "model": "ZLinky_TIC",
    "external_id": "zigbee2mqtt:0x00158d0005d29aa0",
    "should_poll": false,
    "features": [
      {
        "name": "Numéro tarif",
        "selector": "zigbee2mqtt-0x00158d0005d29aa0-energy-sensor-index-current-index-tarif",
        "external_id": "zigbee2mqtt:0x00158d0005d29aa0:energy-sensor:index:current_index_tarif",
        "category": "energy-sensor",
        "type": "index",
        "read_only": true,
        "has_feedback": false,
        "unit": "kilowatt-hour",
        "min": 0,
        "max": 10000
      },
      {
        "name": "Puissance apprente",
        "selector": "zigbee2mqtt-0x00158d0005d29aa0-energy-sensor-power-apparent-power",
        "external_id": "zigbee2mqtt:0x00158d0005d29aa0:energy-sensor:power:apparent_power",
        "category": "energy-sensor",
        "type": "power",
        "read_only": true,
        "has_feedback": false,
        "unit": "volt-ampere",
        "min": 0,
        "max": 10000
      },
      {
        "name": "Index Total",
        "selector": "zigbee2mqtt-0x00158d0005d29aa0-energy-sensor-index-current-summ-delivered",
        "external_id": "zigbee2mqtt:0x00158d0005d29aa0:energy-sensor:index:current_summ_delivered",
        "category": "energy-sensor",
        "type": "index",
        "read_only": true,
        "has_feedback": false,
        "unit": "kilowatt-hour",
        "min": 0,
        "max": 1000000
      },
      {
        "name": "Heures creuses",
        "selector": "zigbee2mqtt-0x00158d0005d29aa0-energy-sensor-index-current-tier1-summ-delivered",
        "external_id": "zigbee2mqtt:0x00158d0005d29aa0:energy-sensor:index:current_tier1_summ_delivered",
        "category": "energy-sensor",
        "type": "index",
        "read_only": true,
        "has_feedback": false,
        "unit": "kilowatt-hour",
        "min": 0,
        "max": 1000000
      },
      {
        "name": "Heures pleines",
        "selector": "zigbee2mqtt-0x00158d0005d29aa0-energy-sensor-index-current-tier2-summ-delivered",
        "external_id": "zigbee2mqtt:0x00158d0005d29aa0:energy-sensor:index:current_tier2_summ_delivered",
        "category": "energy-sensor",
        "type": "index",
        "read_only": true,
        "has_feedback": false,
        "unit": "kilowatt-hour",
        "min": 0,
        "max": 1000000
      }
    ]
  }
]

Ou celui ci je ne sais pas trop lequel est utilisé

[
  {
    "definition": null,
    "endpoints": {
      "1": {
        "bindings": [],
        "clusters": {
          "input": ["genBasic", "genTime", "genOta"],
          "output": ["genPowerCfg", "genPollCtrl", "ssIasZone"]
        },
        "configured_reportings": []
      },
      "242": {
        "bindings": [],
        "clusters": {
          "input": [],
          "output": ["greenPower"]
        },
        "configured_reportings": []
      }
    },
    "friendly_name": "Coordinator",
    "ieee_address": "0x00212effff06ddd8",
    "interview_completed": true,
    "interviewing": false,
    "network_address": 0,
    "supported": false,
    "type": "Coordinator"
  },
  {
    "definition": {
      "description": "MiJia wireless switch",
      "exposes": [
        {
          "access": 1,
          "description": "Remaining battery in %",
          "name": "battery",
          "property": "battery",
          "type": "numeric",
          "unit": "%",
          "value_max": 100,
          "value_min": 0
        },
        {
          "access": 1,
          "description": "Triggered action (e.g. a button click)",
          "name": "action",
          "property": "action",
          "type": "enum",
          "values": ["single", "double", "triple", "quadruple", "hold", "release", "many"]
        },
        {
          "access": 1,
          "description": "Voltage of the battery in millivolts",
          "name": "voltage",
          "property": "voltage",
          "type": "numeric",
          "unit": "mV"
        },
        {
          "access": 1,
          "description": "Link quality (signal strength)",
          "name": "linkquality",
          "property": "linkquality",
          "type": "numeric",
          "unit": "lqi",
          "value_max": 255,
          "value_min": 0
        }
      ],
      "model": "WXKG01LM",
      "supports_ota": false,
      "vendor": "Xiaomi"
    },
    "endpoints": {
      "1": {
        "bindings": [],
        "clusters": {
          "input": [],
          "output": []
        },
        "configured_reportings": []
      }
    },
    "friendly_name": "0x00158d00033e88d5",
    "ieee_address": "0x00158d00033e88d5",
    "interview_completed": true,
    "interviewing": false,
    "manufacturer": "LUMI",
    "model_id": "lumi.sensor_switch",
    "network_address": 44173,
    "power_source": "Battery",
    "supported": true,
    "type": "EndDevice"
  },
  {
    "date_code": "20180525",
    "definition": {
      "description": "Aqara wireless switch",
      "exposes": [
        {
          "access": 1,
          "description": "Remaining battery in %",
          "name": "battery",
          "property": "battery",
          "type": "numeric",
          "unit": "%",
          "value_max": 100,
          "value_min": 0
        },
        {
          "access": 1,
          "description": "Voltage of the battery in millivolts",
          "name": "voltage",
          "property": "voltage",
          "type": "numeric",
          "unit": "mV"
        },
        {
          "access": 1,
          "description": "Link quality (signal strength)",
          "name": "linkquality",
          "property": "linkquality",
          "type": "numeric",
          "unit": "lqi",
          "value_max": 255,
          "value_min": 0
        }
      ],
      "model": "WXKG11LM",
      "supports_ota": false,
      "vendor": "Xiaomi"
    },
    "endpoints": {
      "1": {
        "bindings": [],
        "clusters": {
          "input": ["genBasic", "genMultistateInput", "genIdentify"],
          "output": ["genBasic"]
        },
        "configured_reportings": []
      }
    },
    "friendly_name": "0x00158d0004019127",
    "ieee_address": "0x00158d0004019127",
    "interview_completed": true,
    "interviewing": false,
    "manufacturer": "LUMI",
    "model_id": "lumi.remote.b1acn01",
    "network_address": 47250,
    "power_source": "Battery",
    "software_build_id": "3000-0001",
    "supported": true,
    "type": "EndDevice"
  },
  {
    "date_code": "20220217",
    "definition": {
      "description": "Lixee ZLinky",
      "exposes": [
        {
          "access": 1,
          "description": "Serial Number",
          "name": "ADSC",
          "property": "meter_serial_number",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Supplier pricing schedule name",
          "name": "NGTF",
          "property": "current_tarif",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Current supplier price label",
          "name": "LTARF",
          "property": "current_price",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Current tariff index number",
          "name": "NTARF",
          "property": "current_index_tarif",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Customer tele-information protocol version",
          "name": "VTIC",
          "property": "software_revision",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Current date and time",
          "name": "DATE",
          "property": "current_date",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Total active power delivered",
          "name": "EAST",
          "property": "current_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 01)",
          "name": "EASF01",
          "property": "current_tier1_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 02)",
          "name": "EASF02",
          "property": "current_tier2_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 03)",
          "name": "EASF03",
          "property": "current_tier3_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 04)",
          "name": "EASF04",
          "property": "current_tier4_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 05)",
          "name": "EASF05",
          "property": "current_tier5_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 06)",
          "name": "EASF06",
          "property": "current_tier6_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 07)",
          "name": "EASF07",
          "property": "current_tier7_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 08)",
          "name": "EASF08",
          "property": "current_tier8_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 09)",
          "name": "EASF09",
          "property": "current_tier9_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 10)",
          "name": "EASF10",
          "property": "current_tier10_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 01)",
          "name": "EASD01",
          "property": "active_enerfy_out_d01",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 02)",
          "name": "EASD02",
          "property": "active_enerfy_out_d02",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 03)",
          "name": "EASD03",
          "property": "active_enerfy_out_d03",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 04)",
          "name": "EASD04",
          "property": "active_enerfy_out_d04",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "RMS current",
          "name": "IRMS1",
          "property": "rms_current",
          "type": "numeric",
          "unit": "A"
        },
        {
          "access": 1,
          "description": "RMS voltage",
          "name": "URMS1",
          "property": "rms_voltage",
          "type": "numeric",
          "unit": "V"
        },
        {
          "access": 1,
          "description": "Apparent power of reference",
          "name": "PREF",
          "property": "available_power",
          "type": "numeric",
          "unit": "kVA"
        },
        {
          "access": 1,
          "description": "Register of Statutes",
          "name": "STGE",
          "property": "status_register",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Apparent power threshold",
          "name": "PCOUP",
          "property": "power_threshold",
          "type": "numeric",
          "unit": "kVA"
        },
        {
          "access": 1,
          "description": "Current point of the active load curve drawn",
          "name": "CCASN",
          "property": "active_power",
          "type": "numeric",
          "unit": "W"
        },
        {
          "access": 1,
          "description": "Previous point of the active load curve drawn",
          "name": "CCASN-1",
          "property": "active_power_ph_b",
          "type": "numeric",
          "unit": "W"
        },
        {
          "access": 1,
          "description": "Average RMS voltage (phase 1)",
          "name": "UMOY1",
          "property": "average_rms_voltage_meas_period",
          "type": "numeric",
          "unit": "V"
        },
        {
          "access": 1,
          "description": "Immediate apparent power delivered",
          "name": "SINSTS",
          "property": "apparent_power",
          "type": "numeric",
          "unit": "VA"
        },
        {
          "access": 1,
          "description": "Apparent power delivered peak",
          "name": "SMAXN",
          "property": "active_power_max",
          "type": "numeric",
          "unit": "VA"
        },
        {
          "access": 1,
          "description": "Apparent power max. draw-off n-1",
          "name": "SMAXN-1",
          "property": "drawn_v_a_max_n1",
          "type": "numeric",
          "unit": "VA"
        },
        {
          "access": 1,
          "description": "Message short",
          "name": "MSG1",
          "property": "message1",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Message ultra-short",
          "name": "MSG2",
          "property": "message2",
          "type": "text"
        },
        {
          "access": 1,
          "description": "PRM number",
          "name": "PRM",
          "property": "site_id",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Start mobile point 1",
          "name": "DPM1",
          "property": "start_mobile_point1",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Stop mobile point 1",
          "name": "FPM1",
          "property": "stop_mobile_point1",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Start mobile point 2",
          "name": "DPM2",
          "property": "start_mobile_point2",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Stop mobile point 2",
          "name": "FPM2",
          "property": "stop_mobile_point2",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Start mobile point 3",
          "name": "DPM3",
          "property": "start_mobile_point3",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Stop mobile point 3",
          "name": "FPM3",
          "property": "stop_mobile_point3",
          "type": "numeric"
        },
        {
          "access": 1,
          "name": "RELAIS",
          "property": "relais",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Current day number supplier calendar",
          "name": "NJOURF",
          "property": "days_number_current_calendar",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Next day number supplier calendar",
          "name": "NJOURF+1",
          "property": "days_number_next_calendar",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Profile of the next supplier calendar day",
          "name": "PJOURF+1",
          "property": "days_profile_current_calendar",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Profile of the next check-in day",
          "name": "PPOINTE1",
          "property": "days_profile_next_calendar",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Link quality (signal strength)",
          "name": "linkquality",
          "property": "linkquality",
          "type": "numeric",
          "unit": "lqi",
          "value_max": 255,
          "value_min": 0
        }
      ],
      "model": "ZLinky_TIC",
      "supports_ota": true,
      "vendor": "LiXee"
    },
    "endpoints": {
      "1": {
        "bindings": [
          {
            "cluster": "haElectricalMeasurement",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          },
          {
            "cluster": "seMetering",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          },
          {
            "cluster": "haMeterIdentification",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          },
          {
            "cluster": "liXeePrivate",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": [
            "genBasic",
            "genIdentify",
            "seMetering",
            "haElectricalMeasurement",
            "haMeterIdentification",
            "liXeePrivate"
          ],
          "output": ["genOta"]
        },
        "configured_reportings": [
          {
            "attribute": "currentSummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "currentTier1SummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "currentTier2SummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "currentTier3SummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "rmsCurrent",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "activePower",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "activePowerPhB",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "apparentPower",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "activePowerMax",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          }
        ],
        "scenes": []
      },
      "242": {
        "bindings": [],
        "clusters": { "input": ["greenPower"], "output": ["greenPower"] },
        "configured_reportings": [],
        "scenes": []
      }
    },
    "friendly_name": "0x00158d0005d29aa0",
    "ieee_address": "0x00158d0005d29aa0",
    "interview_completed": true,
    "interviewing": false,
    "manufacturer": "LiXee",
    "model_id": "ZLinky_TIC",
    "network_address": 32871,
    "power_source": "Mains (single phase)",
    "software_build_id": "4000-0005",
    "supported": true,
    "type": "Router"
  }
]

Tu es sûr que c’est ces JSON ?

C’est des petits JSON, et un simple test chez toi me donne 0.1ms de temps de parsing pour ces JSON, c’est pas le bon JSON à mon avis ^^

Edit je vais push car trop long pour le forum

https://pastebin.com/ sinon !

Tiens j’ai fais une branche pur le debug

Tu peux me copier coller (sur pastebin) un exemple de gros body JSON venant de Zigbee2mqtt ?

Si c’est de la data perso sensible, tu peux aussi me l’envoyer en DM :slight_smile:

Il est là pour le Lixee ( new state )

Sinon le device en lui même pour le discover est déjà sur github

{
    "date_code": "20220217",
    "definition": {
      "description": "Lixee ZLinky",
      "exposes": [
        {
          "access": 1,
          "description": "Serial Number",
          "name": "ADSC",
          "property": "meter_serial_number",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Supplier pricing schedule name",
          "name": "NGTF",
          "property": "current_tarif",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Current supplier price label",
          "name": "LTARF",
          "property": "current_price",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Current tariff index number",
          "name": "NTARF",
          "property": "current_index_tarif",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Customer tele-information protocol version",
          "name": "VTIC",
          "property": "software_revision",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Current date and time",
          "name": "DATE",
          "property": "current_date",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Total active power delivered",
          "name": "EAST",
          "property": "current_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 01)",
          "name": "EASF01",
          "property": "current_tier1_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 02)",
          "name": "EASF02",
          "property": "current_tier2_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 03)",
          "name": "EASF03",
          "property": "current_tier3_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 04)",
          "name": "EASF04",
          "property": "current_tier4_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 05)",
          "name": "EASF05",
          "property": "current_tier5_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 06)",
          "name": "EASF06",
          "property": "current_tier6_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 07)",
          "name": "EASF07",
          "property": "current_tier7_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 08)",
          "name": "EASF08",
          "property": "current_tier8_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 09)",
          "name": "EASF09",
          "property": "current_tier9_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Total provider active power delivered (index 10)",
          "name": "EASF10",
          "property": "current_tier10_summ_delivered",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 01)",
          "name": "EASD01",
          "property": "active_enerfy_out_d01",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 02)",
          "name": "EASD02",
          "property": "active_enerfy_out_d02",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 03)",
          "name": "EASD03",
          "property": "active_enerfy_out_d03",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "Active energy withdrawn Distributor (index 04)",
          "name": "EASD04",
          "property": "active_enerfy_out_d04",
          "type": "numeric",
          "unit": "kWh"
        },
        {
          "access": 1,
          "description": "RMS current",
          "name": "IRMS1",
          "property": "rms_current",
          "type": "numeric",
          "unit": "A"
        },
        {
          "access": 1,
          "description": "RMS voltage",
          "name": "URMS1",
          "property": "rms_voltage",
          "type": "numeric",
          "unit": "V"
        },
        {
          "access": 1,
          "description": "Apparent power of reference",
          "name": "PREF",
          "property": "available_power",
          "type": "numeric",
          "unit": "kVA"
        },
        {
          "access": 1,
          "description": "Register of Statutes",
          "name": "STGE",
          "property": "status_register",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Apparent power threshold",
          "name": "PCOUP",
          "property": "power_threshold",
          "type": "numeric",
          "unit": "kVA"
        },
        {
          "access": 1,
          "description": "Current point of the active load curve drawn",
          "name": "CCASN",
          "property": "active_power",
          "type": "numeric",
          "unit": "W"
        },
        {
          "access": 1,
          "description": "Previous point of the active load curve drawn",
          "name": "CCASN-1",
          "property": "active_power_ph_b",
          "type": "numeric",
          "unit": "W"
        },
        {
          "access": 1,
          "description": "Average RMS voltage (phase 1)",
          "name": "UMOY1",
          "property": "average_rms_voltage_meas_period",
          "type": "numeric",
          "unit": "V"
        },
        {
          "access": 1,
          "description": "Immediate apparent power delivered",
          "name": "SINSTS",
          "property": "apparent_power",
          "type": "numeric",
          "unit": "VA"
        },
        {
          "access": 1,
          "description": "Apparent power delivered peak",
          "name": "SMAXN",
          "property": "active_power_max",
          "type": "numeric",
          "unit": "VA"
        },
        {
          "access": 1,
          "description": "Apparent power max. draw-off n-1",
          "name": "SMAXN-1",
          "property": "drawn_v_a_max_n1",
          "type": "numeric",
          "unit": "VA"
        },
        {
          "access": 1,
          "description": "Message short",
          "name": "MSG1",
          "property": "message1",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Message ultra-short",
          "name": "MSG2",
          "property": "message2",
          "type": "text"
        },
        {
          "access": 1,
          "description": "PRM number",
          "name": "PRM",
          "property": "site_id",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Start mobile point 1",
          "name": "DPM1",
          "property": "start_mobile_point1",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Stop mobile point 1",
          "name": "FPM1",
          "property": "stop_mobile_point1",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Start mobile point 2",
          "name": "DPM2",
          "property": "start_mobile_point2",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Stop mobile point 2",
          "name": "FPM2",
          "property": "stop_mobile_point2",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Start mobile point 3",
          "name": "DPM3",
          "property": "start_mobile_point3",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Stop mobile point 3",
          "name": "FPM3",
          "property": "stop_mobile_point3",
          "type": "numeric"
        },
        {
          "access": 1,
          "name": "RELAIS",
          "property": "relais",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Current day number supplier calendar",
          "name": "NJOURF",
          "property": "days_number_current_calendar",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Next day number supplier calendar",
          "name": "NJOURF+1",
          "property": "days_number_next_calendar",
          "type": "numeric"
        },
        {
          "access": 1,
          "description": "Profile of the next supplier calendar day",
          "name": "PJOURF+1",
          "property": "days_profile_current_calendar",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Profile of the next check-in day",
          "name": "PPOINTE1",
          "property": "days_profile_next_calendar",
          "type": "text"
        },
        {
          "access": 1,
          "description": "Link quality (signal strength)",
          "name": "linkquality",
          "property": "linkquality",
          "type": "numeric",
          "unit": "lqi",
          "value_max": 255,
          "value_min": 0
        }
      ],
      "model": "ZLinky_TIC",
      "options": [
        {
          "access": 2,
          "description": "This device does not support reporting electric measurements so it is polled instead. The default poll interval is 60 seconds, set to -1 to disable.",
          "name": "measurement_poll_interval",
          "property": "measurement_poll_interval",
          "type": "numeric",
          "value_min": -1
        },
        {
          "access": 2,
          "description": "Counter with TIC in mode standard or historique. May require restart (default: auto)",
          "name": "linky_mode",
          "property": "linky_mode",
          "type": "enum",
          "values": ["auto", "historique", "standard"]
        },
        {
          "access": 2,
          "description": "Power with single or three phase. May require restart (default: auto)",
          "name": "energy_phase",
          "property": "energy_phase",
          "type": "enum",
          "values": ["auto", "single_phase", "three_phase"]
        },
        {
          "access": 2,
          "description": "If you produce energy back to the grid (works ONLY when linky_mode: standard, default: auto)",
          "name": "production",
          "property": "production",
          "type": "enum",
          "values": ["auto", "true", "false"]
        },
        {
          "access": 2,
          "description": "Overrides the automatic current tarif. This option will exclude unnecesary attributes. Open a issue to support more of them. Default: auto",
          "name": "tarif",
          "property": "tarif",
          "type": "enum",
          "values": [
            "Historique - BASE",
            "Historique - HCHP",
            "Historique - EJP",
            "Historique - BBR",
            "Standard - Sem WE Mercredi",
            "Standard - Heure Pleine Heure Creuse",
            "auto"
          ]
        },
        {
          "access": 2,
          "description": "Number of digits after decimal point for kWh, takes into effect on next report of device.",
          "name": "kWh_precision",
          "property": "kWh_precision",
          "type": "numeric",
          "value_max": 3,
          "value_min": 0
        },
        {
          "access": 2,
          "description": "During the poll, request multiple exposes to the Zlinky at once for reducing Zigbee network overload. Too much request at once could exceed device limit. Requieres Z2M restart. Default: 1",
          "name": "measurement_poll_chunk",
          "property": "measurement_poll_chunk",
          "type": "numeric",
          "value_min": 1
        },
        {
          "access": 2,
          "description": "List of TIC commands to be exposed (separated by comma). Reconfigure device after change. Default: all",
          "name": "tic_command_whitelist",
          "property": "tic_command_whitelist",
          "type": "text"
        }
      ],
      "supports_ota": true,
      "vendor": "LiXee"
    },
    "endpoints": {
      "1": {
        "bindings": [
          {
            "cluster": "haElectricalMeasurement",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          },
          {
            "cluster": "seMetering",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          },
          {
            "cluster": "haMeterIdentification",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          },
          {
            "cluster": "liXeePrivate",
            "target": {
              "endpoint": 1,
              "ieee_address": "0x00124b0021b95104",
              "type": "endpoint"
            }
          }
        ],
        "clusters": {
          "input": [
            "genBasic",
            "genIdentify",
            "seMetering",
            "haElectricalMeasurement",
            "haMeterIdentification",
            "liXeePrivate"
          ],
          "output": ["genOta"]
        },
        "configured_reportings": [
          {
            "attribute": "currentSummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "currentTier1SummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "currentTier2SummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "currentTier3SummDelivered",
            "cluster": "seMetering",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 100
          },
          {
            "attribute": "rmsCurrent",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "activePower",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "activePowerPhB",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "apparentPower",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          },
          {
            "attribute": "activePowerMax",
            "cluster": "haElectricalMeasurement",
            "maximum_report_interval": 900,
            "minimum_report_interval": 60,
            "reportable_change": 1
          }
        ],
        "scenes": []
      },
      "242": {
        "bindings": [],
        "clusters": { "input": ["greenPower"], "output": ["greenPower"] },
        "configured_reportings": [],
        "scenes": []
      }
    },
    "friendly_name": "Lixee TIC",
    "ieee_address": "0x00158d0005d29aa0",
    "interview_completed": true,
    "interviewing": false,
    "manufacturer": "LiXee",
    "model_id": "ZLinky_TIC\u0000",
    "network_address": 32871,
    "power_source": "Mains (single phase)",
    "software_build_id": "4000-0005",
    "supported": true,
    "type": "Router"
  }

Ok, dans ce cas c’est pas le JSON.parse, c’est un relativement petit JSON qui ne devrait pas poser problème.

Maintenant il faut tester ligne par ligne qu’est-ce qui prend du temps et qui bloque.

Tu peux rajouter dans le code des:

console.time('nameOfMyTimer');
// Le code ici
console.timeEnd('nameOfMyTimer');

(tu peux donner un nom à chaque étape)

Tu lances individuellement le test handleMqttMessage et tu vois ligne par ligne ce qui prend le plus de temps.

C’est fastidieux, mais bon il n’y pas vraiment d’autre méthode pour trouver des solutions !

C’est pas trop violent

2022-06-27T18:32:27+0200 <log> handleMqttMessage.js:22 (Zigbee2mqttManager.handleMqttMessage) Getting config devices from Zigbee2mqtt
Devices map: 0.264ms
Event: 4.241ms
handleMqttMessage: 7.189ms
Gladys Blocked for 28.98486499786377ms, operation started here: []

EDIT:

Un deuxième avec le parse ( j’étais sur batterie en mode éco lors du test précedent )

2022-06-27T18:43:39+0200 <log> handleMqttMessage.js:22 (Zigbee2mqttManager.handleMqttMessage) Getting config devices from Zigbee2mqtt
JSONParse: 0.191ms
Devices map: 0.034ms
Event: 1.049ms
handleMqttMessage: 2.195ms