Reliable Pushbullet Integration with Homeseer

Reliable Pushbullet Integration with Homeseer

I’m a Pro user of Pushbullet and use it quite a bit for 3D printer status updates and other things. I have long wanted to get Pushbullet working with Homeseer, for reliable instant notifications of events. Hacking it together through the IFTTT integrations for both services was really slow and unreliable… so here’s how to do it properly, with no special plug-ins, costs, or complications!

It will take about 5 minutes to set up the first time, and then it’s just a few clicks for any new events you want to add notifications to.

  1. Sign into your account at pushbullet.com, click Settings, then Create Access Token under Access Tokens

  2. Copy your access token, and store it for later

  3. In your Homeseer Web Control panel, create a new event

  4. For now, set the trigger to IF This Event is Manually Triggered

  5. For the THEN section, choose Run a Script or Script Command

  6. Click Edit to choose a script, then at the top of the popup (where it shows the file path), add a new script name to the end of the file path. I called mine …/pushbulletPost.vb. Click Submit.

  7. A new Script box appears for you to enter your script. Paste in the script below.

    Imports System.IO
    Imports System.Net
    Imports System.Text
    Sub Main(ByVal params As String)
        Dim words As String() = params.Split(New Char() )
        const debug = false
        const server = "api.pushbullet.com"
        Dim postData As String = String.Format("", words(0), words(1))
        Dim request = WebRequest.Create("https://api.pushbullet.com/v2/pushes")
        request.Method = "POST"
        Dim byteArray = Encoding.UTF8.GetBytes(postData)  
        request.ContentType = "application/json"  
        request.ContentLength = byteArray.Length
        request.Headers.Add("Access-Token: enter_your_access_token_here")
        Dim dataStream = request.GetRequestStream()  
        dataStream.Write(byteArray, 0, byteArray.Length())  
        dataStream.Close()  
        Dim response = request.GetResponse()
        hs.writelog("POST request", CType(response, HttpWebResponse).StatusDescription)
        dataStream.Close()  
        response.Close()  
    End Sub
  8. Edit the line starting with “request.Headers.Add” and replace enter_your_access_token_here with your Pushbullet access token from step 2.

  9. Click the Save Script Edits button to save the script to a file.

  10. In the Parameters box, enter “Test Title,Test body”. (Note there’s no space after the comma on purpose.)

  11. Run the event manually with the blue and white arrow button. Voila!

TestTitleTestBody.png

The next time you want to add Pushbullet to an event, just select the script from the list and add your push title and body to the Parameters field. No need to edit the script ever again.

Enjoy!

John

Unboxing the Raspberry Pi 4 - 2GB

Unboxing the Raspberry Pi 4 - 2GB