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


[TUTORIAL] Popup notifications and custom images


Sankotronic

Recommended Posts

Just now, Jamie mccrostie said:

 

@amurray85 Did it work?

that code works for emailing a photo to your phone but i wanted to inbed the photo the notification but doesn't seem all that possible :(

Link to comment
Share on other sites

  • Topic Author
  • Hi,

     

    I just try to see if I can send camera picture to popup message instead of icon and this is result:

    EDIT: I just replaced picture with one made during day :-) 

     

     

    It is not really useful since picture is small but if you want to try all you have to do is to put path to camera jpeg. This one is for my Foscam camera:

    Please login or register to see this code.

     

     

     

    Edited by Sankotronic
    Attachment quota filled up / deleting older stuff sorry :-(
    Link to comment
    Share on other sites

    12 hours ago, Sankotronic said:

    Hi,

     

    I just try to see if I can send camera picture to popup message instead of icon and this is result:

    Please login or register to see this attachment.

     

    It is not really useful since picture is small but if you want to try all you have to do is to put path to camera jpeg. This one is for my Foscam camera:

    Please login or register to see this code.

     

     

     

    @amurray85

    Link to comment
    Share on other sites

    • 2 weeks later...

    How to place a condition to the notification, say:

     

    i have a variable with GPS_ME and GPD_YOU  with HOME - WORK and CITY

    IF GPS_ME = HOME then

    Please login or register to see this code.

    elseif GPS_YOU = HOME

    local popBody = "the alarm has been disarmed by "YOU" "

    end

     

    and reflect this in the notification ?

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, samuel said:

    How to place a condition to the notification, say:

     

    i have a variable with GPS_ME and GPD_YOU  with HOME - WORK and CITY

    IF GPS_ME = HOME then

    Please login or register to see this code.

    elseif GPS_YOU = HOME

    local popBody = "the alarm has been disarmed by "YOU" "

    end

     

    and reflect this in the notification ?

     

    Hi @samuel,

     

    Maybe something like this:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    This is what i implemented~ it gives me an error:

     

     HomeCenter.PopupService.publish({
                      title        = popTitle,
                      subtitle     = os.date("%H:%M:%S | %d.%m.%Y."),
                      contentTitle = popContTitle,
                      contentBody  = popBody,

    L40 >>       if ( fibaro:getGlobalValue("Me_GPS") == "HOME" ) then
                           popBody = popbody .."me!"
                       elseif ( fibaro:getGlobalValue("You_GPS") == "HOME" ) then
                            popBody = popbody .."you!"
                      elseif ( fibaro:getGlobalValue("Me_GPS") == "HOME" ) and 
                         ( fibaro:getGlobalValue("You_GPS") == "HOME" ) then
                           popBody = popbody .."Us!"
                      end
                      img          = popImage,
                      type         = popType,

    })

    L40 = line 40

    error 

     

    [DEBUG] 12:51:28: line 40: unexpected symbol near 'if'

    Link to comment
    Share on other sites

  • Topic Author
  • 5 minutes ago, samuel said:

    This is what i implemented~ it gives me an error:

     

    [DEBUG] 12:51:28: line 40: unexpected symbol near 'if'

     

    This is because you can't put code for condition checking inside code for popup notification. Properly would be like this:

    Please login or register to see this code.

     

     

    Link to comment
    Share on other sites

    Is there anyone who can help me with this?

    How do i do to make the PopUp show a value from a global variable in the popBody field?

     

    Edited by sonnyboy
    Link to comment
    Share on other sites

    28 minutes ago, sonnyboy said:

    Is there anyone who can help me with this?

    How do i do to make the PopUp show a value from a global variable in the popBody field?

     

     

    Hi @sonnyboy

     

    If I understand you correctly, this should work

    ..replace variablename in line 3 with the actual name your global variable

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    5 minutes ago, sonnyboy said:

    @AutoFrank

    You nailed it. Thanks

     

    Please login or register to see this attachment.

     

    @sonnyboy

     

    Glad it worked out

     

    You could use a the following roundit function if you want more or less decimal places

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, AutoFrank said:

     

    @sonnyboy

     

    Glad it worked out

     

    You could use a the following roundit function if you want more or less decimal places

     

    Please login or register to see this code.

     

     

    Hello,

     

    there is a simpler way to round numbers with string function:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    4 minutes ago, Sankotronic said:

     

    Hello,

     

    there is a simpler way to round numbers with string function:

    Please login or register to see this code.

     

     

    Thanks @Sankotronic

    Another one for my code snippet library :D

    Link to comment
    Share on other sites

    1 hour ago, sonnyboy said:

    Today at 08:15 a popup came with yesterdays total energy consumption.

    Now i can stop using notify my Android from my old system :)

    Thanks for helping me out.

    @Sankotronic

    @AutoFrank

    @sonnyboy

     

    Perfect .... 

    Glad it worked out... 

    You could also look at the smart message hub that makes sending all different message and notification types easier. If it becomes a secondary type of notification that you would bundle with other 'messages/notifications' you could use the simple logger 

    Links to both are in my signature 

     

    Happy coding 

    -f

    Link to comment
    Share on other sites

    • 1 month later...
    Guest andyhud

    Stupid Question moment, but where do you put this code for these custom notifications? Just create a LUA scene?

     

    Thankyou in advance

     

    Andy

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, andyhud said:

    Stupid Question moment, but where do you put this code for these custom notifications? Just create a LUA scene?

     

    Thankyou in advance

     

    Andy

     

    Hi Andy,

    popup message LUA code you can use in both scenes and VD's.

    Link to comment
    Share on other sites

    Guest andyhud
    3 minutes ago, Sankotronic said:

     

    Hi Andy,

    popup message LUA code you can use in both scenes and VD's.

    Thanks @Sankotronic

     

    So if I want a notification for a "device" using this system (e.g is it on or off) do I create a scene first with an IF statement then add this code?

     

    Sorry, I'm still very new to Fibaro.. learning all the time!

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