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


How to enable/disable quickapp (Eventrunner4) by profiles?


RobLu

Recommended Posts

I recently switched from the HC2 to the HC3. I am using the Eventrunner4 Quickapp with complete satisfaction!  
The HC3 has the ability to create profiles. I would like to know the best method to turn a Quickapp on/off for a certain profile. Or is this already built into Eventrunner4? I can't figure it out. 

Edited by RobLu
Link to comment
Share on other sites

  • Topic Author
  • I am now a lot further but am now stuck in the code below. If the Home profile is active, the rule 2 below is not executed. What is going wrong?
    The kitchen temperature is 26 degrees, so rule 2 should be activated.

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    • RobLu changed the title to How to enable/disable quickapp (Eventrunner4) by profiles?

    Well, rules are normally not triggered unless some device/event in the left-hand side of the rule changes state.

    trueFor will not start its first watch before any device in the condition changes state. In your case keuken.tempIntern:temp.

    So even if the section is enabled, the rule will not start it's first 5 min watch until the temp changes.

     

    Usually a way to get around that is to run the rule with .start()

    rule("trueFor(00:05,keuken.tempIntern:temp > 23) =>...").start()

    That will trigger the rule when it's defined and if temp > 23 it will start the watch...

     

    However, in your case you need to do it every time the section is enabled.

     

    One way to do it is to call .start() for the rule when you enable the section

    Please login or register to see this code.

     

    I could also probably generate an event for rules being enabled/disabled and the .start() could be done from handlers triggering on those events...

    It would probably make the code cleaner... but I have to think about it.

    Link to comment
    Share on other sites

  • Topic Author
  • Hi @jgab

     

    Thanks for your response, I changed the code as suggested and now the r2 rule is activated when I switched to "Home" profile. But it's still executing after I changed back to "Away" profile. Should I stop the r2 rule in the "Away" section? How to do, a r2.stop() function doesn't exist? 

     

    Please login or register to see this code.

     

     

     

    Link to comment
    Share on other sites

    9 hours ago, jgab said:

     

    I could also probably generate an event for rules being enabled/disabled and the .start() could be done from handlers triggering on those events...

    It would probably make the code cleaner... but I have to think about it.

     

    it will be really welcome function - same could be use for restarting of HC3/ER (reading of current values of sensors/devices/… and generate fake events)

     

    Sometime I have to create in ER “initial procedures” for activation of rules after restarting of HC3 or ER (ie. switch off lights if there is no motion)

    Link to comment
    Share on other sites

    Well, it turned out that disable didn't play well with trueFor.

    trueFor starts timers and those timers were not cancelled when the rule was disabled.

     

    I have made a fix v0.85 that I hope will fix it.

     

    The enable/disable event I need to think about. I believe to be correct all rules when defined should emit an 'enabled' event (i.e. implicitly call .enable()), but I'm not sure...

    Link to comment
    Share on other sites

    Ok, pushed v 0.86 that generates ruleEnable/ruleDisable events

    Ex.

    Please login or register to see this code.

    Similar for enable. No events generated when rule is defined, only when explicitly enabled/disabled.

    Also works when enabling/disabling sections. Then an event per rule affected is posted.

    Edited by jgab
    Link to comment
    Share on other sites

  • Topic Author
  • Thanks you a lot to build in the ruleEnable/Disable events! 

     

    The update from 0.84 to 0.85 goes well, but the update to version 0.86 does not. I update with QAupdater. I am not getting any error messages. What can go wrong?

    Link to comment
    Share on other sites

  • Topic Author
  • Thanks a lot the fix in 0.85 did the job!

     

    After a while am getting an ERROR in the console (call:modules.files.lua).  

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    2 hours ago, RobLu said:

    Thanks a lot the fix in 0.85 did the job!

     

    After a while am getting an ERROR in the console (call:modules.files.lua).  

     

    Please login or register to see this code.

     

    You are trying to update the QA from the TQAE Web interface?

    Link to comment
    Share on other sites

  • Topic Author
  • No from the QAupdater app in hc3 dashboard. So the HC3 is at 0.85 and the dev env at 0.86 (github update). 
     

     

    Link to comment
    Share on other sites

    1 hour ago, RobLu said:

    No from the QAupdater app in hc3 dashboard. So the HC3 is at 0.85 and the dev env at 0.86 (github update). 
     

     

    Yep, I had missed updating the version number. I pushed a new version that should work with QAupdater

    Link to comment
    Share on other sites

  • Topic Author
  • Thanks a lot again the QAupdater works for update 0.86.

     

    Another question:

    *  I installed telegram.fqa but nothing happens? Device not added to FIBARO HC3

    * In fibaroExtra there is a function "fibaro.getIPaddress(name)" to return the HC3 IP. Is it possible to add a function getExternIPaddress? So the IP address to the outside.

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • After HC3 reboot the Telegram app is visible.. 

    Link to comment
    Share on other sites

  • Topic Author
  • Hi @jgab

     

    Do you have an example how to call TelegramQA from a Eventrunner rule?

     

    I installed TelegramQA and start the app with the TelegramQA Powerswitch. But it stopped directly.

     

    I tried this in my code:

     

    Please login or register to see this code.

     

    followed with this error:

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    45 minutes ago, RobLu said:

    Hi @jgab

     

    Do you have an example how to call TelegramQA from a Eventrunner rule?

     

    I installed TelegramQA and start the app with the TelegramQA Powerswitch. But it stopped directly.

     

    I tried this in my code:

     

    Please login or register to see this code.

     

    followed with this error:

     

    Please login or register to see this code.

     

    Move this discussion over to the ER forum thread.

    You can't have "" strings within "" strings. Do

    rule([[@@00:01:00 => fibaro.call(52, "sendTelegram", 9999, "Test telegram HC3") ]]).disable()

    Link to comment
    Share on other sites

  • Topic Author
  • Hi @jgab

     

    This works great thanks! I learned a lot! ?

     

     

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