Developer call in the next few weeks?

Ok I just understood (Mondays are hard) while reading your recap the goal

1 Like

@AlexTrovato @VonOx For info I did a test to make the .emit function of our global EventEmitter asynchronous!

I was inspired by the code of this library which is quite well known (but well, too complete for us, we don’t need all of that):

It looks like this in terms of code, it’s really very simple:

Basically, each time we emit an event, the event will be published synchronously only « afterwards » — we give Node.js the control to do what it wants between the function call and the synchronous emit.

In the case of devices that would generate hundreds of emits (which themselves would generate hundreds of emits, because we check many things: scenes, websockets to the frontend, etc.), each event is not consumed synchronously, but asynchronously when Node.js can.

This should solve the issues with devices like the Linxee TIC

What do you think?

Edit: @VonOx since it’s a change of a few lines, could you replace the file in your production and see the effect it has, to check if it really solves the issue?

It’s done, I’ll give you feedback tomorrow

1 Like

I feel like it’s a bit « laggy »

I’ll add some logging to get the execution times

ah, so that doesn’t solve the problem as well as setImmediate?

FYI, regarding our discussion about the current users of the open-zwave integration:

https://community.gladysassistant.com/t/v4-integration-z-wave/6057/99?u=pierre-gilles

@pierre-gilles I think we’re good.

EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:power:active_power: 0.01ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:power:active_power_max: 0.008ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:power:active_power_ph_b: 0.008ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:power:apparent_power: 0.008ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:current:available_power: 0.008ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:voltage:average_rms_voltage_meas_period: 0.008ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:index:current_tier1_summ_delivered: 0.023ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:index:current_tier2_summ_delivered: 0.008ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:current:power_threshold: 0.015ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:binary:relais: 0.008ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:current:rms_current: 0.009ms
EventEmit zigbee2mqtt:Lixee TIC:energy-sensor:voltage:rms_voltage: 0.008ms

@VonOx Experience-wise, is it smooth or does it lag? The most important thing is that as a user it’s perfectly smooth :slight_smile:

Yes it’s good, I had too many tabs open last time :neutral_face:

1 Like

@VonOx I merged into master, so :slight_smile: If you rebase your PR you’ll have access to it!