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 )