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


fibaroExtra


jgab

Recommended Posts

  • Topic Author
  • Posted (edited)
    4 hours ago, Neo Andersson said:

    @jgab Jan is there a way to retrive all the existing cronJobs ?

    I see in fibaroExtra that they are stored in a local jobs table. Can we somehow get them? 

    No, not at the moment.

    You could add

    Please login or register to see this code.

    and you will have access the jobs table.

    The key is the cron string you register.

    Edited by jgab
    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    No, not at the moment.

    You could add

    Please login or register to see this code.

    and you will have access the jobs table.

    The key is the cron string you register.

    thanks

    Link to comment
    Share on other sites

    @jgab Jan , do you have any clue, where to look for the reason that fibaroExtra loads twice?

    I have tried everything system restart, rebuild QA, delete fibaroExtra, reinclude etc

    Every time the QA gets saved, it loads twice

     

    Please login or register to see this image.

    /monthly_2024_04/image.png.89eb255d8e57760d49dec1da4b1c82fb.png" />

    Edited by Neo Andersson
    Link to comment
    Share on other sites

    @jgab Jan, fibaroExtra utils.remove is not working ?

     

    Please login or register to see this code.

    throws error

     

    Please login or register to see this image.

    /monthly_2024_04/image.png.d6c045785a2c9198f5f7df1a5d2dfb57.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • 11 hours ago, Neo Andersson said:

    @jgab Jan, fibaroExtra utils.remove is not working ?

     

    Please login or register to see this code.

    throws error

     

    Please login or register to see this link.

    I don't think there is an utils.remove (at least not since over a year ago)? Where did you see the reference?

    There is the Lua built-in table.remove(tab, index) and then in

    fibaroExtra there is the added

    table.delete(value,tab) 

    that looks up the first instance of value in tab and removes it. (I know, logically the arguments should be swapped...)

     

    Link to comment
    Share on other sites

    2 hours ago, jgab said:

    I don't think there is an utils.remove (at least not since over a year ago)? Where did you see the reference?

    There is the Lua built-in table.remove(tab, index) and then in

    fibaroExtra there is the added

    table.delete(value,tab) 

    that looks up the first instance of value in tab and removes it. (I know, logically the arguments should be swapped...)

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    On 4/6/2024 at 1:42 PM, Neo Andersson said:

    @jgab Jan , do you have any clue, where to look for the reason that fibaroExtra loads twice?

    I have tried everything system restart, rebuild QA, delete fibaroExtra, reinclude etc

    Every time the QA gets saved, it loads twice

     

    Please login or register to see this link.

    @jgab Jan, i have tested using different version of fibaroExtra..It seems that only the latest v0.964 is loading twice. Check this log, this is the testing with v0.961 and v0.964. In first case it is loaded only once

     

     

    Please login or register to see this image.

    /monthly_2024_04/image.png.4715912de26eb729a9c94adc60c9c87a.png" />

    Edited by Neo Andersson
    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, Neo Andersson said:

    @jgab Jan, i have tested using different version of fibaroExtra..It seems that only the latest v0.964 is loading twice. Check this log, this is the testing with v0.961 and v0.964. In first case it is loaded only once

     

     

    Please login or register to see this link.

    Will test tomorrow. Been at a rum tasting session and should not touch code…

    • Like 2
    Link to comment
    Share on other sites

  • Topic Author
  • 12 hours ago, jgab said:

    Will test tomorrow. Been at a rum tasting session and should not touch code…

    v0.964 didn't load twice for me.

    Which gitrepo are you getting the code from? Seems fibaroExtra is available both in TQAE/libs and fibemu/examples....

    Can you produce a QA with fibaroExtra that loads twice and post to me? Best a minimal version without dependencies to a lot of devices so it's difficult to run for me... The one you tested in your last post was it a very complex QA?

     

    Link to comment
    Share on other sites

    5 hours ago, jgab said:

    v0.964 didn't load twice for me.

    Which gitrepo are you getting the code from? Seems fibaroExtra is available both in TQAE/libs and fibemu/examples....

    I have copy pasted it from forum link.

    Can you produce a QA with fibaroExtra that loads twice and post to me?

    Best a minimal version without dependencies to a lot of devices so it's difficult to run for me...

    Yeah this is what drives me crazy. The Qa from the last post was a simple tester QA nothing in it. As you can see, it was loading twice the fibaroExtra in one version and not in the other. However, now i can't reproduce it with this small tester, only with the big one. Here should be something happening, becuase yesterday I was able to reproduce this with a simple test QA (that you see on the attached pic, QA with id 1618 ), it was a simple tester QA, nothing in it, and i first tried with 0.61 version and the second attempt was 0.64 version. Now i have tried again, and this simple QA doesn't show double load now. However, the bigger QA still keeps loading twice, and in that QA it happens with other versions of fibaroExtra too. I am pretty lost here, because definitelly something makes the QA load twice. It also happened earlier with other QAs, but at this moment i can't reproduce it with just s simple test QA. Where the hell can this double load come from? The complex QA is pretty complex, but nothing out of ordinary. And even if it was, is there anything that can cause fibaroExtra to load twice? What to check? I am pretty sure i will catch it again with  other QAs too in the future, becuase this is not a new thing. This was happening earlier too (i think i wrote to you about this a few times)..I have no clue what to do..

    The one you tested in your last post was it a very complex QA?

    Quite complex, but it can run on its own. No need to set anything. It created a ROOMLIGHTDATA global variable at first, and then ueses it to manage light, pir, luxsensor events according to users choice. So here is what i did to reproduce. I grabed the complex QA, deleted everything from it. Nothing there just the onInit function and fibaroExtra file. And woala..still double load.

     

    Please login or register to see this attachment.

     

     

    Attaching the QA..

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 19 hours ago, Neo Andersson said:

     

    Attaching the QA..

    Please login or register to see this attachment.

    Yep, there is something fishy going on here. I'm a bit busy today but I will dig into it as soon as possible..

    Link to comment
    Share on other sites

  • Topic Author
  • Ok, it actually doesn't seem to have anything todo with fibaroExtra (besides fibaroExtra being a file that prints out the log message every time it is loaded)

    This file with fibaroExtra replaced with a simple print line also loads twice. 

    Please login or register to see this attachment.

    Install the QA and do a trivial edit (add a space) to both main and fileB so both tabs are open in the Device Editor.

    Please login or register to see this attachment.

    and then save. We get a log like

    Please login or register to see this code.

    So, it seems it kind of reloads all open files twice. After that, even if we edit just one file and save both files are reloaded twice again. (sometimes just one file is loaded twice)

    It is connected to the editor because if we exit the editor and do something like add a quickAppVar and save (which cause a restart) it only loads the files ones.

     

    fibaroExtra kind of adds a bit of complexity as it hijacks the QuickApp.__init function, so I think it's because of that we only see fibaroExtra load twice and not main.

     

    Is it dangerous? Well, it cause unnecessary restarts of the QA which can make cause&effect look strange if you do something in :onInit()

     

    So, in your case @Neo Andersson, it's not fibaroExtra that is loaded twice, it's the editor that loads the Lua file(s) twice. Will it cause problems? I don't think so, but I'm not 100% sure...

     

    Oh, one last thing. It seems to be related to how many UI elements we have. I haven't been able to reproduce the behaviour with a QA with less buttons then in the included example - but I don't know what is the cause & effect here...

    Edited by jgab
    • Like 1
    • Thanks 1
    Link to comment
    Share on other sites

    11 hours ago, jgab said:

    Ok, it actually doesn't seem to have anything todo with fibaroExtra (besides fibaroExtra being a file that prints out the log message every time it is loaded)

    This file with fibaroExtra replaced with a simple print line also loads twice. 

    Please login or register to see this attachment.

    Install the QA and do a trivial edit (add a space) to both main and fileB so both tabs are open in the Device Editor.

    Please login or register to see this attachment.

    and then save. We get a log like

    Please login or register to see this code.

    So, it seems it kind of reloads all open files twice. After that, even if we edit just one file and save both files are reloaded twice again. (sometimes just one file is loaded twice)

    It is connected to the editor because if we exit the editor and do something like add a quickAppVar and save (which cause a restart) it only loads the files ones.

     

    fibaroExtra kind of adds a bit of complexity as it hijacks the QuickApp.__init function, so I think it's because of that we only see fibaroExtra load twice and not main.

     

    Is it dangerous? Well, it cause unnecessary restarts of the QA which can make cause&effect look strange if you do something in :onInit()

     

    So, in your case @Neo Andersson, it's not fibaroExtra that is loaded twice, it's the editor that loads the Lua file(s) twice. Will it cause problems? I don't think so, but I'm not 100% sure...

     

    Oh, one last thing. It seems to be related to how many UI elements we have. I haven't been able to reproduce the behaviour with a QA with less buttons then in the included example - but I don't know what is the cause & effect here...

    Yes, i was a bit afraid of that kind of answer. It is again something that i have to turn to fibaro support, and i am 1000% sure this question will never ever be answered or solved. Probably this problem is something similar to that other regarding missing button callback function warnings. It happens quite often, that when user presses quickly a button in a QA that has many control elements, we got a warning in WEB interface, that the button doesnt have callback function defined, what is not true..so it is probably originated from some similar problem soruces. Never mind Jan thanks for looking at it..I just hope, this wont harm anything, because there is a lot of QAs that are using complex UI setups, fibaroExtra etc..hopefully this will not affect memory or something..Thanks again

     

    Link to comment
    Share on other sites

    @jgab Jan, i have seen your answer on other topic regarding timers. There is a long lasting concern of mine, when i dynamically create events, cronjobs or some other timer related stuff, It seems to me that my system is getting day by day using more and more memory.

    So i always take care when I re-post and event, or re-set some cronjob to first delete the old ones, but seems to me still, that timers numbers are increasing all the time.

    Using this approach, to keep track of timers

     

    Please login or register to see this code.

     

     

    will keep track of fibaroExtra timers too?

    Usually i follow this approach to first remove existing events if it needs to be recreated dynamically with some changed ids or whatever

     

    Please login or register to see this code.

     

    So using the listTimers apporach will list all running timers. even the ones created by fibaroExtra?

    Link to comment
    Share on other sites

  • Topic Author
  • 14 hours ago, Neo Andersson said:

    @jgab Jan, i have seen your answer on other topic regarding timers. There is a long lasting concern of mine, when i dynamically create events, cronjobs or some other timer related stuff, It seems to me that my system is getting day by day using more and more memory.

    So i always take care when I re-post and event, or re-set some cronjob to first delete the old ones, but seems to me still, that timers numbers are increasing all the time.

    Using this approach, to keep track of timers

     

    Please login or register to see this code.

     

     

    will keep track of fibaroExtra timers too?

    Usually i follow this approach to first remove existing events if it needs to be recreated dynamically with some changed ids or whatever

     

    Please login or register to see this code.

     

    So using the listTimers apporach will list all running timers. even the ones created by fibaroExtra?

    EventHandlers themselves don't use timers - they are just a pattern and function stored in a table.

    When we post events a timer is started (even when time is 0) but they terminate when the eventHandler is invoked.

    cronJobs, the last version, only have one timer that every minute check if any con_string is up for execution.

     

    No, the listTimers approach I posted yesterday is not compatible with fibaroExtra, but it gave me the idea to maybe rewrite that part of fibaroExtra....

    • Thanks 1
    Link to comment
    Share on other sites

    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...