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
    7 minutes ago, Neo Andersson said:

    @jgab

    Jan, after several hours of hair tearing, i have found, why the brightness control doesnt work.

    I am showing here a simplified version of my rule, but the logic is the same

    This rule is intended to check after LED turn on, if its value is not by accident on 0, and if so, it should set some brightness to it.

    Please login or register to see this code.

     

    However, this will always run..because when led1 gets ON in the rule right side its value will be still 0, no matter what i do...I could add there a wait statement, jsut to give it some time, but it doesn't matter. led1 value is always 0 after its turned on. So this is impossible.

    I have checked in other QA with a simple hub.getValue(led1, "value") and it returned the correct non zero value.

     

    So this evetually crosses all my efforts to somehow check on the leds value when it gets turned on. 

     

     

    There is something else going on here...

    rule("led1:isOn => || led1:value == 0 >> led1:value = 30 ")

     

    led1:isOn only triggers (and is true) when the led1's value property is > 0

    So this could not trigger and also have  led1:value == 0

     

    Is this an fibaro rgb puck?

    How does the device struct look like for it?

    Posted
    2 minutes ago, jgab said:

     

    There is something else going on here...

    rule("led1:isOn => || led1:value == 0 >> led1:value = 30 ")

     

    led1:isOn only triggers (and is true) when the led1's value property is > 0

    So this could not trigger and also have  led1:value == 0

     

    Is this an fibaro rgb puck?

    How does the device struct look like for it?

    Please login or register to see this code.

     

    Posted (edited)
    29 minutes ago, Neo Andersson said:

    Please login or register to see this code.

     

    @jgab Jan, forget about it, i need to find some other way, to check on brightness..I know where is this issue coming now.

    Elemenst in table, switches and LEds are back and forth switching on each other, and it happens probably so quickly that my rule gets the false values always..

    And all this stuff i need to control just because fibaros RGBW modul sometimes randomly drops brightness, and user tries to turn on the led but it doesnt react, so they need to manually set back the brightness..

    Ohh man...thanks for all the helps, i will think further about it..

    Edited by Neo Andersson
    Posted

    @jgab Jan, if a rule contains non-existing device, the error will trigger only when that rule triggers, or will it trigger after QA start?

  • Topic Author
  • Posted
    11 minutes ago, Neo Andersson said:

    @jgab Jan, if a rule contains non-existing device, the error will trigger only when that rule triggers, or will it trigger after QA start?

    Depends.

    rule("lamp=8888") -- non existing device

    rule("lamp:isOn => log('ok')") -- Will not generate an error and never trigger

     

    rule("lamp=nil") -- undefined variable

    rule("lamp:isOn => => log('ok')") -- Will generate error at startup as lamp is nil

    Posted
    12 hours ago, jgab said:

    There is something else going on here...

    rule("led1:isOn => || led1:value == 0 >> led1:value = 30 ")

     

    led1:isOn only triggers (and is true) when the led1's value property is > 0

    So this could not trigger and also have  led1:value == 0

    @jgab Jan, well this is not completely true.. That is the reason i am hunting a solution..

    RGBW modules can send you a TRUE state while their value is 0...Exaclty this is the reason why i need to find some solution.

    Sometimes user turn on the rgbw, it show on its icon that it is ON, however the LED does not light up, because its brightness is on 0..

    I think this is some bug in fibaro, but we cant wait until they fix it, so thats why i need the solution.

     

    So after hub.call(led,"turnOn") i need to check if its value gets to >0 otehrwise i have to set some value..However, if I do

    Please login or register to see this code.

    this always shows 0, but if a put there a seTtimeout

     

    Please login or register to see this code.

    this shows the led's value

    See the test on picture

     

    Please login or register to see this image.

    /monthly_2024_01/image.png.a322ba715d484e524d50a38b214a7896.png" />

    This goes for your rules too.

     

     

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

    @jgab Jan, well this is not completely true.. That is the reason i am hunting a solution..

    RGBW modules can send you a TRUE state while their value is 0...Exaclty this is the reason why i need to find some solution.

    Sometimes user turn on the rgbw, it show on its icon that it is ON, however the LED does not light up, because its brightness is on 0..

    I think this is some bug in fibaro, but we cant wait until they fix it, so thats why i need the solution.

     

    So after hub.call(led,"turnOn") i need to check if its value gets to >0 otehrwise i have to set some value..However, if I do

    Please login or register to see this code.

    this always shows 0, but if a put there a seTtimeout

     

    Please login or register to see this code.

    this shows the led's value

    See the test on picture

     

    Please login or register to see this link.

    This goes for your rules too.

     

     

     

    Yes the rule commands, like led:isOn etc always fetch latest value with fibaro.getValue.

    There can be a delay between calling turnOn and the value being reported back correctly with fibaro.getValue I guess...

     

    But

    rule("led1:isOn => || led1:value == 0 >> led1:value = 30 ")

     

    is translated to
     

    Please login or register to see this code.

     

    and it makes no sense that you would get to the inner setValue.

     

    could it be that RGB modules use the 'state' property (boolean) to signal on/off and 'value' property for the brightness?

    So it can be 0 brightness ('value'=0) but still on ('state' = true)

    Edited by jgab
    Posted

    Please login or register to see this code.

     

    Setup time looks good

    11 seconds is high! Have seen also 7 seconds

    fw 5.150.18

    mem 86% in use 14% free

    CPU 4-50%

    ER5 v1.0

     

    • Like 1
    Posted
    6 hours ago, jgab said:

     

    Yes the rule commands, like led:isOn etc always fetch latest value with fibaro.getValue.

    There can be a delay between calling turnOn and the value being reported back correctly with fibaro.getValue I guess...

     

    But

    rule("led1:isOn => || led1:value == 0 >> led1:value = 30 ")

     

    is translated to
     

    Please login or register to see this code.

     

    and it makes no sense that you would get to the inner setValue.

     

    could it be that RGB modules use the 'state' property (boolean) to signal on/off and 'value' property for the brightness?

    So it can be 0 brightness ('value'=0) but still on ('state' = true)

    Haven't checked the state so far..good idea

    Posted (edited)
    17 minutes ago, Neo Andersson said:

    Haven't checked the state so far..good idea

    @jgab Jan how to catch device state.

    Please login or register to see this code.

    This doesn't work for me

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

    @jgab Jan how to catch device state.

    Please login or register to see this code.

    This doesn't work for me

    does the device have a boolean state property?
    If so it's returned with <ID>:state

    to use as a trigger the device needs to emit the property state changed event. If you look at /refresh console logs do you see it?

    Posted
    1 minute ago, jgab said:

    does the device have a boolean state property?
    If so it's returned with <ID>:state

    to use as a trigger the device needs to emit the property state changed event. If you look at /refresh console logs do you see it?

    Yes, it is working with id:state, but doesnt work with id:state == true...this is not a correct trigger?

    Posted (edited)
    7 hours ago, jgab said:

     

    Yes the rule commands, like led:isOn etc always fetch latest value with fibaro.getValue.

    There can be a delay between calling turnOn and the value being reported back correctly with fibaro.getValue I guess...

     

    But

    rule("led1:isOn => || led1:value == 0 >> led1:value = 30 ")

     

    is translated to
     

    Please login or register to see this code.

     

    and it makes no sense that you would get to the inner setValue.

     

    could it be that RGB modules use the 'state' property (boolean) to signal on/off and 'value' property for the brightness?

    So it can be 0 brightness ('value'=0) but still on ('state' = true)

    @jgab Jan, i was able to reproduce the situation, when LED is turned on, state is true, value is 99 but the LED still does not glow. !!!!!!!!!!!!!!!!!!!!!!!!

     

    Please login or register to see this image.

    /monthly_2024_01/image.png.68a2dbd6907b8de17946e2bbe8814123.png" />

     

     

    It turned out / as i thought / that it is due to the warmwhite color component.

    Doesnt matter if the device supports warm white or not, if it is on 0 the bulb is dead.

    Doesn't matter what color user selects, the led is not turning on.

    So, please, can you help me to check if colorComponent "warWhite" is not 0 in a rule?

     

    Edited by Neo Andersson
    Posted
    18 minutes ago, Neo Andersson said:

    @jgab Jan, i was able to reproduce the situation, when LED is turned on, state is true, value is 99 but the LED still does not glow. !!!!!!!!!!!!!!!!!!!!!!!!

     

    Please login or register to see this link.

     

     

    It turned out / as i thought / that it is due to the warmwhite color component.

    Doesnt matter if the device supports warm white or not, if it is on 0 the bulb is dead.

    Doesn't matter what color user selects, the led is not turning on.

    So, please, can you help me to check if colorComponent "warWhite" is not 0 in a rule?

    EDIT

    Okay, it is happening only with LEDs that are not colored but connected to RGBW modul..So a little too early celebrations...

     

    18 minutes ago, Neo Andersson said:

     

     

    Posted

    @jgab Jan how to do the ELSE statement in || >> ? How would the example below look like?

    Please login or register to see this code.

     

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

    @jgab Jan how to do the ELSE statement in || >> ? How would the example below look like?

    Please login or register to see this code.

     

    Please login or register to see this code.

     

    13 hours ago, Neo Andersson said:

    Yes, it is working with id:state, but doesnt work with id:state == true...this is not a correct trigger?

    Please elaborate. 

    id:state retturn a boolean?

    ...but it doesn't trigger the rule?

    Do you see a refresh log with when property 'state' change?

    Can you post the whole device struct? Is the device a FGRGBW-442 ?

    Edited by jgab
    Posted (edited)

    Hei Jan

    I would like to add consumption per week and per month in the Gascounter list.

    So my thoughts would be to ADD

        || wday('sun') >> today.weekly = today.total - gc[7].total end;
        || day('last') >> today.monthly = today.total - gc[30].total end;

    in the Rule.

    Im not sure how to test it ? - can you tell if its the right path?

    Also this one "gc[30].total end;" should be dynamic days count per month and not hardcoded 30 days. 

     

     

    Please login or register to see this code.

     

    Edited by ChristianSogaard
    Typo
    Posted (edited)
    1 hour ago, ChristianSogaard said:

    Hei Jan

    I would like to add consumption per week and per month in the Gascounter list.

    So my thoughts would be to ADD

        || wday('sun') >> today.weekly = today.total - gc[7].total end;
        || day('last') >> today.monthly = today.total - gc[30].total end;

    in the Rule.

    Im not sure how to test it ? - can you tell if its the right path?

    Also this one "gc[30].total end;" should be dynamic days count per month and not hardcoded 30 days. 

     

     

    Please login or register to see this code.

     


    Hei Jan

     

    Can i use wday at the action side ?

    else i am working on this

    Please login or register to see this code.

     

    Edited by ChristianSogaard
    Typo
  • Topic Author
  • Posted (edited)

    Well, it's not sure you have 7 entries in the table for the weekly (not when you start up)

    Secondly,

    || sunday >> ... || lastDayofMonth >> ...

    will choose one of them so you can't have Sunday on the last day of month...

     

    To get the week you want to subtract last weeks Sunday from today's Sunday's total, so an offset of 8.

     

    I don't think you need the variables sunday and lastDayofmonth (can be problematic if you restart the QA)

     

    Please login or register to see this code.

     

    I think this will work.

    dayNum is the day number, like 31.

    If it's the last day in month and there are more than dayNum entries  in the gc table the first day of the month should be in gc[dayNum], and the last day of the month before should be in gc[dayNum+1]

    Edited by jgab
    • Thanks 1
    Posted (edited)
    12 minutes ago, jgab said:

    Well, it's not sure you have 7 entries in the table for the weekly (not when you start up)

    Secondly,

    || sunday >> ... || lastDayofMonth >> ...

    will choose one of them so you can't have Sunday on the last day of month...

     

    To get the week you want to subtract last weeks Sunday from today's Sunday's total, so an offset of 8.

     

    I don't think you need the variables sunday and lastDayofmonth (can be problematic if you restart the QA)

    Please login or register to see this code.

    I think this will work.

    dayNum is the day number, like 31.

    If it's the last day in month and there are more than dayNum entries  in the gc table the first day of the month should be in gc[dayNum], and the last day of the month before should be in gc[dayNum+1]

    Is something missing like if wday('last)??

    and a attempt to index a nil value (local 'sub') 

    [03.01.2024] [14:47:10] [ERROR] [QUICKAPP2136]: Rule setup error(s) - fix & restart...
    [03.01.2024] [14:47:10] [ERROR] [QUICKAPP2136]: Last err: [Rule:5:@23:59:55 => local gc = $GasCounter; local today = {date=osdate("%Y-%m-%d"), total=GAS_ID:value}; local dayNum = osdate('*t').day; table.insert(gc,1,today); if gc[2] then today.daily = today.total -..] Parser: ./include/parser.lua:201: attempt to index a nil value (local 'sub') if wday('sun') & gc[] then today.weekly = today.total - gc[].total & gc[dayNum+1] today.monthly = today.total - gc[dayNum+1].total end; ^

    Edited by ChristianSogaard
    Typo

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