A Step by step guide on configuring ThingSpeak to auto post to PushBullet, I use ESP8266’s but the you can use this for anything posting to ThingSpeak.
BEFORE YOU START: FOR THE LOVE OF GOD DO NOT COPY CODE FROM WORDPRESS BLOGS AND TRY AND COMPILE IT THE QUOTES ARE ALL WRONG, PASTE IT INTO NOTEPAD FIRST AND FIX THE QUOTES, DON’T COME MOANING IN THE COMMENTS THAT IT DOESN’T WORK. IF IT DOESN’T WORK, THEN IT’S YOU or They Changed it, but its likely YOU.
I’ve been messing with the ESP8266 chips, a really cheap Wifi SoC that can be used with Arduino, but also with the right firmware can be used on their own without a master control processor.
There are lots of examples of doing this, I use the nodeMCU firmware, along with ESPlorer to write the code in lua to program the ESP8266.
NOTE:These 8266-01 versions are cheap and everywhere but do yourself a favour and look for an 03 or better the 12, they have more pins available and capable of deepsleep and are just as cheap.
The downside to all this is that the current firmware has no capacity for https connections, and much of the IoT web relies on https, else any crackpot could connect to your service as the API keys are being sent in the clear. I really hope the nodeMCU people can add the http/sockets/https libs for lua into the firmware cos I failed, no time to ramp up knowledge to that level yet.
ThingSpeak, however lets you collect data using an API key but its done the in the clear, not exactly safe, but for many IoT devices a necessary evil.
And example of a temperature logger is on instructables.
My boy wants a gizmo that will notify him when someone goes into his room. He has an android phone. Rather than get my Ximian on and google notification services and all that painful stuff I just need some kind of Android Growl service. In the past I used NotifyMyAndroid, but since then I have been using a much better system called
you can send notifications to it without having the pain of writing your own App and notification hooks. PushBullet is actually so much cooler than just notifications, I use it because it can examine notifications on your phone and relay them to a chrome plugin on the desktop, so I never miss texts and stuff when I cant hear my phone.
So the point of this article is to figure out home to send information to PushBullet via ThingSpeak. This is really a part two to an article I haven’t written yet, but as the instructable article has already described how to program an 8266 and post to ThingSpeak I will expect you to have done that and we continue from there.
I have created a channel called PushBulletTrigger. It doesn’t really do anything except take a “Field1” input, which I only ever send a value of “1” to. Because In my instance I only ever log something to ThingSpeak if the detector sees someone in the room.
Of course on your project you can use any existing channel and check any field for a value in that to trigger a notification.
Next we need to create the ThingSpeak App based on “ThingHTTP”. Click on Apps in the Menu bar and then the
ThingHttp Icon
You will need your pushbullet API key here, but the rest I’ve already figured out from the API docs so you can copy pretty much all of this.
Give a good name I chose PushBulletAppSend, and set the URL that you need to connect to in our case
https://api.pushbullet.com/v2/pushes
Set the Method to POST
Set the Content Type to “application/json”
The HTTP version is 1.1
The host is api.pushbullet.com
We need to add a header name = Authorisation
and the value for that is
“Bearer [PushBulletAPI]”
No quotations and the space is important.
Lastly the Body
{“type”: “note”, “title”: “IOT Message”, “body”: “Detector Triggered”}
You can set the title value and body value to what you want. I haven’t figured out how to replace the values so if you want different messages and title then create different ones per message type.
So now we can log into ThingSpeak and we have something that can call into PushBullet which will send a notification to an Android OR iPhone.
Lastly we need to tie these things together and we do this also inside ThingSpeak.
To do this click on the Apps menu option at the top
and then on the React Icon
Name the React, ReactToPushBulletTrigger
We are testing a string so the Condition Type is String
We are testing on every Insertion, other options are on timers
Our condition is Channel “PushBulletTrigger” this is the Channel that logs data to thingspeak.
Then we test Field1 = 1
if this is true we call into the ThingHttp by setting the Action to ThingHttp and selecting our React “PushBulletAppSend”
Save it.
That’s it.
Now whenever your IoT device sends a piece of data into ThingSpeak, ThingSpeak will automatically relay a post to PushBullet and in turn notify your devices.
So thing to remember here is that ThingSpeak API allows for a data post every 15 seconds, so if you’re dumb enough to post every 15 seconds and have tied a react event to it, you could very well swamp your mobile with notifications and drive yourself insane.
In my version of the 8266 code, I have utilised the tmr events to only notify a maximum of once every 30 minutes, if the rooms been empty for 10 then it will notify immediately. But as I haven’t built the circuit board properly I’m waiting before I do a post on this, as I have to yet source 3.3v regulators, figure out how to boot the device with an active low state on the GPIO pins without sending the 8266 into firmware mode. It may be I have to wait till I get my 8266-12’s instead of the 01’s I’ve been using.
Hi,
Thank you for this clear explainations.
However I can’t get the thingspeak “thinghttp” work…
I always get this answer from pushbullet :
{“error”:{“type”:”invalid_request”,”message”:”Access token is missing or invalid.”,”cat”:”(=^???^)y?”}}
I did exactly how you proposed, but fails…
Any idea please ?
Thanks
JP
Ok I found the bug …
You wrote Authorisation in your blog
It should be Authorization (with a “z”)
JP
Yeh im british so spellcheckers fix incorrect american spellings;-p
And I am french so “autorisation” for me 🙂
JP
Hi,
Trying to get this to work, I have a channel, httpthing and a react, the difference is that my react looks for a numeric value in field1 < 20
I am not getting it to update PushBullet, any way to see the error from PushBullet?
Once inside thingy its all down to iT so fiddling or qireshark can help here.
Try executing the http post in a client of your own devising make aure pushbullet is working.
Else have a word with the thingy people or push bullet support See if they can help.
Perhaps the format of the post has changed since writing this article something to check out in a client you write or on pb website.
Regarding replacements, I’ve found you can send a custom message in the URL of a GET (even though the ThingHTTP is set as a POST, a GET from the ESP8266 seems to work fine with it so I haven’t bothered to change it to a POST) like so:
https://api.thingspeak.com/apps/thinghttp/send_request?api_key=XXXXXXXXXXXXXXX&message=I%20AM%20A%20MESSAGE
The %20 are the URL encoded space characters, so the actual message reads I AM A MESSAGE
Then in the Body: section of the ThingHTTP put
“body”: “%%message%%”
and it will be replaced with the message from the URL.
Where I got this info:
http://community.thingspeak.com/documentation%20…/apps/thinghttp/
Thanks very much for putting this post here. It was just what I needed to get my ESP8266 sending PushBullet notifications.
Hi there,
First of all, thks for this information about creating a link between ESP and Pushbullet… I was stuck on this since a long time.
My Thingspeak channel is working great, my React is correctly configure. But i have problem with the ThingHTTP…
I configure everything as you said, and try some other parameters, there’s nothing to do…
You’re putting your pushbullet acces token in the field “HTTP Auth Username”, right?
Have a nice evening.
Robin
Hi Robin,been 10months since I wrote this and I’ve done nothing since. Reading thru the Pushbullet api key is what I pass yeah. But if you are having trouble give Pushbullet support a mail they can probably help better than me now.
Good luck with it though.
Hi Robin,
I followed everything on this website except the BODY content. It does not meet json because of the bad double-quotes symbol.
original:
{“type”: “note”, “title”: “IOT Message”, “body”: “Detector Triggered”}
fix to:
{“type”: “note”, “title”: “IOT Message”, “body”: “Detector Triggered”}
It works for me after done the additional modification.
Yeh watch for double quotes WordPress always changes them, so don’t cut and paste from this, type it in.
I’m tempted to replace all text with pictures of text to prevent this kind of error.
The latest dev branch of the nodemcu/lua firmware has HTTPS support now 🙂
http://nodemcu-firmware.readthedocs.org/en/dev/en/modules/http/
Woohooo
I am working on making a door sensor that will send a push notification to my phone if my front door has been left open for more than 2 minutes (it happens more often than you’d expect, and with animals in the house is a huge fear of mine). Originally I was following a tutorial on adafruit and going to use their IO with IFTTT, but since IFTTT’s new update it seems that the recipes can be delayed for up to an hour which I have tested and that makes it pretty useless for notifying me of something sort of urgent.
So, now I am working on an alternative and trying to cannibalize code from a few different projects I have looked at to get it to work. I will be the first to say I have never worked in arduino code or with an ESP8266 at all, nor do I personally know anyone who has; I was wondering if it would be possible for you to look at my code and tell me if you think it’ll work using your thingspeak/pushbullet method?
As you can probably tell Im really busy, too busy to even notice this comment appeared3 years ago
This all still works as of 20/06/2019 and just to make it clearer
– Use the spelling > Authorization Bearer hjbk____API___dkf {“type”: “note”, “title”: “IOT Message”, “body”: “Detector Triggered”} <
go ahead and copy and paste it but delete all the quotations and redo them so you know they're quotation marks and not a mismatch of quotation marks and apostrophes or any other crappy characters the formatting of this website has distorted.
To test ThingHTTP now gives you a url top right of the ThingHTTP edit page to copy and paste when your editing/creating your entry. All you have to do is paste it in a browser and you should get your pushbutton notification to your phone if you've done everything correctly
Good to know it still works. Been a while. Yeh those damnable quotes and wordpress.