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


unable to get push notifications working on Android tablet


Recommended Posts

Posted

I'm using Fibaro HC2 4.0.48 and the latest Fibaro tablet app for Android/Lollipop and I'm trying to get the tablet do receive a simple push notification. The quality of the Fibaro documentation is what it is and the syntax seem to change every now and then so it's quite hard to google a solution. HC2 and tablet sits on the same LAN, tablet is logged on as a user in HC2 and I can see and control everything, so the communication is fine.

In HC2 under Configuration -> Access Control I can see the tablet and it is selected to receive push notifications. This is true for my user as well.

I thought that it was as simple as creating a notification template and then go to e.g. a wall plug -> advanced -> Notify me -> By push -> About status change -> my notification template. This has no effect at all. The tablet just say "No new notifications.".

Then I tried to send a push notification from a scene. This is where the lack of documentation really shows. According to

Please login or register to see this link.


the example
fibaro:call(10, "sendDefinedPushNotification", "2")
means a push is sent to mobile device number 10 using predefined notification id 2.

 

I really wonder where the mobile device id can be found because I can't see it anywhere.

Anyway I created a scene using block scenes and selected Motion sensor breached => send push -> select notification template -> to my tablet.
Still no notification on the tablet. So I viewed the generated LUA coded and it was:

fibaro:call(532, "sendDefinedPushNotification", "532");

The number 532 is the id of my created notification template. I find this quite weird. Why is 532 there two times? According to the documentation
the first argument is the mobile device id. Also, according to some forum posts, the first argument is not the mobile device id but instead the user id of the user that should receive the notifications. I changed the code to e.g. fibaro:call(2, "sendDefinedPushNotification", "532");
(my logged on user on the tablet is user id 2) but this did also not work. I've tried several different users, several different notification templates, logged in/out and so on.

What should I do? A big frustration is that these kind of things are really hard to debug as HC2 is a big black hole when it comes to
logging and error handling.


 

  • Topic Author
  • Posted

    Ok I have to ask, is the push notification feature really supposed to work or is it just another case of "it will be available some time in the future"?

    By now I think I have tried everything I can to get this working.

    Posted

    Do you see the tablet on the "Mobile Device List" (configuration/access control)?

  • Topic Author
  • Posted

    Yes, as I said: "I can see the tablet and it is selected to receive push notifications"

    Posted

    The first ID is the ID of your device.

     

    You can get the ID like this:

    Please login or register to see this link.

     

    so:
    fibaro:call(ID_DEVICE, "sendDefinedPushNotification", "ID_NOTIFICATION");

     

    example to push a doorbell message to my iPad:
    fibaro:call(471, "sendDefinedPushNotification", "5");

    Posted

    As a test try ( obviously filling in your device id's in place of 397,388 & 254 ) 

    Please login or register to see this code.

    I also now have the ID_Device stored as variables, so i can call alphone, tayphone, deephone, ipad, sammytab etc .. .. makes life easier.

     

    ie :

    fibaro:call (deephone, 'sendPush', 'this is the push message')

     

     

    Doesn't miss a beat. I used Krikroff HC2 Toolkit to determine the correct Device ID's.

    ( If you don't have it .. get it !

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />  

    Please login or register to see this link.

    )

     

     

    Cheers,

    al.

  • Topic Author
  • Posted

    Thanks for your help, although still no success. The automatically generated LUA code from the block scene I described in my first post
    was obviously messing something up as the id for the mobile device and the notification id where the same (532). I deleted the tablet device and restarted it to have it added with a new id, and I also removed/added all notifications. I got the new id from /api/iosDevices/.

     

    Still no luck though. I'm looking at the network traffic between the tablet and HC2 and I can see that the tablet is polling e.g. /api/energy/... and /api/mobile/interface/refresh5 but there is no sign of any notification anywhere although I'm generating several of them by running the scene manually.

    I've tried sendPush as well. The posted script produce the expected output:
    [DEBUG] 08:05:22: 08:05
    [DEBUG] 08:05:22: Friday

    But no push is sent.
    A return value from sendPush and sendDefinedPushNotification would have been useful...
     

  • Topic Author
  • Posted

    No, I have blocked all outgoing traffic from HC2 (except during updates) because I really don't trust it to not phone home with sensitive data etc. It is amazingly chatty and really really wants to communicate all kinds of things.

     

    However, the blocking firewall is not between HC2 and the tablet, HC2 and the tablet are on the same subnet and they can communicate freely.

    A push notification between HC2 and a device on the same subnet doesn't use a third party on the Internet, right?

     

    Just for the sake of completeness for this test I've poked a hole in the firewall so the HC2 can talk freely to the Internet.

    This made no difference and I see no traffic that indicates any kind of notification communication.

  • Topic Author
  • Posted

    Ok I got it to work, but I am NOT happy. I performed a reboot while the firewall was still open and then kept it open. Then the push started to work.

    It turns out that for HC2 to send a push to a device that is on the same LAN, that communicate directly with each other, HC2 needs to send the push via a third party on the Internet.

     

    Sorry, but this is really insane. My HC2 sends a push notice, that could contain sensitive and private information, to another device on my local network via a site in Poland over http. And it includes a whole bunch of unencrypted details about the HC2. I just can't believe this. This is so bad.

     

    Btw, did you know that HC2 tries to resolve and ping www.google.com ONCE A SECOND? That's 86400 pings a day, 604800 pings a week...

    I'm looking forward to the explanation of why this is required.

    • 2 months later...
    Posted

    I have same problems with current latest Version but i don't have any firewall active for HC2. It is connected but can't send push messages to my android. It has worked some time ago but now it is not working + no error in the log.

    Posted

    Yuzo: I had this problem on my android phone. I've removed the Fibaro app from my phone and installed it again. Now I get my push messages again. Have you tried that?

    • 4 weeks later...
    Posted

    i had a similiar issue and there is a setting in the system menu for notification on android phones/tablets and that was for some reason set to 'block' all notifications from fibaro app. once i enabled notifications in the app everything worked fine...

    • 7 months later...
    Posted

    Yuzo: I had this problem on my android phone. I've removed the Fibaro app from my phone and installed it again. Now I get my push messages again. Have you tried that?

     Hi Cafun,

     

    i have a complete new phone (S7) and have installed latest app but can't receive push messages ...

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