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

Posted

@ChristianSogaard your gascounter looks very nice can you please send me the QA?

Posted
8 minutes ago, Sjakie said:

@ChristianSogaard your gascounter looks very nice can you please send me the QA?

Im using this, to count the Pulses - with a reed switch .

Please login or register to see this link.

Please login or register to see this link.

 

Please login or register to see this image.

/monthly_2024_01/image.png.ebd326463944abf42dbc822a476afe07.png" />

image.png.6ea6e84628746d32a6f1883267b0dbcd.png

and Eventrunner 5, with these rules
 

Please login or register to see this code.

 

Posted
23 hours ago, jgab said:

Do

Please login or register to see this code.

and see if it works

 

It worked. Sorry for posting something with such a basic mistake... 😕

 

Also, about logging - any reason why something like this shouldn't work?

 

Please login or register to see this code.

 

 

  • Topic Author
  • Posted
    1 hour ago, ChristianSogaard said:

    Hi Jan
    would you teach me to do the round ?
     

    So, fmt (or string.format) only rounds the string produced - it leaves the actual value unchanged.

    It's not this rule that stores the values in the table. Its when daily is calculated-

    In fact this rule tries to set the value property of gas_id to the rounded string value. does that work?

     

    In any case, in the table you should store the value with as high precision as you calculate weekly and monthly with those values. Only when you want to display the value you convey it to a string with the rounded precision.

    So if gas_id has a number value prop that is displayed you need to round the number - and not to a string.

    Please login or register to see this code.

    this rounds the significant numbers. however, the qa can still choose to present it visually as 8.9600000

    • Thanks 1
  • Topic Author
  • Posted
    44 minutes ago, bonhomme said:

     

    It worked. Sorry for posting something with such a basic mistake... 😕

     

    Also, about logging - any reason why something like this shouldn't work?

     

    Please login or register to see this code.

     

     

    difficult to say... when set to broadcast shouldn't the ip be '255.255.255.255'?

    Posted (edited)
    43 minutes ago, jgab said:

    difficult to say... when set to broadcast shouldn't the ip be '255.255.255.255'?

    Hmm! From a theory perspective, I think that setting broadcast=true with a fixed IP is probably not the right thing to do (although it should actually probably be a narrower subnet - e.g. 192.168.68.255). 

     

    However, I think setting it to a specific IP is also technically valid. 

     

    Well, for context I should say the udpsend function works if called explicitly 

     

    Please login or register to see this code.

     

    This posts the message to syslog

     

    Please login or register to see this code.

     

    It works whether broadcast is set to true or false.

     

    It's the wrapping of the log function that doesn't seem to work... 

    Edited by bonhomme
  • Topic Author
  • Posted
    32 minutes ago, bonhomme said:

    Hmm! From a theory perspective, I think that setting broadcast=true with a fixed IP is probably not the right thing to do (although it should actually probably be a narrower subnet - e.g. 192.168.68.255). 

     

    However, I think setting it to a specific IP is also technically valid. 

     

    Well, for context I should say the udpsend function works if called explicitly 

     

    Please login or register to see this code.

     

    This posts the message to syslog

     

    Please login or register to see this code.

     

    It works whether broadcast is set to true or false.

     

    It's the wrapping of the log function that doesn't seem to work... 

    Ok I was looking at the wrong place ;-) 

     

    in ER, 'log' is not bound to a Lua function, like in lua. It's really a "built-in" instruction....

     

    However, there is the possibility to define a custom userLog handler that is called by 'log' when it prints out the result.

    Please login or register to see this code.

     

    You need to in the lower half of the main file delete the existing version of er.settings.userLogFunction

    • Thanks 1
    Posted

    @jgab Jan,after upgrading main file to v1.3, i noticed that i dont see the ER tag in debug window. Only the QA tag is there. Which ER variable should i enable to see them?

  • Topic Author
  • Posted (edited)

    in v1.03 all messages are logged under QUICKAPP<ID> per default. To get back the old behaviour

    set

    Please login or register to see this code.

    in main. It's commented out now. It's was too confusing to newcomers (and myself sometimes ;-) )

    Edited by jgab
    • Thanks 1
    Posted (edited)

    @jgab Did you implement onIfOff() or offIfOn() for ER5 ?

     

    Do you feel for single events (not hundreds at once) that it simply isn't needed?

     

    (related to discussion

    )

    Edited by gurpal2000
  • Topic Author
  • Posted
    20 minutes ago, gurpal2000 said:

    @jgab Did you implement onIfOff() or offIfOn() for ER5 ?

     

    Do you feel for single events (not hundreds at once) that it simply isn't needed?

     

    (related to discussion

    )

    No, for tens at once...

    Haven't implemented them, you can add them yourself

    Please login or register to see this code.

    You can also use

    rule("66:isOn & 66:off")

    • Like 1
    Posted
    On 11/4/2023 at 2:41 PM, jgab said:

    Ex.

    Please login or register to see this code.

    This creates a function that waits for an event before returning true.

    Then we can do

    Please login or register to see this code.

    @jgab Jan may i ask for a bit of explanation here?

     

    you define the waitFor with 3 arguments, first is the callback, second is the event itself, and third is the timeout

    However when you call it, you never define the callback  waitFor(#device{id=sensor2,value=true},10). Here we have the event and timeout arguments..

    Where is the cb defined? How does it know what functions should it pass the waitFor function's result to? Or have i completely misunderstood the basics?

    Posted
    On 11/6/2023 at 1:29 PM, jgab said:

    <list>:QV
    Given a list of strings will return a list of quickApp variable objects

    Please login or register to see this code.

    will return a list of the values of quickApp variables var1,var2,var3
     

     

    You have typo here. It should be QV in the example i think

    • Thanks 1
  • Topic Author
  • Posted
    8 minutes ago, Neo Andersson said:

    @jgab Jan may i ask for a bit of explanation here?

     

    you define the waitFor with 3 arguments, first is the callback, second is the event itself, and third is the timeout

    However when you call it, you never define the callback  waitFor(#device{id=sensor2,value=true},10). Here we have the event and timeout arguments..

    Where is the cb defined? How does it know what functions should it pass the waitFor function's result to? Or have i completely misunderstood the basics?

    When we define our function with

    Please login or register to see this code.

    It will be provided inside rules for users as a function

    Please login or register to see this code.

    However, when ER calls the function it adds an extra callback function as first argument

    telling the function, please call me back when you are finished, I will continue to run other rules and timers meanwhile...

    When the function does the callback, ER will return that value from the function (waitFor in this case) and the rule will continue to run.

     

    In the example, waitFor sets up an event handler for the event and when it gets the event it returns true.

    Looking at the example now I think it should be coded a bit different...

    fibaro.removeEvent only takes h as argument

    Please login or register to see this code.

    Also, now it times out and just kills the running rule (a timeout kills the rule) - should probably setup a timer and return false.

    • Thanks 1
    Posted
    On 1/15/2024 at 1:10 AM, jgab said:

    Ok I was looking at the wrong place ;-) 

     

    in ER, 'log' is not bound to a Lua function, like in lua. It's really a "built-in" instruction....

     

    However, there is the possibility to define a custom userLog handler that is called by 'log' when it prints out the result.

    Please login or register to see this code.

     

    You need to in the lower half of the main file delete the existing version of er.settings.userLogFunction

     

    Thanks, this makes sense. I've added a udpsend just above all the colour substitution in the existing one, so that it first sends the plain string, and then does all the colour formatting:

    Please login or register to see this code.

     

    However, there is still some logging that comes through as yellow in the console and with yellow colour tags in the syslog message

     

    Please login or register to see this code.

     

    It seems that this is being added somewhere upstream of that userLogFunction? I don't mind the colour coding in the console, actually it is quite helpful - so is the best play to try to catch this upstream colour tagging or to modify my udpsend to strip HTML? I don't know how hard that first option is going to be... 

  • Topic Author
  • Posted
    6 hours ago, bonhomme said:

    However, there is still some logging that comes through as yellow in the console and with yellow colour tags in th

    It seems that this is being added somewhere upstream of that userLogFunction? I don't mind the colour coding in the console, actually it is quite helpful - so is the best play to try to catch this upstream colour tagging or to modify my udpsend to strip HTML? I don't know how hard that first option is going to be... 

     

    Yes, it's the option to color the whole rule output

    rule(".....",{ userLogColor='yellow' })

    The #C is kind of a hack for custom output...

     

    Please login or register to see this code.

     

    Please login or register to see this code.

    • Thanks 1
    Posted
    2 hours ago, jgab said:

     

    Yes, it's the option to color the whole rule output

    rule(".....",{ userLogColor='yellow' })

    The #C is kind of a hack for custom output...

     

    Please login or register to see this code.

     

    Please login or register to see this code.

    Beautiful solution as always. Thank you! Your apps completely change the game on the usefulness and power of HC3... 

  • Topic Author
  • Posted (edited)
    14 minutes ago, bonhomme said:

    Beautiful solution as always. Thank you! Your apps completely change the game on the usefulness and power of HC3... 

    You only get user logs this way - not error messages and other stuff.

    If you want to capture everything in the log for the QA you can intercept __fibaro_add_debug_message that is used by all console log output functions (or just filter out error messages)

     

    Please login or register to see this code.

    Here I add the type tag infant of the message (debug,trace,error,warning)

    Edited by jgab

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