Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Recommended Posts

Posted

I notice one thing when i restart one of my subscribe scene, that also those scene that does not publish an event get the Post %%SUB%% , is that right? 

  • Topic Author
  • Posted
    1 hour ago, jompa68 said:

    I notice one thing when i restart one of my subscribe scene, that also those scene that does not publish an event get the Post %%SUB%% , is that right? 

    Yes, all scenes gets notified of new  %%SUB%% messages so they know who to publish to, if they decide to publish.

  • Topic Author
  • Posted
    23 hours ago, jompa68 said:

    From the published scene to subscribed scene i would say it is ms, so it is when a device is triggered it takes 2-4 seconds before the code is executed.
     

    Ok, I have pushed a new version, 1.15,fix9.

    In this version there is a new debug flag

    _debugFlag.msgTime=true

    will add timestamps to age event as it passes through ER.

    <event>._timestamps.triggered{os.time(), os.clock()}  -- is the time when the scene was triggered

    <event>._timestamps.triggered{os.time(), os.clock()}  -- is the time when the scene managed to post the event to the mailbox.

    <event>._timestamps.received{os.time(), os.clock()}  -- is the time when the scene read the message and handed it to the rule engine.

     

    ...and there is a convenient Util.eventTimestamp function to log the timestamps.

     

    In a rule if you do, ex.

    Please login or register to see this code.

    it will log the times.

    I typically get something like

    Please login or register to see this code.

    The first "Time:1s" is not part of the log but I let a publisher send os.time and the subscriber to log the diff. So it seems like pub/sub takes ~1s. Unfortunately we can't use os.clock between scenes...

    Anyway,

    The scene was triggered 05:54:36

    6.7 ms later it managed to post it back to it's own "main"

    The "main" received it 05:54:36

    ...and the Util.eventTimestamp() logged it 4.9ms later

     

    The 77:on is just a fibaro:call(77,"turnOn"), and how long it takes before the lamp is actually turned on we don't know.

     

    So, this only proves that my system is pretty fast :-) 

    Please try this version out and log some events. I would be interested to see time _timestamps log when you have delay of 2-4s, so we get a feeling for where it spends the time.

     

    • Like 1
    Posted

    Will implement now and report back later today some results.
     

    Posted

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    4 minutes ago, jompa68 said:

    Please login or register to see this code.

     

    Sorry, pushed a fix.

    Or just make this change

    Around line 73 in ER

    change

    Please login or register to see this code.

    to

    Please login or register to see this code.

     

  • Topic Author
  • Posted (edited)
    20 minutes ago, jgab said:

     

    Pushed yet another version with a better version of eventTimestamp

     

    Please login or register to see this code.

    This one only logs if the total time exceeds mt and with the color; ex. LOG.LOG, or LOG.ERROR

    This is better as it doesn't pollute the log with un-interesting log messages...

    mt and color can be left out and defaults to 0 and LOG.LOG, like in the previous version.

    Please login or register to see this code.

    This will only log if the total time exceeds 1 second and use the bright red color of LOG.ERROR. 

    Edited by jgab
    Posted (edited)

    This is a pub/sub event

    Please login or register to see this image.

    /monthly_2019_02/image.png.72c51509a663faab512bbe0d7f784cd0.png" />

     

    this is normal trigger

    image.png.120caf1c9e8457d6407cdd8d2910995c.png

    Edited by jompa68
  • Topic Author
  • Posted
    3 minutes ago, jompa68 said:

    Please login or register to see this link.

    Interesting. The first log.

    Triggered->post and received->logged are acceptable values.

     

    However, triggered 14:32 and picked up by main 14:34. What did it do those 2s? 

     

    Let's assume it triggered 14:32:999. Then it posts 14:32:999+0.091 = 14:33:09

    Then main polls the mailbox every 250ms, so assume it picked up 14:33:340 (14:33:09 + 0.250)

    But it reported 14:34

     

    Let's assume it triggered 14:32:00. Then it posts 14:32:00+0.091 = 14:32:091

    Then main polls the mailbox every 250ms, so assume it picked up 14:32:341 (14:32:091 + 0.250)

    But it reported 14:34

     

    So, in any case we have some unexplained loss of time from the global variable (mailbox)  being set until main picks it up.

     

    So, one possible explanation is that 'main' fails to check the mailbox every 250ms. A garbage collect or whatever could distract it. or something else.

    I have pushed a new version that times the mailbox poll loop and logs an error message (red) if main fails to check the mailbox less than every 750ms.

    Could you please test the new version and see if you get warnings?

     

    58 minutes ago, jompa68 said:

    This is a pub/sub eventthis is normal trigger

    Please login or register to see this link.

     

    How did the rule/code for that look like?

    ...and the rule/code for the slow trigger? Was the slow a publish/subscribe?

    Posted

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    1 minute ago, jompa68 said:

    Please login or register to see this code.

     

    Can you pm me the whole scene?

    Sorry, the first slow warning is probably false because that includes the whole scene setup (including compiling rules). If you get any additional slow warnings it is a better sign.

    Posted

    Tested a bit more on my lunch break and normal sensor:breached => deviceID:toogle is faster than publish it to an virtual device

    Posted

    Possible to use #location awareness together with a device trigger?

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    21 minutes ago, jompa68 said:

    Possible to use #location awareness together with a device trigger?

    Please login or register to see this code.

     

    Almost, (should be :isOn instead of :on)

    Please login or register to see this code.

    This will only trigger on the location event, and then check if the coffee machine is on and then carry out whatever.

    If your intention is to have a rule that trigger both if the machine is turned on and the location event is arriving it should be (in theory)

    Please login or register to see this code.

    This will trigger both on the coffee machine and the location event. In practice it will only be true when the location event arrives (and the coffee machine happens to be on). When the coffee machine event triggers the rule the location event check will never be true (because it was a coffee machine event that triggered the rule).

    So, this rule is in reality working as the previous version where we moved the coffee machine test to the right of the =>.

     

    When in doubt, do 

    Please login or register to see this code.

    and you will see what sourceTriggers the rule will be triggered by. When you do it on your first example you will see that the coffee machine trigger is missing, because :on is not generating triggers, only :isOn

    Posted

    another question :D

     

    possible to use wildcard pattern?

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    8 minutes ago, jompa68 said:

    another question :D

     

    possible to use wildcard pattern?

    Please login or register to see this code.

     

    You have to call string.match explicitly. Maybe I add an instruction in the next version

    Please login or register to see this code.

     

    Posted

    Thanks, got it to work

    41 minutes ago, jgab said:

    You have to call string.match explicitly. Maybe I add an instruction in the next version

    Please login or register to see this code.

     

     

    Posted

    iOSLocation error, got both me and my wife.

     

    Please login or register to see this code.

     

    Posted
    17 minut temu, jompa68 napisał:

    iOSLocation error, got both me and my wife.

     

    Please login or register to see this code.

     

    I've got the same , but isn't it a findmyiphone service issue ?

    Posted (edited)
    4 minutes ago, domin12 said:

    I've got the same , but isn't it a findmyiphone service issue ?

    Yes it is Apple service problem. Something changed at their side?

     

    Service working again.

    Edited by jompa68

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...