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



jgab

Recommended Posts

23 minutes ago, jgab said:

Please login or register to see this code.

 

yes, everything works...but how can we give the name of the window in the log, and not just its ID)?

 

Please login or register to see this attachment.

Link to comment
Share on other sites

20 minutes ago, fastvd said:

yes, everything works...but how can we give the name of the window in the log, and not just its ID)?

 

Please login or register to see this attachment.

 

rule("windows={windowBedr,windowChil,windowAbabina,windowKab}")
 
  rule("windows:safe => Windows_F2=true;log('ALL windows on the 2nd floor are closed')")
  rule([[windows:breached => 
    Windows_F2=false;
    for _,id in ipairs(windows) do id:breached & log('%s open on 2nd floor',id:nameend
  ]])
Link to comment
Share on other sites

2 hours ago, jgab said:

Please login or register to see this code.

 

Jan, how to draw out which zone in us needs heat...
1)So once you taught us how to extract the set temperature from the climate panel:
 --1.1) Ababina zone
  Util.defTriggerVar("cliZone_Abab",0)
  rule("@@-00:01 => cliZone_Abab = api.get('/panels/climate/16').properties.currentTemperatureHeating").start()
   --1.2) Children's Zone
  Util.defTriggerVar("cliZone_Childr",0)
  rule("@@-00:01 => cliZone_Childr = api.get('/panels/climate/17').properties.currentTemperatureHeating").start()
  --1.3) Cabinet area
  Util.defTriggerVar("cliZone_Kab",0)
    rule("@@-00:01 => cliZone_Kab = api.get('/panels/climate/18').properties.currentTemperatureHeating").start()
  --1.4) Zone Bedroom
  Util.defTriggerVar("cliZone_Bedr",0)
    rule("@@-00:01 => cliZone_Bedr = api.get('/panels/climate/19').properties.currentTemperatureHeating").start()

 

--2) If one room is heated, then the variable Heating_F2=true
  rule("@@00:01 & (term_Abab:value<cliZone_Abab | term_Childr:value<cliZone_Childr | term_Kab:value<cliZone_Kab | term_Bedr:value<cliZone_Bedr) =>Heating_F2=true;log('Some zone needs heat') " ) -- This moment is interesting!
  rule("@@00:01 & term_Abab:value>cliZone_Abab & term_Childr:value>cliZone_Childr & term_Kab:value>cliZone_Kab & term_Bedr:value>cliZone_Bedr =>Heating_F2=false;log('All zones are heated')")

Link to comment
Share on other sites

Jan, I did configure the Yubii application (or rather, the nuance was in the Android settings) to send my GPS data to my HC3 and based on this I already manage my house. But since I don't know how to directly use this data in Er4, I created a global variable GPShome with value On and OFF and then in a simple block scene, I already choose if I entered the zone, then the variable On and vice versa.
This is a very bad and long scheme.
How can you directly work with HC3 GPS data in ER4?

