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

    Please login or register to see this code.

    is a bad time constant. Do you mean 11:35?

    Posted
    2 hours ago, jgab said:

    Please login or register to see this code.

    is a bad time constant. Do you mean 11:35?

     

     

    Of course, my mistake. Sorry But now I'm getting a different error.

    Maybe another typo from me.

     

    Please login or register to see this code.

     

    [05/21/2024] [17:23:00] [ERROR] [QUICKAPP727]: [Rule:1:1]>> [Rule:1:@17:23 & wtable[osdate('%b%d')] => log('Its waste day')] Runtime: table is 'nil' for array reference @17:23 & wtable[osdate('%b%d')] => log('Its waste day')

     
     
     
     
  • Topic Author
  • Posted
    39 minutes ago, jwi said:
     

     

     

    Of course, my mistake. Sorry But now I'm getting a different error.

    Maybe another typo from me.

     

    Please login or register to see this code.

     

    [05/21/2024] [17:23:00] [ERROR] [QUICKAPP727]: [Rule:1:1]>> [Rule:1:@17:23 & wtable[osdate('%b%d')] => log('Its waste day')] Runtime: table is 'nil' for array reference @17:23 & wtable[osdate('%b%d')] => log('Its waste day')

    Month abbreviation is English.

    Mai -> May

    So,

    Please login or register to see this code.

     

    Posted
    17 minutes ago, jgab said:

    Month abbreviation is English.

    Mai -> May

    So,

    Please login or register to see this code.

     

     

    Yes, as I said, another typo on my part. I corrected it But the error is the same.

     

     

    [21.05.2024] [18:27:00] [ERROR] [QUICKAPP727]: [Rule:1:1]>> [Rule:1:@18:27 & wtable[osdate('%b%d')] => log('Its waste day')] Runtime: table is 'nil' for array reference
    @18:27 & wtable[osdate('%b%d')] => log('Its waste day')
                   ^
     
    Any hints?
  • Topic Author
  • Posted

    Ok, so it was my bug😉

    wtable should not be declared local. Rules can only access global lua variables.

    • Thanks 1
    Posted (edited)

    @jgab Jan, could you assist a bit here

     

    I need to create a custom ER5 toggle function similarly to 

     

    Please login or register to see this code.

     

    so i can call it in a rule,

    that can take a table, and will toggle regular switches normaly, and for multilevels (like RGBWs) it will set value to 0 or 50..

    The problem is there can be single swiches and multilevel switches in the same table that i want to call our customtoggle funtion on.

     

    can we define such a function

     

    In lua i would do it like this for 1 device.. I need this functionality in ER5 where dev can be a table..

     

    Thanks ahead

    Please login or register to see this code.

     

     

    so if i could do something like this ("...=> {1451, 1545}:customtoggle

    where 1451 is s binary switch and 1545 is an RGBW

     

    Thanks ahead

     

     

    UPDATE

    Okay i have managed to get it work, but probably there is more efficient way

     

    Please login or register to see this code.

     

    Edited by Neo Andersson
  • Topic Author
  • Posted
    4 hours ago, Neo Andersson said:

    @jgab Jan, could you assist a bit here

     

    I need to create a custom ER5 toggle function similarly to 

     

    Please login or register to see this code.

     

    so i can call it in a rule,

    that can take a table, and will toggle regular switches normaly, and for multilevels (like RGBWs) it will set value to 0 or 50..

    The problem is there can be single swiches and multilevel switches in the same table that i want to call our customtoggle funtion on.

     

    can we define such a function

     

    In lua i would do it like this for 1 device.. I need this functionality in ER5 where dev can be a table..

     

    Thanks ahead

    Please login or register to see this code.

     

     

    so if i could do something like this ("...=> {1451, 1545}:customtoggle

    where 1451 is s binary switch and 1545 is an RGBW

     

    Thanks ahead

     

     

    UPDATE

    Okay i have managed to get it work, but probably there is more efficient way

     

    Please login or register to see this code.

     

    Looks ok.

    Maybe cache the functions?

    Please login or register to see this code.

     

    • Thanks 1
    Posted

    @jgab Jan hello, i have a task, to do saome action on a aircondition unit when the measuered temperature is lower that a given value and time and month condition is matched

    So i created this one

     

    Please login or register to see this code.

     

     

    whats wrong with this?

     

    There are no errors so far, but it seems that this is not triggering

  • Topic Author
  • Posted

    Are you sure it's not triggering the rule at all?  :trigger is a synonym for :value but always return true. Is it the value property you need

    Note, that the rule only triggers when the Livingroom_AC_temp:value changes - not at startup. If you need that, add .start()

    You can add a log in the 'head' of the rule to (really) verify that it doesn't trigger.

    Please login or register to see this code.

     

    Posted (edited)
    33 minutes ago, jgab said:

    Are you sure it's not triggering the rule at all?  :trigger is a synonym for :value but always return true. Is it the value property you need

    Note, that the rule only triggers when the Livingroom_AC_temp:value changes - not at startup. If you need that, add .start()

    You can add a log in the 'head' of the rule to (really) verify that it doesn't trigger.

    Please login or register to see this code.

     

    @jgab Jan i have extended the code a bit, but it still has some errors..First it was complaining about the env.event.id is a nil value..so i have changed it to replace it by the exact device id that triggers the temp change..

    Also i need to check what is the actual mode of the AC so not set its mode if its already set, because it would beep all the time for the user...

    So now it sends some errors

     

    Please login or register to see this code.

     Last err: [Rule:23:Livingroom_AC_temp:trigger & month('may-sep') & 10:00..14:00 & (Livingroom_AC:..] Parser: unknown symbol at end of expression: badop Livingroom_AC_temp:trigger & month('may-sep') & 10:00..14:00 & (Livingroom_AC:thermostatMode != 'Cool') => || hub.getValue(Livingroom_AC_temp,'value') >= (24 + Livingroom_AC_Offset ) >> Livingroom_AC:thermostatMode = 'Cool'; wait(00:00:05);Livingroom_AC:coolingThermostatSetpoint = 22 ^^

    Edited by Neo Andersson
  • Topic Author
  • Posted
    On 5/29/2024 at 2:34 PM, Neo Andersson said:

    @jgab Jan i have extended the code a bit, but it still has some errors..First it was complaining about the env.event.id is a nil value..so i have changed it to replace it by the exact device id that triggers the temp change..

    Also i need to check what is the actual mode of the AC so not set its mode if its already set, because it would beep all the time for the user...

    So now it sends some errors

     

    Please login or register to see this code.

     Last err: [Rule:23:Livingroom_AC_temp:trigger & month('may-sep') & 10:00..14:00 & (Livingroom_AC:..] Parser: unknown symbol at end of expression: badop Livingroom_AC_temp:trigger & month('may-sep') & 10:00..14:00 & (Livingroom_AC:thermostatMode != 'Cool') => || hub.getValue(Livingroom_AC_temp,'value') >= (24 + Livingroom_AC_Offset ) >> Livingroom_AC:thermostatMode = 'Cool'; wait(00:00:05);Livingroom_AC:coolingThermostatSetpoint = 22 ^^

    != should be ~=, like in Lua

     

    The error message could also be better...

    Posted
    5 hours ago, jgab said:

    != should be ~=, like in Lua

     

    The error message could also be better...

    ohhh sorry mixing languages, thanks

    Posted

    @jgab Jan, am i doing something incorrectly here?

     

    Goal is, user coming home around 14:00 so he wants the system to check the room temperature and cool it down if its higher than 24. It should cool down to 22 then turn off cooling. All this should be applied only in may-oct period, and the controlling should start at 10:00 and keep until he arrives, so 14:00

     

    Please login or register to see this code.

     

    i am wondering, what will be the trigger in the first rule? Only the (Livingroom_AC_temp:value >= 24 part? Becaus it is not good.. Lets say it is 25 celisus there, but the temperature doesnt change anymore, so this part will not trigger the rule in this case right?

     

    So will the 10.:00..14:00 trigger at 10:00 ? probably not...its a conditiion i suppose..and so is the 'may-sep' part.. and the rest too

     

    So how to form this to be correct?

     

    I was also thinking, to set a simple rule that triggers at 10:00, checks the temprature, and act accordingly, but this is oncorrect too..because it will check at 10:00, adn will get that the temperature is 23, so it will do nothing..but then the temperature can raise, and reach 24 , but we will not start cooling, becuase trigger was at 10:00

     

    So i am a bit lost here..what would be a correct approach?

     

     

     

     

     

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

    @jgab Jan, am i doing something incorrectly here?

     

    Goal is, user coming home around 14:00 so he wants the system to check the room temperature and cool it down if its higher than 24. It should cool down to 22 then turn off cooling. All this should be applied only in may-oct period, and the controlling should start at 10:00 and keep until he arrives, so 14:00

     

    Please login or register to see this code.

     

    i am wondering, what will be the trigger in the first rule? Only the (Livingroom_AC_temp:value >= 24 part? Becaus it is not good.. Lets say it is 25 celisus there, but the temperature doesnt change anymore, so this part will not trigger the rule in this case right?

     

    So will the 10.:00..14:00 trigger at 10:00 ? probably not...its a conditiion i suppose..and so is the 'may-sep' part.. and the rest too

     

    So how to form this to be correct?

     

    I was also thinking, to set a simple rule that triggers at 10:00, checks the temprature, and act accordingly, but this is oncorrect too..because it will check at 10:00, adn will get that the temperature is 23, so it will do nothing..but then the temperature can raise, and reach 24 , but we will not start cooling, becuase trigger was at 10:00

     

    So i am a bit lost here..what would be a correct approach?

     

    Actually, the condition 10:00..14:00 will cause a trigger at 10:00 and at 14:00:01

    The reason is because of what you say.

    Ex

    rule("Lamp:isOn & 10:00..14:00 => ...")

    we want it to fire when the lamp is turned on between 10:00..14:00, but also if the lamp is already on when it becomes 10:00

    Normally when it fires, in this case, 14:00:01, it will be false but we need to have it if we have a rule like

    rule("Lamp:isOn & !(10:00..14:00) => ...")

    This rule should fire if it's not between 10:00 and 14:00. The rule will trigger 14:00:01 and the condition will be true...

    You cam add .info() to the end of the rule to log info about the rule at startuo

    Ex.

    Please login or register to see this code.

    Please login or register to see this code.

    It tells us that it will trigger on #device{id=10004,property="value"}, the Lamp:isOn condition. Lamp has deviceId 10004 in this case.

    It will also trigger at 10:00 and 14:00:01

    The Timer:@<time> logs are the active timers for the rule at the moment. Here we see that it has setup timers for 10:00 and 14:00:01

    Edited by jgab
    Posted
    15 hours ago, jgab said:

     

    Actually, the condition 10:00..14:00 will cause a trigger at 10:00 and at 14:00:01

    The reason is because of what you say.

    Ex

    rule("Lamp:isOn & 10:00..14:00 => ...")

    we want it to fire when the lamp is turned on between 10:00..14:00, but also if the lamp is already on when it becomes 10:00

    Normally when it fires, in this case, 14:00:01, it will be false but we need to have it if we have a rule like

    rule("Lamp:isOn & !(10:00..14:00) => ...")

    This rule should fire if it's not between 10:00 and 14:00. The rule will trigger 14:00:01 and the condition will be true...

    You cam add .info() to the end of the rule to log info about the rule at startuo

    Ex.

    Please login or register to see this code.

    Please login or register to see this code.

    It tells us that it will trigger on #device{id=10004,property="value"}, the Lamp:isOn condition. Lamp has deviceId 10004 in this case.

    It will also trigger at 10:00 and 14:00:01

    The Timer:@<time> logs are the active timers for the rule at the moment. Here we see that it has setup timers for 10:00 and 14:00:01

    So the ('may-oct') part will also trigger right? In this case my approache should be right yes? So every time the temperature gets above 24 on may-oct date range, and in 10..14 time range, this will trigger the rule to set AC to cooling mode, if it is not already in cooling mode??? I think this will be right yes?

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

    So the ('may-oct') part will also trigger right? In this case my approache should be right yes? So every time the temperature gets above 24 on may-oct date range, and in 10..14 time range, this will trigger the rule to set AC to cooling mode, if it is not already in cooling mode??? I think this will be right yes?

    No may-oct will not trigger, it just work as a "filter". It triggers at 10:00 and if it's may-oct it will be true...

    Yes, it looks ok to me.

    Posted

    @jgab 

    This does't work, what's wrong?

    Please login or register to see this code.

    This is showing cloudy

    Please login or register to see this code.

    where can I find the other used descriptions?

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

    @jgab 

    This does't work, what's wrong?

    Please login or register to see this code.

    This is showing cloudy

    Please login or register to see this code.

    where can I find the other used descriptions?

    Returns a string 

    Please login or register to see this code.

    • 2 weeks later...
    Posted

    @jgab I am struggling with OpenWeather data clouds fa now it shows 80% and in real life it's a bit cloudy.

    I found another weather site but I can't get it working.

    Please login or register to see this code.

     

    return from site:

    Please login or register to see this code.

    What I miss??

     

  • Topic Author
  • Posted (edited)

    Please login or register to see this code.

    On 6/17/2024 at 1:18 PM, Sjakie said:

    @jgab I am struggling with OpenWeather data clouds fa now it shows 80% and in real life it's a bit cloudy.

    I found another weather site but I can't get it working

    return from site:

    Please login or register to see this code.

    What I miss??

     

     

    What values do you need? It returns

    Please login or register to see this code.

    I don't read dutch so I can't interpret it. It seems to return values for different "zones"

    like d0weer,d1weer,d2weer with slight different weather conditions...

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