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

  • Topic Author
  • 19 hours ago, Sjakie said:

    Jan,

    If I use this in HC3 it will give error:

    function watchProperty(deviceIDs,property,threshold,interval)
        local values={}
        Event.schedule(interval,function()
            for _,id in ipairs(deviceIDs) do
              if id==nil then Log(LOG.ERROR,"Nil in deviceID list"); break;  end
              local val = values[id] or 100000
              local newVal = tonumber(fibaro:getValue(id,property))
              if newVal==nil then Log(LOG.ERROR,"deviceID %s don't have property %s",id,property) end
              if newVal and math.abs(newVal-val) >= threshold then
                values[id]=newVal
                Event.post({type='property', deviceID=id, propertyName=property, value=newVal})
              end
            end
          end)
      end

     

          watchProperty({ HT.keuken.afZuigKap, HT.keuken.wcdVaatWasser},"power",5,"+/00:00:45")

    line 169 >>Event.schedule....

     

    Well, HC3 api commands look different. fibaro:getValue is fibre.getValue etc.

    Without having tested it try this

    Please login or register to see this code.

    However, I'm not sure this is the right way to do it on the HC3 in the future. The idea was that we didn't want the device to trigger the rule every time it changed. but only when we passed certain thresholds. 

    Link to comment
    Share on other sites

    33 minutes ago, jgab said:

     

    It can be your dimmer that doesn't generate a sceneActivationEvent. Do you know that it does? On the HC2 there were some parameters that needed to be set. On the HC3 I know that some people have had issues

     

     

     

    The Dimmer has the "sceneActivationEvent" active and is being used for scene automation(HC3).

    Could there be any difference in the Dimmer properties?

    It is currently a property as a toggle device.

    Link to comment
    Share on other sites

  • Topic Author
  • Remote or GV shouldn't matter. I have no problems in ER4 with globals.

     

    Just to be clear. You have two rules after each other

    Please login or register to see this code.

    The first triggers, but the second doesn't?

    Link to comment
    Share on other sites

    Jan, correct

    the 2nd did, do, does nothing?

    Now I think also to write more rules instead of combining  but probaly no garantee that

    rule("WCD=='Aan' => log('example'); keuken.wcdBoiler:on") had execute part keuken......?

    Thanks for your time and support!

    //Sjakie

    Link to comment
    Share on other sites

    Jan is this simular?

    The first error with GV $WCD

    the GV is created in an other scene

    Now I see with remote something the same but its your shot just to inform you as much as possible.

    Please login or register to see this attachment.

    The remote is transfered but NOT triggered!

    In this scene there is this rule no trigger no action

    rule("#opStaan => post(#stekkersAan); log('TRIGGER:%s',tjson(env.event)); log('violet','#stekkersAan - post'); log('violet','#opStaan - post')")

     

    Or also a possibility I do something wrong?

    //Sjakie

    Link to comment
    Share on other sites

    7 hours ago, Earybeongbeong7 said:

     

    The Dimmer has the "sceneActivationEvent" active and is being used for scene automation(HC3).

    Could there be any difference in the Dimmer properties?

    It is currently a property as a toggle device.

     

     

    Sorry.  I entered the wrong device ID.  The scene of Dimmer(S1.double) works in ER.

    • Like 1
    Link to comment
    Share on other sites

  • Topic Author
  • A new version of EventRuner4 v05.fix3

    Unfortunately I had to do a lot of internal changes to accommodate what I learned about the HC3.... ;-)

    Unfortunately there is no new features, only possibilities for new bugs. However, the structure is more sound and it's a better base to work with so it was a necessary change.

    The "main file" looks almost the same but you need to download EventRunner4.fqa and install it fresh. Autoupdate will not work to this new version as the file structure is different. So copy your rules from the old "main file" and paste them into the new "main file".

     

    It's also possible to build EventRunner4 yourself with ZeroBrane and my emulator fibaroapiHC3.lua and the files directly from my GitHub.  If someone does, let me know and I can post a description. (Running offline is also an excellent way to test your rules before they go into "production"...)

     

    If you want to wait to upgrade it's ok as I expect many small updates in the coming days to fix new bugs introduced.

    Link to comment
    Share on other sites

    Jan,

    Thank you verry much for a better base.

    I just finished to split a lot of scenes to have a more conveniënt migration, part by part (27 scenes).

     

    update: post and remote did function after restart, wierd. The small debug screen was empthy by some scenes I modified so I did  a restart. 

    For  the GV I did not see it again but I am worried.

    //Sjakie

     

    Link to comment
    Share on other sites

  • Topic Author
  • On 8/5/2020 at 5:50 PM, Sjakie said:

    Sorry Jan, I should have seen it by myself.

    How can I:

    - get more color in Debug as in ER3?

    Rule.eval("log3('lightgreen','OPSTAAN EN BEDTIJD')")

    - not to get in debug:

    [false]>>'Rule:13[toilet.door:breached => log('door toilet - geopend')]'

    Thanks in advance,

    //Sjakie

     

    It's different from the HC2. It should look something like this

    Please login or register to see this code.

     

    • Thanks 1
    Link to comment
    Share on other sites

    Hello?

    The update is complete (ZBS, ER4 & all toolbox)

    Now the Incoming trigger content comes out.

     

    However, when you click the button, there is no response and you can see the following debug.

     

    [WARNING] [QUICKAPP442]: UI callback for element:debugTriggernot found.

    [WARNING] [QUICKAPP442]: UI callback for element:debugRulenot found.

     

    And

     

    rule("@{catch,05:00} => Util.checkForUpdates()")
    rule("#File_update{} => log('New file version:%s - %s',env.event.file,env.event.version)")
    rule("#File_update{} => Util.updateFile(env.event.file)")

     

    What updates are you checking for? (every 5 hours?)

    Do you check for updates to the ER4 toolbox and engine files?

    If there is an update when checking, will it be automatically updated?

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 6 minutes ago, Earybeongbeong7 said:

    Hello?

    The update is complete (ZBS, ER4 & all toolbox)

    Now the Incoming trigger content comes out.

     

    However, when you click the button, there is no response and you can see the following debug.

     

    [WARNING] [QUICKAPP442]: UI callback for element:debugTriggernot found.

    [WARNING] [QUICKAPP442]: UI callback for element:debugRulenot found.

     

    And

     

    rule("@{catch,05:00} => Util.checkForUpdates()")
    rule("#File_update{} => log('New file version:%s - %s',env.event.file,env.event.version)")
    rule("#File_update{} => Util.updateFile(env.event.file)")

     

    What updates are you checking for? (every 5 hours?)

    Do you check for updates to the ER4 toolbox and engine files?

    If there is an update when checking, will it be automatically updated?

    Please login or register to see this attachment.

     

    I thought the debug buttons worked now - will check again. However, you can set the _debugFlags.X now in main file.

     

    The update check runs every morning at 05:00 (and when you start the scene). You can uncomment the rule("#File_update{} => Util.updateFile(env.event.file)") so it doesn't update automatically. (I should have commented out that line but it was left from my testing)

    It will only check the version number of EventRunner4 (the engine) and replace all files if there is a newer version. It may cause multiple restarts of the QA in some cases, but normally there should only be one as I try to update all files with one api call.

     

    I have not pushed the latest fibaroapiHC3.lua yet (ZBS) but ER4 should work with the latest.

    Edited by jgab
    Link to comment
    Share on other sites

    16 minutes ago, jgab said:

     

    I thought the debug buttons worked now - will check again. However, you can set the _debugFlags.X now in main file.

     

    The update check runs every morning at 05:00 (and when you start the scene). You can uncomment the rule("#File_update{} => Util.updateFile(env.event.file)") so it doesn't update automatically. (I should have commented out that line but it was left from my testing)

    It will only check the version number of EventRunner4 (the engine) and replace all files if there is a newer version. It may cause multiple restarts of the QA in some cases, but normally there should only be one as I try to update all files with one api call.

     

    I have not pushed the latest fibaroapiHC3.lua yet (ZBS) but ER4 should work with the latest.

     

    Does "and when you start the scene" mean restarting the ER4 quick app?

    In other words, is the quick app restarting every 5 am?

    Link to comment
    Share on other sites

  • Topic Author
  • 6 minutes ago, Earybeongbeong7 said:

     

    Does "and when you start the scene" mean restarting the ER4 quick app?

    In other words, is the quick app restarting every 5 am?

    Yes when the QuickApp restarts - like when rules are added and QA saved.

    It only checks for updates at 05:00. If there is an update it updates and restart (if you have the update rule enabled) 

     

    You can also remove the ‘catch’ and it will only check at 05:00

    Edited by jgab
    Link to comment
    Share on other sites

    17 minutes ago, jgab said:

    Yes when the QuickApp restarts - like when rules are added and QA saved.

    It only checks for updates at 05:00. If there is an update it updates and restart (if you have the update rule enabled) 

     

    Thanks for the answer.


    Is'Catch' the meaning of checking the content behind and then saving and restarting the quick app?

     

    That is, rule("@{00:00,catch} => $WeekDay = weekdays[os.date('*t').wday]; log('Set GV into %s',$WeekDay)")

     

    Can we understand that os.date is saved in the global variable WeekDay at 00:00 and then reruns the quick app?

     

    I don't understand.

    If "Catch" is marked, is the automation performed every day at 05:00 am, and if "Catch" is removed, is the automation only performed once at 05:00 am, not every day?

    Or does it automate every 5 hours if "Catch" is removed?

     

    Finally

     

    Is the'Rule' for automatic update as follows?

     

    rule("@{catch,05:00} => Util.checkForUpdates()")

    rule("#File_update{} => log('New file version:%s - %s',env.event.file,env.event.version)")

    rule("#File_update{} => Util.updateFile(env.event.file)")

    Edited by Earybeongbeong7
    Link to comment
    Share on other sites

  • Topic Author
  • 13 minutes ago, Earybeongbeong7 said:

     

    Thanks for the answer.


    Is'Catch' the meaning of checking the content behind and then saving and restarting the quick app?

     

    That is, rule("@{00:00,catch} => $WeekDay = weekdays[os.date('*t').wday]; log('Set GV into %s',$WeekDay)")

     

    Can we understand that os.date is saved in the global variable WeekDay at 00:00 and then reruns the quick app?

     

    Finally

     

    Is the'Rule' for automatic update as follows?

     

    rule("@{catch,05:00} => Util.checkForUpdates()")

    rule("#File_update{} => log('New file version:%s - %s',env.event.file,env.event.version)")

    rule("#File_update{} => Util.updateFile(env.event.file)")

     

    So time rules are of type 

    @<time> => <actions>

    @{<list of times>} => <actions>

    Ex.

    @10:00 => log('Its 10:00 now')

    @{10:00,15:00} => waterFlowers() -- Water flowers at 10:00 and 15:00

     

    The meaning of the 'catch' (catchup) keyword for time rules is to run the rule once immediately when the rule is defined and if the time has passed

    So

    @{catch,10:00} => log('Now or 10:00')

    will run the rule when it's defined if time has passed 10:00, otherwise it will wait to the next 10:00.

    The reason is that many 'time rules' you want to run when you save and restart the QA.

    In the case with the update, we do a check every time the QA is restarted (besides regular 05:00 check)

     

    Your weekday rule

    rule("@{00:00,catch} => $WeekDay = weekdays[os.date('*t').wday]; log('Set GV into %s',$WeekDay)")

    will set the global every night at 00:00, and it will also run and set the global when you restart the QA (ex. re-save it)

    It's no problem to set a global to the same value over again, as it only generates triggers if the value changes.

     

     

     

    Edited by jgab
    Link to comment
    Share on other sites

    6 minutes ago, jgab said:

     

    So time rules are of type 

    @<time> => <actions>

    @{<list of times>} => <actions>

    Ex.

    @10:00 => log('Its 10:00 now')

    @{10:00,15:00} => waterFlowers() -- Water flowers at 10:00 and 15:00

     

    The meaning of the 'catch' (catchup) keyword for time rules is to run the rule once immediately when the rule is defined and if the time has passed

    So

    @{catch,10:00} => log('Now or 10:00')

    will run the rule when it's defined if time has passed 10:00, otherwise it will wait to the next 10:00.

    The reason is that many 'time rules' you want to run when you save and restart the QA.

    In the case with the update, we do a check every time the QA is restarted (besides regular 05:00 check)

     

    Your weekday rule

    rule("@{00:00,catch} => $WeekDay = weekdays[os.date('*t').wday]; log('Set GV into %s',$WeekDay)")

    will set the global every night at 00:00, and it will also run and set the global when you restart the QA (ex. re-save it)

    It's no problem to set a global to the same value over again, as it only generates triggers if the value changes.

     

     

     

     


    Now I understand.

    Thank you very much for the kind explanation.

    Link to comment
    Share on other sites

  • Topic Author
  • A note. The function rule() (or Rule.eval()) returns a 'handler' to the rule that has 2 functions. enable() and disable()

    Ex. define a rule that is enabled/disabled by other rules.

    Please login or register to see this code.

    This specific example may not be so useful but you easily enable and disable sets of rules depending on time of year etc.

     

    If you have a rule that should do something every 5min between 12-15 this can be a way to define it

    Please login or register to see this code.

     

    Another way to do the limited 5min pings is to use the general date test - similar to the cron/date test in HC3 scenes.

    Please login or register to see this code.

     

    Edited by jgab
    Link to comment
    Share on other sites

    Jan,

    Is it me?

    I noticed after update that debug window doest refresh?

    Not even your Tick Tock show up

    Please login or register to see this attachment.

     

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, Sjakie said:

    Jan,

    Is it me?

    I noticed after update that debug window doest refresh?

    Not even your Tick Tock show up

    Please login or register to see this attachment.

     

     

     

    Did you reinstall the whole QA (fqa)?. Auto-updates doesn't work.

    Link to comment
    Share on other sites

    Yes Jan I did a fresh down load and redid almost all my ER scenes.

    After restart HC3 normal Debug.

    New thing

    Please login or register to see this attachment.

    This debug doest give enough data to find easely what where is wrong?

    ID 398 >present scene

    Trigger is incomming dont know from what scene >> I need to search for it. Can trigger scene ID added?

    Thanks,

    // Sjakie

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