[HC2] How to create mobile pop-up notifications

With LUA language you can easily broaden the possibilities of your FIBARO Home Center system by creating pop-ups for your mobile phone. In this short tutorial you will get to know how to create them.
 

Requirements

  • FIBARO Home Center 2,
  • FIBARO Z-Wave devices,
  • Smartphone with FIBARO App connected to Home Center.

 

Step-by-step instruction

  1. Log in to your FIBARO Home Center.
  2. loginpanel

  3. Click on Scenes.
  4. Scenes

  5. Choose Add scene.
  6. Add_scene

  7. Find Add scene in LUA and click on Add.
  8. Add

  9. Now you can see the box where you can type the LUA code.
  10. Every pop-up LUA scene contains of four parts: triggers paragraph, defying local variables, conditions-result and pop-up settings.
  11. Triggers Paragraph


    That means that scene will trigger if property “value” of device with ID 72 changes.
     

    Local Variables are used to make the code clearer and easier to modify in the future.


    Conditions and result
    Depending on scene you can choose here requirements that have to be fulfilled in order to your needs. In most cases condition and result formula looks like: if (condition) then (result).
    For example you can limit instances running at the same time:


    Pop-up settings
    Start with HomeCenter.PopupService.publish({}) function. Then, there are a few settings you can manage to get a satisfactory outcome:

    title – required title of pop-up

    subtitle – optional subtitle of pop-up

    contentTitle – optional title of pop-up content

    contentBody – required body of pop-up content

    img – notification image in .jpg, .png, or .bmp file format

    type – type of the pop-up

    buttons – definition of buttons used in the pop-up
     
    Look at the example of this part below:


    The popup will look like this:

  12. Remember to save the scene.
  13. Save

 

Types of notification color

  • Green border color:

  • Blue border color:

  • Yellow border color:

  • Red border color:

 

Number of buttons

  • One button:

  • 02

  • Two buttons:

  • 04

  • Three buttons:

  • 01

    Hint
    As you can see, each button used as a part of a pop-up may trigger different scene. The only thing you have to know is scene’s ID which may be obtained in its settings. This is why each scene must be firstly created before using in a pop-up.
     

August 7, 2017   16321    Tutorials    
Total 15 Votes:
2

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Comments are closed.