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

27 minut temu, jgab napisał:

'..' is not for concatenating string. '..' is reserved for the between operator.

Ex. rule("88:breached & 10:00..15:00 => ....")

Use '++' to concatenate strings

However, I would recommend using the function 'fmt' - same as Lua's string.format - to create the text string. It will also allow you to control number of decimals

Please login or register to see this code.

 

i created this :

rule("#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','text',fmt('Front Left:%02f%',msg.frontLeft.status.currentPressure/100))")
 
got this 
 [29.05.2022] [21:15:24] [ERROR] [QUICKAPP22]: in Rule:3[#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','text',fmt('Front Left:%02f%...]: ./include/EventRunner.lua:1953: ./include/EventRunner.lua:1682: bad argument #3 to 'format' (no value)

 

interested is also one more thing, the behavior based on separator if I used '.' (dot) then 74 QA is not updated, if ',' (comma) then it works 

 

rule("#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','labelPsi','text','2.4')") - not working

rule("#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','labelPsi','text','240')") - not working --update!

rule("#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','labelPsi','text','2,4')") - OK 

Edited by domin12
Link to comment
Share on other sites

  • Topic Author
  • Sorry, I made a typo. One % too much and missing '.'

    Please login or register to see this code.

     

    The problem with updateView is a Fibaro bug. The fibaro.call with a string argument that looks like a number will be converted to a number when it arrives.

    updateView requires a string as value so it doesn't work. It affect all fibaro.calls. It's really messy (see post below). Why they haven't fixed that in in 2 years I don't now. 

     

     

    The fix is to always json encode the argument

    rule("#bmw_s5 {msg='$msg'} => fibaro.call(74,'updateView','labelPsi','text',tjson('2.4'))") - not working

     

    • Like 1
    Link to comment
    Share on other sites

    Jan I have a QA (1779) binairy switch with function;

    Please login or register to see this code.

    How to switch on from another QA in ER?

    //Sjakie 

    Link to comment
    Share on other sites

  • Topic Author
  • 15 hours ago, Sjakie said:

    Jan I have a QA (1779) binairy switch with function;

    Please login or register to see this code.

    How to switch on from another QA in ER?

    //Sjakie 

    Please login or register to see this code.

    or

    Please login or register to see this code.

     

    Your QA need to have

    Please login or register to see this code.

    defined

     

    Edited by jgab
    Link to comment
    Share on other sites

    Jan, thanks!

    I did't know 

    Your QA need to have

    Please login or register to see this code.

    Thanks!!

    //Sjaak

    Link to comment
    Share on other sites

    • 2 weeks later...

    Jan, to minimize the number of rules in QA is it posible for a variable with 10 options to log all values in one log rule?

    Please login or register to see this code.

    Will not show log

    Please advice,

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • It should show value every time Occupation changes values and value is greater than 0.

    It works for me if I test it.

    Link to comment
    Share on other sites

    Jan,

    note I have only my HC3 without any devices so for test I change value of variable unfortuanaly I choose the the wordt to test>> location. Will do $Test = 'On'or Off .

    My mistake I created a scene (to see how this works) to change the variable and pushed execute it only send the message but didt change the variable, back to ER :)

    Indeed it should work after the value change.

    Reduced 70 rules! Need to simplify more.

    Thanks,

    //Sjakie

    Link to comment
    Share on other sites

    Jan, last night 01:42 one of my QA (arming) restarted in log I see error at 23:59

    [09.06.2022] [23:54:02] [ERROR] [QUICKAPP1302]: in Rule:32[20:armed =>...]: ./include/EventRunner.lua:1949: ./include/EventRunner.lua:1628: attempt to call a string value

    I dont think this can be the cause.

    Any idea?

    //Sjakie

     

    Link to comment
    Share on other sites

    Jan, I cant find in the documentation how to? or is it not possible?

    Please login or register to see this code.

    I also try without :value 

    Thanks in advanced,

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • On 6/10/2022 at 8:21 AM, Sjakie said:

    Jan, last night 01:42 one of my QA (arming) restarted in log I see error at 23:59

    [09.06.2022] [23:54:02] [ERROR] [QUICKAPP1302]: in Rule:32[20:armed =>...]: ./include/EventRunner.lua:1949: ./include/EventRunner.lua:1628: attempt to call a string value

    I dont think this can be the cause.

    Any idea?

    //Sjakie

    This error looks impossible - at least the reported line numbers. Please let me know if it happens again.

    Link to comment
    Share on other sites

  • Topic Author
  • 7 hours ago, Sjakie said:

    Jan, I cant find in the documentation how to? or is it not possible?

    Please login or register to see this code.

    I also try without :value 

    Thanks in advanced,

    //Sjakie

    Please login or register to see this code.

     

    a < b | a > b

    is the same as a ~= b

     

    Link to comment
    Share on other sites

    Jan, Thanks!!

    I cant get it to work, I updated the 2 variables so bezetting_kamers should be total 5 >>no log from the rule its un equal.

    Also I cant get the value bezetting_kamer in log>>gives table

    Please login or register to see this attachment.

    This I have in my QA

    Please login or register to see this code.

     

    What am I doing wrong?

    Thanks in advance

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • This is confusing

    Please login or register to see this code.

    You are using $Bezetting_HalVoor as a deviceID with bezetting_kamer:value

    Like in your first example.

    What should $Bezetting_HalVoor represent?

    Link to comment
    Share on other sites

    Sorry Jan to see if this rule works I added some occupation in Bezetting_HalVoor and Bezetting_Badkamer

    Bezetting_xxxx>>are the rooms in the appartment

    So the Bezetting_Appartment = 2 but the sum of all rooms is 5

    according rule >>>log error and Telegram

    Does not log or send Telegram

    I cant log the value of bezetting_kamer>>>error Check - bezetting_kamer value is table: 0xaaaac77a7910

    Bezetting_Appartement will be used to arm/disarm appartment.

    If all is working properly than bezetting_kamer = $Bezetting_Appartement

    I need a to check if that will be true

    Please advice,

    //Sjakie

    Edited by Sjakie
    Link to comment
    Share on other sites

    i have a usecase for my bathroom - where my Pir sensor is not enough, so i have added a door sensor as well

    3 devices for this automation

    1. Light
    2. Door     sensor
    3. Pir     sensor

    Light is turned on when Pir: Breached

     

    When to close light???
    If PIR Breached, What is doorSensor after 5 seconds ?
    -    If breached (door open) – light is turned off when no movement(PIR) is detected over 30 sec.(someone entered the room, but didn’t close the door after entering, and has left again) 
    -    If safe (door Closed) – light is turned off 5 seconds after door.sensor is Breached 
    (this should indicate that someone is leaving the room, and don’t have to close the door, +5 gives enough time to leave the room)

     

    I was thinking on an automation something like this, but is there a more obviously way of doing this?

    Please login or register to see this code.

     

    Edited by ChristianSogaard
    P
    Link to comment
    Share on other sites

     

    Please login or register to see this code.

    On $Occupied_Toilet  > 0  >>>Light:on or $Occupied_Toilet == 0 Light:off

    //Sjakie

    Link to comment
    Share on other sites

    For the bathroom I use2 pir's one in and one outside to cover if 2 persons are in the house but thats not fail safe.

    To avoid darkness when a person is in the bathroom I added a step between light on>>off

    In toilet light:off

    In bathroom lightDim:on >>>switch lightDim on, included bri and ct settings)

    TrueFor(00:02, lightDim:isOn) => LightOff

    Link to comment
    Share on other sites

  • Topic Author
  • Yes, it's very difficult case - solution depends on bathroom layout and family behaviour - and there are an infinite number of variations on these parameters  ;-) 

     

    A simple case with a door sensor and a motion sensor that can detect if someone is moving in the bathroom.

    Assumptions:

    1. Motion sensor covers whole bathroom - also if someone is in the shower.

    2. When door is open it's ok to turn off light if there is no motion.

    Please login or register to see this code.

     

    • Thanks 1
    Link to comment
    Share on other sites

    Jan I still have an error and I have no clue how to solve it.

    If $Bezetting_xxxx is all zero or it's > 0 I get this error

    Please login or register to see this code.

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