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.
Sign into your account at pushbullet.com, click Settings, then Create Access Token under Access Tokens
Copy your access token, and store it for later
In your Homeseer Web Control panel, create a new event
For now, set the trigger to IF This Event is Manually Triggered
For the THEN section, choose Run a Script or Script Command
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.
A new Script box appears for you to enter your script. Paste in the script below.
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
Dim dataStream = request.GetRequestStream()
dataStream.Write(byteArray, 0, byteArray.Length())
Dim response = request.GetResponse()
hs.writelog("POST request", CType(response, HttpWebResponse).StatusDescription)
Edit the line starting with “request.Headers.Add” and replace enter_your_access_token_here with your Pushbullet access token from step 2.
Click the Save Script Edits button to save the script to a file.
In the Parameters box, enter “Test Title,Test body”. (Note there’s no space after the comma on purpose.)
Run the event manually with the blue and white arrow button. Voila!
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.