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
  • Posted
    Just now, ChristianSogaard said:

    I have a lot of rule like this - i guess i can convert them to the new format ?   

    rule("matrix_Kitchen_Bottom:central.keyId==4 & matrix_Kitchen_Bottom:central.keyAttribute=='Pressed' => {1980,1981}:close")

    Yes, the :key property will be built in from next version. (v0.32 later this evening)

    • Like 1
    Posted
    4 minutes ago, jgab said:

    Yes, the :key property will be built in from next version. (v0.32 later this evening)

    Really cool, thank you Jan

    Please remember the rule("uptimeMinutes < 5 => post(#HC3_restart)") you mentioned earlier, i dont work for me yet

    Please login or register to see this link.

     

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

    Really cool, thank you Jan

    Please remember the rule("uptimeMinutes < 5 => post(#HC3_restart)") you mentioned earlier, i dont work for me yet

    Please login or register to see this link.

     

    Ah, sorry it's not a rule (no =>), just a test that is run when the rules are loaded. I changed the original post too.

    rule("uptimeMinutes < 5 & post(#HC3_restart)") --  If less than 5 minutes uptime, assume that we restarted.

    • Thanks 1
    Posted
    2 hours ago, jgab said:

    Please login or register to see this code.

    @jgab

     

    1. Jan where should we place these functions definitions above for user defined properties? Right into Main function?

     

     

    2.  The keyppress event handling not fully clear to me.  I think simplifying this keypress handling is one of the most anticipated features in ER5. At least for me. So this is for me kinda magic solution. My customers are usin 12 button remote controllers , each button 3 different functionalites..errr...

    However, i don't know, should we wait for the version upgrade, and it will contain this feature kinda inbuilt, or we should use the syntax anyway from your example (below),

     

    So just define like this

    Please login or register to see this code.

     then use it like

    Please login or register to see this code.

    i mean wil there be any difference in usage in the new version, or we will use this anyway this way?

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

    @jgab

     

    1. Jan where should we place these functions definitions above for user defined properties? Right into Main function?

     

     

    2.  The keyppress event handling not fully clear to me.  I think simplifying this keypress handling is one of the most anticipated features in ER5. At least for me. So this is for me kinda magic solution. My customers are usin 12 button remote controllers , each button 3 different functionalites..errr...

    However, i don't know, should we wait for the version upgrade, and it will contain this feature kinda inbuilt, or we should use the syntax anyway from your example (below),

     

    So just define like this

    Please login or register to see this code.

     then use it like

    Please login or register to see this code.

    i mean wil there be any difference in usage in the new version, or we will use this anyway this way?

    Ok, I pushed v0.32 of ER5 now with :key

     

    If you know exactly key and attribute you use standard equal '==' e.g. 2 equal signs

    Please login or register to see this code.

    and :key returns a string so you compare against "2:heldDown"

    You can also pattern match against the string using '===' e.g. 3 equal signs

    Please login or register to see this code.

    matches any key attribute for key 2

     

    However, there is one more trick. You can further index :key with .id and .attr to get the values

    rule("1526:key === '2:.*' => log('Key %s and attribute %s', 1526:key.id, 1526:key.attr)")

     

    or we can do 

    Please login or register to see this code.

    etc etc.

    • Thanks 1
    Posted (edited)
    1 hour ago, jgab said:

    Ok, I pushed v0.32 of ER5 now with :key

     

    If you know exactly key and attribute you use standard equal '==' e.g. 2 equal signs

    Please login or register to see this code.

    and :key returns a string so you compare against "2:heldDown"

    You can also pattern match against the string using '===' e.g. 3 equal signs

    Please login or register to see this code.

    matches any key attribute for key 2

     

    However, there is one more trick. You can further index :key with .id and .attr to get the values

    rule("1526:key === '2:.*' => log('Key %s and attribute %s', 1526:key.id, 1526:key.attr)")

     

    or we can do 

    Please login or register to see this code.

    etc etc.

    Can i change these rules to one rule?

    like...

     

    rule([[matrix_SiljeV:key == ???

    || 1:Pressed' => 1026:toggle")
    || 1:HeldDown' => {1026,1276,1275}:off")
    || 2:HeldDown' => {1026,1276,1275}:off")
    || '2:Pressed' => {1026,1276,1275}:on")

     

     

    Please login or register to see this code.

     

    Edited by ChristianSogaard
    Typo
    Posted
    1 hour ago, jgab said:

    Please login or register to see this code.

    Jan, it seems that it doesn't work if device is a table..like 

    Please login or register to see this code.

    then i have tried with single device, still doesn't work for me.

    Please login or register to see this attachment.

    Posted
    21 minutes ago, Neo Andersson said:

    Jan, it seems that it doesn't work if device is a table..like 

    Please login or register to see this code.

    then i have tried with single device, still doesn't work for me.

    Please login or register to see this attachment.

    How do you get this extended logging ?

    Posted
    5 minutes ago, ChristianSogaard said:

    How do you get this extended logging ?

    Please login or register to see this image.

    /monthly_2023_11/image.png.f2ef68516a0e327cd75f39949d316f98.png" />

     

    Posted
    1 minute ago, Neo Andersson said:

    Please login or register to see this link.

     

    Thanz - sry for not being more accurate

    the "triggered" line with red arrow - i dont see them in my logd

    Please login or register to see this attachment.

     

    Posted
    4 minutes ago, ChristianSogaard said:

    Thanz - sry for not being more accurate

    the "triggered" line with red arrow - i dont see them in my logd

    Please login or register to see this attachment.

     

    I did nothing just enabled both debug tag sa you see on my picture. Not only ER2648 that is the ER5 debug, but the QA debug itself. And this is my settings from ER5

     

         er.debug.ruleTrigger    = true -- log rules being triggered 
            er.debug.ruleTrue       = true  -- log rules with condition succeeding
            er.debug.ruleFalse      = true  -- log rules with condition failing
            er.debug.ruleResult     = false -- log results of rules running
            er.debug.evalResult     = true  -- log results of evaluations
            er.debug.post           = true  -- log events being posted
            er.debug.sourceTrigger  = false  -- log incoming sourceTriggers
            er.debug.refreshEvents  = false  -- log incoming refreshEvents
            
            -- Global settings
            er.settings.marshall       = true          -- autoconvert globalVariables values to numbers, booleans, tables when accessed
            er.settings.systemLogTag   = "ER"..self.id -- log tag for ER system messages, defaults to __TAG
            --er.settings.systemLogTag  = nil
            er.settings.ignoreInvisibleChars = false   -- Check code for invisible characters (xC2xA0) before evaluating
            er.settings.truncLog       = 100           -- truncation of log output
            er.settings.truncStr       = 80            -- truncation of log strings
    Posted
    14 minutes ago, Neo Andersson said:

    I did nothing just enabled both debug tag sa you see on my picture. Not only ER2648 that is the ER5 debug, but the QA debug itself. And this is my settings from ER5

     

         er.debug.ruleTrigger    = true -- log rules being triggered 
            er.debug.ruleTrue       = true  -- log rules with condition succeeding
            er.debug.ruleFalse      = true  -- log rules with condition failing
            er.debug.ruleResult     = false -- log results of rules running
            er.debug.evalResult     = true  -- log results of evaluations
            er.debug.post           = true  -- log events being posted
            er.debug.sourceTrigger  = false  -- log incoming sourceTriggers
            er.debug.refreshEvents  = false  -- log incoming refreshEvents
            
            -- Global settings
            er.settings.marshall       = true          -- autoconvert globalVariables values to numbers, booleans, tables when accessed
            er.settings.systemLogTag   = "ER"..self.id -- log tag for ER system messages, defaults to __TAG
            --er.settings.systemLogTag  = nil
            er.settings.ignoreInvisibleChars = false   -- Check code for invisible characters (xC2xA0) before evaluating
            er.settings.truncLog       = 100           -- truncation of log output
            er.settings.truncStr       = 80            -- truncation of log strings

    Thank you

    i used the updater and downloaded a new version of ER5 and the manually updated my main, there was a lot of differences. 

  • Topic Author
  • Posted
    9 hours ago, ChristianSogaard said:

    Can i change these rules to one rule?

    like...

     

    rule([[matrix_SiljeV:key == ???

    || 1:Pressed' => 1026:toggle")
    || 1:HeldDown' => {1026,1276,1275}:off")
    || 2:HeldDown' => {1026,1276,1275}:off")
    || '2:Pressed' => {1026,1276,1275}:on")

     

     

    Please login or register to see this code.

     

    You can do like

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    9 hours ago, Neo Andersson said:

    Jan, it seems that it doesn't work if device is a table..like 

    Please login or register to see this code.

    then i have tried with single device, still doesn't work for me.

    Please login or register to see this attachment.

    Yes, it didn't work with tables - I pushed v0.33 and now it does.

    Actually this is/was a problem in ER4 too.

    The problem was when we had a table like {id1, id2, id3} and we want to apply a :property function that only worked on a single id.

    The intuitive solution is that we should only apply the :property function to the id that triggered the rule.

    To pick that id out from the list we need another :property function. In ER4 it was called :dID but in ER5 it is called :id and will always need to be followed by some other :property method

    Please login or register to see this code.

    The first :id will return the fob that triggered the rule and then we apply :key on that fob returning the relevant key pressed

  • Topic Author
  • Posted
    8 hours ago, ChristianSogaard said:

    Thank you

    i used the updater and downloaded a new version of ER5 and the manually updated my main, there was a lot of differences. 

    Yes, main is still changing a bit... by Dec1 I hope main will be more stable.

    If I manage to release v1.0 by then I would recommend all to update their main manually...

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

    @jgab

    Please login or register to see this code.

    1. Jan where should we place these functions definitions above for user defined properties? Right into Main function?

     

    Yes you could. Or you could create a separate file u_myfuns

    where you setup your own stuff

    Please login or register to see this code.

     

    and then back in function QuickApp:main(er) you do

    SETUP(er) 

    somewhere in the beginning - before you start to create rules.

     

    You can use this approach to have a separate u_file where you define your rules outside main()

    @ChristianSogaard does something like that with all his rules.

    The important is just to pass the variable 'er' from QuickApp:main(er) to the other functions and in those functions setup the rule function etc.

    Please login or register to see this code.

    The drawback is that they need to be global to be accessible from the main file. One can limit the number of globals by having one global table with the functions

    Please login or register to see this code.

    and in main() do

    Please login or register to see this code.

     

    However, I'm thinking of building something like this into ER5...

    Edited by jgab
    • Like 2
    Posted
    2 hours ago, jgab said:

    Yes, it didn't work with tables - I pushed v0.33 and now it does.

    Jan, i dont have version 0.33 in updater

    Posted
    6 minutes ago, Neo Andersson said:

    Jan, i dont have version 0.33 in updater

    Please login or register to see this attachment.

    Just do a refresh

    Posted
    1 minute ago, ChristianSogaard said:

    Please login or register to see this attachment.

    Just do a refresh

    ohh sorry, i forgot, thanks

    Even after upgrade to 0.33 i am getting error when using table

     

    Please login or register to see this image.

    /monthly_2023_11/image.png.53684a46537bd4a082498c8aefde3644.png" />

     

    Please login or register to see this attachment.

    Posted
    6 minutes ago, Neo Andersson said:

    ohh sorry, i forgot, thanks

    Even after upgrade to 0.33 i am getting error when using table

     

    Please login or register to see this image.

    /monthly_2023_11/image.png.53684a46537bd4a082498c8aefde3644.png" />

     

    Please login or register to see this attachment.

    Okay, it turned out that one of the devices in table doesn't exits anymore. That was the problem. I have no clue why, but it doesn't exist in my syste. Interesting..:-)

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