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
  • 1 minute ago, Sjakie said:

    Jan,

    Will this work?

     Rule.eval([[hal.locatieGezin:isOn & hal.kamerBoven:isOff & hal.kamerBeneden:isOff =>
            1:alarm=true; log('Huis aanwezig armed'); 
            3:alarm=true; log('kamerBoven afwezig armed');
            4:alarm=true; log('kamerBeneden afwezig armed');
                ]])
    Please advice,
    //Sjakie

    Yes, that should work. 

    kamerBoven and kamerBeneden are lights?

    Link to comment
    Share on other sites

    Jan,

    locatieGezin, KamerBeneden and kamerboven are buttons who reflect the presence of people, present or not.

    Precense of kamerboven and kamerbeneden will be triggered by person in as door breached and pir is safe (its not 100% safe to use).

    If we leave the complex I must press buton locatieGezin to arm and I can check if the state of the other rooms are okay.

    Our complex is devided in 4 independant parts, so there are a few posibilities to arm.

     

    This will be much easier as to do the same job in HC2.

    Thanks for this beatifull ER4

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • Example of alarm handling on the HC3 and ER4

    Please login or register to see this code.

    Of course these events could be used to start other rules like simulating presence, turning off stuff etc.

    The cool thing here is that we get a notification when the user turns on the alarm and we have the "delay time" to check if partition is safe. If not we abort the arming.

    One could also setup a rule that watches if something is breached during the arm delay timespan and also cancel the arming.

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

  • Topic Author
  • There are a couple of ways to interact with an ER4 QA.

     

    1. postRemote

    First an ER4 QA can use self:postRemote(<ER4 id>,event) to send an event to another ER4 QA. In a ER rule the command is named "remote"

    It only works between ER QAs (it also works on ER3 on HC2)

    Ex.

    QA ID 44, sending QA

    Please login or register to see this code.

     

    QA ID 45, receiving QA

    Please login or register to see this code.

     

    2. fibaro.call

    Just define a standard QuickApp function and let it send an event to trigger rules

    QA ID 44, sending QA

    Please login or register to see this code.

     

    QA ID 45, receiving QA. In the receiving ER QA, just re-post the values in an event that can trigger rules.

    Please login or register to see this code.

     

    3. pubsub

    This is like postRemote but it uses a publish/subscribe mechanism. The advantage is that the sending and receiving QA don't need to know each other's IDs.

    QA ID 44, sending QA. It just publishes the event without specifying a receiving QA id. (it also works on HC2 and ER3)

    Please login or register to see this code.

     

    QA ID 45, receiving QA. All ER QAs that has done a subscribe on the event will receive the event.

    Please login or register to see this code.

    5. define ER UI buttons

    There is a description how to add buttons to the ER4 QA UI and trigger rules when they are pressed. Description here

    It's possible from Lua to call any UI button with some tricks but it's mostly for humans to interact with the ER scene.

    However, the default is that the ER QA is of type "fibaro.com.genericDevice", and these devices don't have any predefined "methods". That means that a block scene will not have any options to interact with such a device besides 'state'.

    'state' is a QA property that can be updated with self:updateProperty('state',<boolean>)

     

    6. Define ER4 children

    This is a new feature.

    Please login or register to see this code.

    Child are created with the self:child command. It takes a type, a name, and an "eid".

    It creates a child if a child with the given eid doesn't already exist. The eid is different from the child's device id. The reason is that we want a stable id even if the child devices are regenerated. In the example above we refer to that child with eid 99 all the time. 

    If you want to change the type of an existing child, just delete it in the UI, update the type in the self:child code  and restart the QA.

     

    We can then define rules that triggers when the child is called (with UI or through fibaro.call(<child id>,...) )

    In the example above we trigger on turnOff/turnOn and update the value property of the child device.

    These children can be used from block scenes and when interacted with will trigger our rules - or we can trigger block scenes by updating the children's properties.

     

    -------------------

     

    Not really a way to interact with an ER4 QA but there is an option to add some status message under the QA icon in the dashboard view

    Please login or register to see this code.

    The message is a string and the timeout is a number in seconds. If the timeout is nil it will stay on until updated next time.

    Ex.

    Please login or register to see this code.

     

     

     

    Edited by jgab
    Link to comment
    Share on other sites

    Hi jgab

    Here is an example where you can use the ui button of another device quick app in ER4

    Other quick apps like images

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 5 minutes ago, minsad79 said:

    Hi jgab

    Here is an example where you can use the ui button of another device quick app in ER4

    Other quick apps like images

     

    Please login or register to see this attachment.

    Is this an existing device or a QA you have made?

    You could create child ceviche of type Sonos player or camera or tv and get a child device with similar buttons . Then you could make rules that trigger in them

    Link to comment
    Share on other sites

    7 minutes ago, jgab said:

    Is this an existing device or a QA you have made?

    You could create child ceviche of type Sonos player or camera or tv and get a child device with similar buttons . Then you could make rules that trigger in them

    it's kodi quick app

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 22 minutes ago, minsad79 said:

    it's kodi quick app

     

    ...and you want to click on the buttons from an ER rule?

    Normally all UI buttons are bound to a QuickApp function of the device.

    Ex. rule("@sunset => fibaro.call(21,'turnOn')")

    so if you know the name of the function that's the best way to call it.

    Otherwise you can call it via the api

    rule("@sunset => api.get('/plugins/callUIEvent?deviceID=21&elementName=turnOn&eventType=onReleased&value=nil')")

    but you need to know the elementName. That's possible to discover via the properties.viewLayout property of the QA sometimes. If it's a javascript UI it can be trickier...

     

    Link to comment
    Share on other sites

    4 hours ago, jgab said:

     

    ...and you want to click on the buttons from an ER rule?

    Normally all UI buttons are bound to a QuickApp function of the device.

    Ex. rule("@sunset => fibaro.call(21,'turnOn')")

    so if you know the name of the function that's the best way to call it.

    Otherwise you can call it via the api

    rule("@sunset => api.get('/plugins/callUIEvent?deviceID=21&elementName=turnOn&eventType=onReleased&value=nil')")

    but you need to know the elementName. That's possible to discover via the properties.viewLayout property of the QA sometimes. If it's a javascript UI it can be trickier...

     

    No opposite

    I want to run the rules of ER4 with the following command values

     

    EX. rule("fibaro.call(123,"play") => Bedlamp:value=50; Bedlamp:color={227,143,6,0}") 

     

    This way? Will it work?

     

     

    Please login or register to see this attachment.

    Edited by minsad79
    Link to comment
    Share on other sites

  • Topic Author
  • 21 hours ago, minsad79 said:

    No opposite

    I want to run the rules of ER4 with the following command values

     

    EX. rule("fibaro.call(123,"play") => Bedlamp:value=50; Bedlamp:color={227,143,6,0}") 

     

    This way? Will it work?

     

    No,

    try this (QA id of KODi os 123)

    Please login or register to see this code.

    If it works and prints "Play" then this would work

    Please login or register to see this code.

    ...which is the same as 

    Please login or register to see this code.

     

    Edited by jgab
    Link to comment
    Share on other sites

    Hi @jgab,

    what can I do? Would restarting the HC3 help? Or do you have to do something.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 8 minutes ago, jwi said:

    Hi @jgab,

    what can I do? Would restarting the HC3 help? Or do you have to do something.

    Please login or register to see this code.

     

    Ouch, that was not good.

    I have pushed a new version but because the error is in the update routine it will not work.

    The function listFiles was renamed to getFiles...

    What you can do is that inside 

    function QuickApp:man() where you declare the rules add

    Please login or register to see this code.

    and the update will work

    Link to comment
    Share on other sites

    7 minutes ago, jgab said:

    and the update will work

     

    Thanks, I will try.

    Link to comment
    Share on other sites

    Guest kallecux

    Hi @jgabER4 starts every minute new:

    Please login or register to see this code.

    im am using version 

     

    E_VERSION,E_FIX = 0.5,"fix17"

     

    i tried your tip, but nothings changes - still fix17

     

    greetings

    Karl Heinz 

    Link to comment
    Share on other sites

    2 hours ago, jwi said:

     

    Thanks, I will try.

     

    @jgabdo you have any other tip for us?

     

    Please login or register to see this code.

    This error occurs after inserting the function

    Link to comment
    Share on other sites

  • Topic Author
  • 20 minutes ago, jwi said:

     

    @jgabdo you have any other tip for us?

     

    Please login or register to see this code.

    This error occurs after inserting the function

    What a mess...

    Please remove the "function self:listFiles(id) return self:getFiles(id) end" if you added it to main().

    Unfortunately you need to patch the "EventRunner" file in the QA by hand.

    Around line 700 there is a function Util.updateFile that needs to be replaced. See below.

    Alternatively you install a new version of the QA and re-install your rules in the main file 

    Please login or register to see this attachment.

    Sorry for the inconvenience.

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Thanks @jgab ,

    after patching eventrunner according to your instructions, everything is OK.

     

    1 hour ago, jgab said:

    Sorry for the inconvenience.

     

    No problem at all. 

     

     

     

     
    Link to comment
    Share on other sites

    On 9/26/2020 at 6:58 PM, jgab said:

     

    Not really a way to interact with an ER4 QA but there is an option to add some status message under the QA icon in the dashboard view

    Please login or register to see this code.

    The message is a string and the timeout is a number in seconds. If the timeout is nil it will stay on until updated next time.

    Ex.

    Please login or register to see this code.

     

     

     

     

    is there a way to send global variable value or local variable value in QA message?

     

    Please login or register to see this code.

     

    AND.

     

    Which button content can be changed based on an arbitrary button like the attached picture? What is updated is the global variable value.

     

     

    Please login or register to see this attachment.

    Edited by Earybeongbeong7
    Link to comment
    Share on other sites

    Please login or register to see this code.

    Module 'childs' missing

     

    Can I currently ignore this debug content after the update?

     

    I proceeded the update in the following way.

     

    I compared the structure of the newly installed Quick App. The quick app that was updated did not have a new module. (child)

     

    When updating the existing Quick App, I hope that new module files are uploaded.

     

    Is it okay to upload new module code? in  Existing used Quick APP.

     

    Thank you very much for upgrading the maintenance and new features every time.

      

    10 hours ago, jgab said:

    What a mess...

    Please remove the "function self:listFiles(id) return self:getFiles(id) end" if you added it to main().

    Unfortunately you need to patch the "EventRunner" file in the QA by hand.

    Around line 700 there is a function Util.updateFile that needs to be replaced. See below.

    Alternatively you install a new version of the QA and re-install your rules in the main file 

    Please login or register to see this attachment.

    Sorry for the inconvenience.

     

     

    Edited by Earybeongbeong7
    Link to comment
    Share on other sites

    17 hours ago, jgab said:

     

    No,

    try this (QA id of KODi os 123)

    Please login or register to see this code.

    If it works and prints "Play" then this would work

    Please login or register to see this code.

    ...which is the same as 

    Please login or register to see this code.

     

    working

    Thank you for your advice

     

     

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