Autor Thema: Synchronous/asynchronous get  (Gelesen 2377 mal)

Offline AlxDmr

  • Jr. Member
  • **
  • Beiträge: 59
Synchronous/asynchronous get
« am: 03 April 2015, 10:29:25 »
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.

Offline klaus.schauer

  • Developer
  • Hero Member
  • ****
  • Beiträge: 1211
Antw:Synchronous/asynchronous get
« Antwort #1 am: 03 April 2015, 17:30:38 »
Response Timing see EnOcean EEP 2.6.2 page 115

Offline AlxDmr

  • Jr. Member
  • **
  • Beiträge: 59
Antw:Synchronous/asynchronous get
« Antwort #2 am: 03 April 2015, 21:08:39 »
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.

Offline klaus.schauer

  • Developer
  • Hero Member
  • ****
  • Beiträge: 1211
Antw:Synchronous/asynchronous get
« Antwort #3 am: 04 April 2015, 07:01:04 »
You are not right, the routines for sending and receiving are independent.