Synchronous/asynchronous get

Begonnen von AlxDmr, 03 April 2015, 10:29:25

Vorheriges Thema - Nächstes Thema

AlxDmr

Hello,
I am using some enOcean smartplug that have to be explicitely queried to retrieve power consumption. I do it every N seconds but I observed that it is really time consuming for the CPU: using the "top" command on a raspberry Pi2, it shows that for only 5 plugs updated every 3 seconds, the CPU goes from ~1% to more than 5%.
Of course I can survive whith that, but I was wondering wether it could come from synchronous get command (get PLUG_NAME measurement input power). I mean that the command seems to be synchronous => it is waiting for the consumption to be measured, meaning that the command has to be sent via the enOcean USB radio key, then that the plug has toi answer to the request, then the USB key has to read it etc.
If it is the case, then for sure Fhem is stuck during this time, which could explain why the CPU load dramatically increases. If not then I really wonder were that increase come from...
So my question is: if the get call (for power measurement in this case) is synchronous, would it be possible to make it asynchronous or to have an asynchronous version of it ?

    Alex.

klaus.schauer

Response Timing see EnOcean EEP 2.6.2 page 115

AlxDmr

I understand the enOcean specification and also that such a delay is necessary from the point of view of enOcean. My question is not about that but about how this kind of command is processed in the Fhem module.
With respect to the CPU load, I suspect that there is a kind of synchronous command in Fhem that freeze everything until the enOcean answer is received (or after 300ms), am I right? Or is everything asynchronous in the enOcean Fhem module, meaning that the power consumption measurement request is sent, a listener for the answer is set up and the next instructions are processed until the answer is received.

klaus.schauer

You are not right, the routines for sending and receiving are independent.