Link to comment
Share on other sites

  • Topic Author
  • Posted (edited)
    23 hours ago, fastvd said:

    Jan, I did configure the Yubii application (or rather, the nuance was in the Android settings) to send my GPS data to my HC3 and based on this I already manage my house. But since I don't know how to directly use this data in Er4, I created a global variable GPShome with value On and OFF and then in a simple block scene, I already choose if I entered the zone, then the variable On and vice versa.
    This is a very bad and long scheme.
    How can you directly work with HC3 GPS data in ER4?

    If you in the beginning of QUickApp:main() have enabled the 'location' trigger type

    Please login or register to see this code.


    the you will receive location events whenever someone changes position.

    The event is on the form

    {type='location',id=<userId>,property=<locationId>,value=<action>,timestamp=<time>}

    The userId is the HC3 id of the user

    The locationID is the id of the place defined in the location panel

    The action is either the string "leave" or "enter"

    ...and the timestamp is the epoch time when the event was registered.

     

    Ex-

    Please login or register to see this code.

     

    However, sometimes there seems to be issues with location triggers being reported back to the HC3. ER4 just listens to what comes in to the HC3 so if you don't see any events in ER4

    the problem is not there...

     

    So, my iOSLocatior QA listens to iOS devices and generate the same location event as the Yubi app would do. This is so that the iOS user's would not need the Yubii app, and it used to be more reliable too ;-) 

     

    Edited by jgab
    Link to comment
    Share on other sites

    10 hours ago, jgab said:

    If you in the beginning of QUickApp:main() have enabled the 'location' trigger type

    Please login or register to see this code.


    the you will receive location events whenever someone changes position.

    The event is on the form

    {type='location',id=<userId>,property=<locationId>,value=<action>,timestamp=<time>}

    The userId is the HC3 id of the user

    The locationID is the id of the place defined in the location panel

    The action is either the string "leave" or "enter"

    ...and the timestamp is the epoch time when the event was registered.

     

    Ex-

    Please login or register to see this code.

     

    However, sometimes there seems to be issues with location triggers being reported back to the HC3. ER4 just listens to what comes in to the HC3 so if you don't see any events in ER4

    the problem is not there...

     

    So, my iOSLocatior QA listens to iOS devices and generate the same location event as the Yubi app would do. This is so that the iOS user's would not need the Yubii app, and it used to be more reliable too ;-) 

     

    The locationID is the id of the place defined in the location panel

    ?? ? 

    Is the number 219 the same for everyone? if not, how to find out?

    Edited by fastvd
    Link to comment
    Share on other sites

    Hi Jgab and er4 users, has the “user:msg” function stopped working . I believe it stopped working after the latest fibaro update but I’ve downgraded sw and er4 quickapp with no luck. 

     

    Tested with block/ lua and notifications are working.  Currently running latest sw and updates on HC3. 
     

    Thanks

    Link to comment
    Share on other sites

    15 hours ago, Pica2017 said:

    Hi Jgab and er4 users, has the “user:msg” function stopped working . I believe it stopped working after the latest fibaro update but I’ve downgraded sw and er4 quickapp with no luck. 

     

    Tested with block/ lua and notifications are working.  Currently running latest sw and updates on HC3. 
     

    Thanks

    use  your  id for  user not device   that works 

    Link to comment
    Share on other sites

    User id sends notifications to all devices connected. 

    The device id used to work alone, not sure what happened to change it on my end.

     

    I've tested by doing the following, where as 50 is the device id. it works fine as a fibaro call.  If i use device{50}:msg its not working.

     

    rule("#UI{name='Test'} => fibaro.call(50,'sendGlobalPushNotifications','testing is working','false')")

    rule("#UI{name='Test'} => device:msg=log('test')")

     

    Similarly crash notifier is no longer working either so maybe an issue elsewhere.

    I've also tested on a seperate HC3 unit and using a different device and had no success.

    Link to comment
    Share on other sites

  • Topic Author
  • Posted (edited)

    Yes,

    <ID>:msg=<message>

    is implemented as

    Please login or register to see this code.

    and "push" needs the userId. Typically "admin" is 2, but there may be other users.

     

    There is another method

    fibaro.alert("simplePush",{<ID>},<message>)

    that requires the id to be the phone id.

     

    I created ER4 v0.88 and made the method used an option.

    fibaro._pushMethod is set to "push" by default and is used by <id>:msg. If you instead want to use phone ids,

    set fibaro._pushMethod="simplePush" somewhere in the beginning of QuickApp:main()

     

    There is also a couple of new functions that can be used in rules

    USER(name) returns the user definition (table) for user with name

    PHONE(name) returns the phone definition for name

    LOC(name) returns the location definition for name.

     

    The definitions (tables) for these objects contains the id of the object and can thus be used as
     

    Please login or register to see this code.

     

    If you use them a lot, I recommend that you assign the value you need to a variable as the functions needs to lookup the current value.

    Ex.

    Please login or register to see this code.

     

    Edited by jgab
    • Thanks 1
    Link to comment
    Share on other sites

  • Topic Author
  • On 10/3/2022 at 3:20 PM, fastvd said:

    Jan, how to draw out which zone in us needs heat...
    1)So once you taught us how to extract the set temperature from the climate panel:
     --1.1) Ababina zone
      Util.defTriggerVar("cliZone_Abab",0)
      rule("@@-00:01 => cliZone_Abab = api.get('/panels/climate/16').properties.currentTemperatureHeating").start()
       --1.2) Children's Zone
      Util.defTriggerVar("cliZone_Childr",0)
      rule("@@-00:01 => cliZone_Childr = api.get('/panels/climate/17').properties.currentTemperatureHeating").start()
      --1.3) Cabinet area
      Util.defTriggerVar("cliZone_Kab",0)
        rule("@@-00:01 => cliZone_Kab = api.get('/panels/climate/18').properties.currentTemperatureHeating").start()
      --1.4) Zone Bedroom
      Util.defTriggerVar("cliZone_Bedr",0)
        rule("@@-00:01 => cliZone_Bedr = api.get('/panels/climate/19').properties.currentTemperatureHeating").start()

     

    --2) If one room is heated, then the variable Heating_F2=true
      rule("@@00:01 & (term_Abab:value<cliZone_Abab | term_Childr:value<cliZone_Childr | term_Kab:value<cliZone_Kab | term_Bedr:value<cliZone_Bedr) =>Heating_F2=true;log('Some zone needs heat') " ) -- This moment is interesting!
      rule("@@00:01 & term_Abab:value>cliZone_Abab & term_Childr:value>cliZone_Childr & term_Kab:value>cliZone_Kab & term_Bedr:value>cliZone_Bedr =>Heating_F2=false;log('All zones are heated')")

    You don't need to run --2) every minute as they will be triggered whenever term_Abab:value or cliZone_Abab changes value (you declared cliZone_Abab to be a triggerVar)

    If you need to know what zone is relevant I would separate the rule into one rule for each temp

    Please login or register to see this code.

     

    • Like 1
    Link to comment
    Share on other sites

    On 9/29/2022 at 5:15 PM, fastvd said:

    ER4 was updated to 0.87, and here I see a lot of unnecessary logs in the console, namely, I see all the triggers... once in the 0.5 version, I was just at the top of the main tab, I did this:
    _debugFlags.trigger=false -- log incoming triggers
     and when I needed triggers, I did true...
     and in this version, several versions of the log appeared, as if I put false , but everything still gives me all the trigger logs!
    How to turn it off?


    debugFlags.trigger = false -- log incoming triggers
    _debugFlags.trigger2 = false -- log incoming triggers
    _debugFlags.sourceTrigger = false
    _debugFlags.fcall=true -- log fibaro.call
    _debugFlags.post = true -- log internal posts
    _debugFlags.rule=true -- log rules being invoked (true or false)
    _debugFlags.ruleTrue=true -- log only rules that are true
    _debugFlags.pubsub=true -- log only rules that are true
    _debugFlags.extendedErrors=true

    ???

    Link to comment
    Share on other sites

  • Topic Author
  • 48 minutes ago, fastvd said:

    ???

    Yes, the debug flags where a bit messy as they are taken from the fibaroExtra library mostly these days.

    I have pushed v.89 that merges the flags better. 

    If you want you can add these flags in the beginning of EventRunner main file instead of the old ones.

     

    Please login or register to see this code.

     

    • Like 1
    • Thanks 1
    Link to comment
    Share on other sites

    56 minutes ago, jgab said:

    Yes, the debug flags where a bit messy as they are taken from the fibaroExtra library mostly these days.

    I have pushed v.89 that merges the flags better. 

    If you want you can add these flags in the beginning of EventRunner main file instead of the old ones.

     

    Please login or register to see this code.

     

     

    I turned off debugFlags.sourceTrigger, but everything is still logging in the console! I updated the version to 0.89!

    Please login or register to see this image.

    /monthly_2022_10/image.png.d89f1312e9afa989988bd0583f0bd278.png" />

    image.png.5950ba0230a66e8552444c189079891c.png

     

    Please login or register to see this attachment.

     

    Link to comment
    Share on other sites

  • Topic Author
  • Sorry, in QuickApp:main() there is a line

    Please login or register to see this code.

    that sets the flag back to true, just remove that line.

    • Like 1
    Link to comment
    Share on other sites

    On 9/7/2022 at 8:55 AM, jgab said:


     

    Please login or register to see this code.

    This filter and only keep devices with root parent, visible and enabled.

    want to go back to the rule about dead devices.
    1) we have Jan's rule that tracks ALL dead devices:

     

    allZWaveDevice = Util.map(function(d) return d.id end,(api.get("/devices?interface=zwave")))
        rule([[for _,id in ipairs(allZWaveDevice) do
                  if id:isDead then log('Device %s:%s is dead',id:name,id) end
                end
            ]],{print=true})
        rule("allZWaveDevice:isDead => local id = env.event.id; log('Device %s is dead',id:name)")
     
    2) It works and instantly sends a report, but as we remember, this rule issues ALL PARENT devices and ALL CHILD devices,that is not convenient and logical!. 
     
    3) That's why I asked how to report only dead PARENT devices in the report.For which Jan came up with a function that filters PARENT devices:
     
    allZWaveDevice = fibaro.utils.reduce(
       function(d) return (d.parentId==0 or d.parentId==niland d.visible and d.enabled end,
      (api.get("/devices?interface=zwave"))
    )
    allZWaveDevice = Util.map(function(d) return d.id end, allZWaveDevice)
     
    BUT SHE DOESN'T work((((

    Please login or register to see this attachment.

     
    Physically we see 6 reports, although it is physically 1 relay with 5 CHILD devices
     
    4) Jan, how should we filter only PARENT devices or at least the first CHILD devices so that the report is more readable and logical?
    Edited by fastvd
    Link to comment
    Share on other sites

  • Topic Author
  • Can you run this and post the log

    Please login or register to see this code.

    Then we see what devices you get as parents - and what parentIds they got.
    Link to comment
    Share on other sites

    1 hour ago, jgab said:

    Can you run this and post the log

     

    Please login or register to see this code.

    Then we see what devices you get as parents - and what parentIds they got.

    no change(((

    moreover - there is ABSOLUTELY NO DIFFERENCE whether it is a function or not!

    Please login or register to see this attachment.

    Edited by fastvd
    Link to comment
    Share on other sites

    also noticed: the rule works both when the device is dead and when the device restores communication!

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 13 minutes ago, fastvd said:

    no change(((

    moreover - there is ABSOLUTELY NO DIFFERENCE whether it is a function or not!

    Please login or register to see this attachment.

     

    13 minutes ago, fastvd said:

    no change(((

    moreover - there is ABSOLUTELY NO DIFFERENCE whether it is a function or not!

     

     

    Yes, but I was expecting the log when the allZWaveDevice variable was created.

    The line that prints the info for each device

    Please login or register to see this code.

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