Friday, May 29, 2015

Synology, meet Pushbullet

I'm a big fan of Pushbullet. I have talked about it before when mentioning my favorite extensions for Safari. This software allows notifications from your phone/mobile device to appear on your Desktop, send text/pictures/files/links from any device with Pushbullet to any other device as well as sending to other people you have as friends. It is easy to get started since you can easy sign up with just your Google+ account.



Synology is another product I enjoy, as I have mentioned it in my Home Entertainment Setup post. Synology sell's Network Attached Storage (NAS) devices which essentially are tiny servers to store files, host web pages, etc... I enjoy running their DSM Operating System on my HP N54L MicroServer.

Synology DSM has the ability of sending email notices, mobile push notifications, and SMS notifications. With Pushbullet already being integrated into my life, I was hoping I could have DSM send me notifications through Pushbullet. Unfortunately it is not built out of the box. But with some third-party programs, it can be done!

Here is what you need to do:

1. In the Community section of the Package Manager, you are going to add CPH as a package with the Location being https://www.cphub.net


2. Refresh the Package Manager and add the packages Notification Essentials and Notification Forwarder.


3. Open up the newly installed Notification Forwarder package.

4. Add a new configuration with the Pushbullet protocol. Set your username to admin, and your password to your Pushbullet Access Token. You can get an Access Token from your Pushbullet Account Settings page. 



5. Now in your Control Panel, under the Notification section, anything selected for Mobile notification will be sent through Pushbullet.


The procedure above was a translation thanks to the documentation on Domoticx.

After doing the steps above, I was able to successfully get notifications on Pushbullet from Synology. Unfortunately, the real reason I wanted push notifications on my phone was for Motion detection from the Surveillance Station connected to my Foscam FI9821W security camera. And the above did not seem to work in this case. This meant I had to find a different solution.



Styxit wrote some code in order to get Synology to communicate with Pushover. I decided to take his code and make some modifications to get it to work with Pushbullet.

My code published on Github is a modification which combines code from Styxit above with a Pushbullet PHP Curl code from DWB.


Download my code as a file called pushbullet.php and place it in your root web directory on your Synology. Make sure you have the web server enabled first.

To set up notifications for the Surveillance Station, you will have to first launch it. Then go to Notification from the menu option. Go to the SMS section and perform the following:

1. Enable SMS notifications.

2. Click Add SMS Service Provider.

3. Set the Provider name to Pushbullet.

4. Set the URL as follows:

http://localhost/pushbullet.php?userkey=0&pwd=0&appkey=YOUR_PUSHBULLET_TOKEN_ID&to=1234&text=Hello+World

5.  Enter your Pushbullet Access Token ID as the value for appkey for the URL above.



6.  Click Next and assign the following:

userkey=0 -> Username
pwd=0 -> Password
appkey=*** -> Other
to=1234 -> Phone number
text=Hello+World -> Message content



7. Press Finish.

8. Set the SMS Service Provider to be Pushbullet.

9. Set the Username and Password to anything you want.

10. Set a Primary phone number to anything you want.



11. Press Apply.

12. Verify it works with the Send a test SMS message button.
You can then go to the Advanced section to enable what you want to be notified through SMS (in this case, Pushbullet) about.

For me, I just enabled Camera Motion detection to send an SMS alert and set the SMS interval limit to 1 minute so that I do not get spammed from multiple movements during the same small time frame.

And there you have it. I use the SMS method for the Surveillance station push notifications, and the Notification Forwarder app for the standard Synology notifications.

Enjoy the synergy between Synology and Pushbullet.

4 comments:

  1. I’m getting a SMS test has failed error message. My Surveillance Station version is 7.1-4080. Two notable differences while following your instructions are 1) SMS URL would not accept &text=Test but did accept &text=Hello+world. 2) After setting the SMS Service Provider to be Pushbullet my screen includes an API AD: field whereas your screenshot example does not. This appears to be a mandatory field. What needs to be entered in the API ID field? Thank you.

    ReplyDelete
    Replies
    1. Hi,

      When setting up the SMS service provider, your address does not include a &api_id=*? Only if your SMS URL contains that phrase should that field appear, and it is not needed for Pushbullet.

      Delete
    2. Correct, the address does not include &api_id=*. Your instructions worked perfectly for DiskStation Notification, but not Surveillance Notification. In DiskStation Notification the API ID field disappears after I complete the Add a SMS Service Provider steps, but that is not the case in Surveillance Notification. I’m thinking this is a Surveillance Notification bug.

      Delete
  2. Hi, I realise this thread is a few years old but I'm interested in setting this up, however, in the DSM version I'm using (6.1.2), I can't see the relevant options. Are you able to point me in the right direction?

    ReplyDelete