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

Jan, help with reboot)
This rule shows the uptime of the system

rule("@ {catch, 09:05} => log('Uptime %0.0f годин',(((ostime()-api.get('/settings/info/').serverStatus))/60)/60);fibaro.call(1038, 'sendMessage', fmt('Uptime системи %0.0f годин',(((ostime()-api.get('/settings/info/').serverStatus))/60)/60), -700919895)")

 how to take the uptime number and make a rule, if the uptime is less than 1 hour, then the log - the system rebooted! Well, or another simpler rule?

Link to comment
Share on other sites

  • Topic Author
  • When ER4 starts up it checks serverStatus and if uptime is less then 30s it posts a #se-start event.

    So,

    rule("#se-start => fibaro.call(1038, 'sendMessage', 'HC3 have restarted')")

    should work

     

    Link to comment
    Share on other sites

     

    Hi 

    Please login or register to see this link.

    Can one make one similar to fibaroExtra but for scenes but for HC3?
    Or . Is there another possibility than the conditions of HC3 as in HC2. Sint from HC3 so nasty and confusing.???

    Excuse the audacity in what you and others have already done.

    Link to comment
    Share on other sites

  • Topic Author
  • Well, scenes don't allow for code to be added as additional "files", like it is possible to do for QAs.

    That means that the code needs to be copied in to the actions code of the scene, making it a bit messy.

    Also, scenes are typically "short lived", meaning they are triggered, run, and terminate. That makes it a bit of overhead to setup extra 
    functionality, like from a library, in the scene each time it starts up. QAs tend to run all the time except when crashing...

     

    You ask for conditions of "HC3 as in HC2" - do you mean picking up events like the conditions trigger of a scene?

    Can you show some example of what you want to achieve? (it may be possible to copy relevant part from fibaroExtra to include in a scene....)

    Link to comment
    Share on other sites

    40 minutes ago, jgab said:

    You ask for conditions of "HC3 as in HC2" - do you mean picking up events like the conditions trigger of a scene?

    Can you show some example of what you want to achieve? (it may be possible to copy relevant part from fibaroExtra to include in a scene....)

    Yes, I would like to trigger and then start coding according to my vision. 

    (it may be possible to copy relevant part from fibaroExtra to include in a scene....) I would do it, but it's so complex that I can't tell it apart.

     

    I imagine it like this. At the beginning of a script I enter all my conditions in a table that are relevant for my script and then I continue with the queries and actions.

     

    In my example. "myTrig" I enter all the values that I expect it to be like this. Then I compare the "myTrig" table to see if any line is the same as my lastRefresh. if so, the script runs.
    If that's for both HC2 and HC3, then that's a luxury for me.

     

    Of course I would be grateful for parts of the fibaroExtra code with the events processing but first of all the triggers.

     

    I've been using Google Translate and I'm not sure if it gets my idea across correctly.

    Thank you very much

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • Ah, now I see that you have an HC2. Well, fibaroExtra is HC3 specific. 

    The /refreshStates api was never up to the task on the HC2 - I evaluated it back then but stayed away from it as it was never consisted (didn't show all types of event I needed either).

     

    Link to comment
    Share on other sites

    1 hour ago, jgab said:

     Then for the HC3.  I'm considering switching.  I'm already playing on a HC3 from a Friend. 

    Link to comment
    Share on other sites

    On 4/23/2022 at 10:50 AM, jgab said:

    When ER4 starts up it checks serverStatus and if uptime is less then 30s it posts a #se-start event.

    So,

    rule("#se-start => fibaro.call(1038, 'sendMessage', 'HC3 have restarted')")

    should work

     

    DOES NOT WORK! (((

    QA ER4  - version:v0.5fix80 (QA toolbox 0.25)

    Edited by fastvd
    Link to comment
    Share on other sites

  • Topic Author
  • So, first, is the rule triggering?

    _debugFlags.rule=true      -- log rules being invoked (true or false)

    Console log:

    [{"type":"se-start"}]>>'Rule:2[#se-start => ...

     

    or is it the sendMessage that doesn't work?

    For me the se-start works - just tested it and broke my 40 days uptime...

     

    Do you have a lot of stuff starting up on the HC3 so that the ER3 QA will start > 30s after the HC3 has booted? Then it could be a problem.

    7 hours ago, fastvd said:

    DOES NOT WORK! (((

    QA ER4  - version:v0.5fix80 (QA toolbox 0.25)

    Oh, you do have a very old ER4 - that is the problem.

    Upgrade to latest.

    Use the updater QA to upgrade 

     

    Link to comment
    Share on other sites

    11 hours ago, jgab said:

    So, first, is the rule triggering?

    _debugFlags.rule=true      -- log rules being invoked (true or false)

    Console log:

    [{"type":"se-start"}]>>'Rule:2[#se-start => ...

     

    or is it the sendMessage that doesn't work?

    For me the se-start works - just tested it and broke my 40 days uptime...

     

    Do you have a lot of stuff starting up on the HC3 so that the ER3 QA will start > 30s after the HC3 has booted? Then it could be a problem.

    Oh, you do have a very old ER4 - that is the problem.

    Upgrade to latest.

    Use the updater QA to upgrade 

     

    _debugFlags.rule=true - YES

    [{"type":"se-start"}]>>'Rule:2[#se-start => ... 

    where should i see it logically at start ER4, but as you can see on the screen - there is nothing like that (((

    Please login or register to see this attachment.

    ER4 , deviceId:1201, version:0.77

    Edited by fastvd
    Link to comment
    Share on other sites

  • Topic Author
  • The highlighted lines are the log that the rule is loaded/defined.

    The actual trigger of the rule should come later.

    Anyway, I have a hard time understanding why it doesn't work for you.

     

    Could you make this test.

    At the end of the QA file "EventRunner" add this debug line.

    It will log the boot time of the HC3 and the current time. This is what I use to see if diff is less than 30s and post the se-start event.

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    @fastvd as tip perhaps handy?

    Please login or register to see this code.

    Remark: push is switched off because Fibaro wqs messing with it now I use Telegram for messages.

    If one of my QA's restart I recieve a message>> this I find important because if QA restart there is something wrong

    If I recieve multiple messages I know my HC3 is restarted >> this happends seldom.

    //Sjakie

    Link to comment
    Share on other sites

    • 2 weeks later...
  • Topic Author
  • Pushed v0.78 of ER4. Best upgraded using the UpdaterQA.

    Some small bug fixes and the start of adding online documentation of functions.

    Running

    Please login or register to see this code.

     

    in main() will log all functions with some doc string (not all added yet)
    Link to comment
    Share on other sites

    Thanks Jan!!

    Do I need DST in my rules or is it already in your ER?

    //sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • Eh, no it's not added yet - forgot about it.

    Added it to my todo. Next release.

    Still need to run something like

     

    or you could do a rule like

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    Pushed v0.78 of ER4. Best upgraded using the UpdaterQA.

    Some small bug fixes and the start of adding online documentation of functions.

    Running

    Please login or register to see this code.

     

    in main() will log all functions with some doc string (not all added yet)

    I see that i still are using the old EventRunner4 v0.5fix80 for all my EV4. I installed a version of v0.78/EV4 with the QA updater. Is there anything i need to pay attention to or can i just copy my rules into the main section as in v80 ?

    Edited by ChristianSogaard
    P
    Link to comment
    Share on other sites

    Jan Ihave had this from you worked excellent!

    Please login or register to see this code.

    I have somethinsimular as @ChristianSogaard

    mu last update was November 2021 and my HC3 will be active again around December 2022 is't better to start with a fresh ER4?

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • 19 minutes ago, ChristianSogaard said:

    I see that i still are using the old EventRunner4 v0.5fix80 for all my EV4. I installed a version of v0.78/EV4 with the QA updater. Is there anything i need to pay attention to or can i just copy my rules into the main section as in v80 ?

    It should just be to copy. Future updates preserve the main file so your rules are not touched, 

    14 minutes ago, Sjakie said:

    Jan Ihave had this from you worked excellent!

    I have somethinsimular as @ChristianSogaard

    mu last update was November 2021 and my HC3 will be active again around December 2022 is't better to start with a fresh ER4?

    //Sjakie

    If you are an older ER4 (ex fix 0.5vXY) I recommend to upgrade to the latest. It can be done with the UpdaterQA as it allows v0.5fixXY to be upgraded.

    It preserves the 'main' file and it should be backward compatible so it should work.

    Link to comment
    Share on other sites

    15 minutes ago, jgab said:

    It should just be to copy. Future updates preserve the main file so your rules are not touched, 

    If you are an older ER4 (ex fix 0.5vXY) I recommend to upgrade to the latest. It can be done with the UpdaterQA as it allows v0.5fixXY to be upgraded.

    It preserves the 'main' file and it should be backward compatible so it should work.

    I don't know why i'm impressed - because you always deliver amazing work, but I am ?. I upgraded 3 Eventrunner QA to the newest. And everything seems to work. Just need to remember to rename the OLD QA to EventRunner4 before the updater can find it?

    • Thanks 1
    Link to comment
    Share on other sites

  • Topic Author
  • 20 minutes ago, ChristianSogaard said:

     Just need to remember to rename the OLD QA to EventRunner4 before the updater can find it?

    that's only for v0.5fixXY, for newer versions you can give them any name as they use a serial number in the QA code to recognise the right QA.

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