Ok cool! Now two approaches to fix this on Gladys; we need to run tests and see:
- Either we add this kind of callback (setImmediate) straight into the event listener code (on the core side); if that works it would be best because it would improve performance for all integrations
- Or if that’s not enough (if, for example, executing .emit itself is what’s slow), then we’ll need to make the change in the Z2M integration code, a bit like the line I showed you here
The third point is that checking scene triggers can also be optimized in my opinion — I opened an issue in the past but since nobody was bothered I didn’t dedicate time to it; now it might be worth investing a bit of time in it ![]()