How to Easily Push Notifications to Your Phone from a Micropython Device

Nathan Wells
5 min readAug 30, 2019

Who wouldn’t want to be able to send push notifications to your phone (or other device) from Micropython? The problem is there aren’t a lot of good tutorials walking you through how to do this — so here you go!

Let’s get started!

Sign up for Pushbullet

First, you’ll need to go to pushbullet.com and setup a free account (and setup a device, like your iPhone or Android by downloading the appropriate app). Pushbullet is how we’ll get push notifications on your phone.

Set up IFTTT

Next, you’ll need to setup an IFTTT account at ifttt.com

Once your account is setup, Once logged in, you’ll want to click the user menu and choose “create” (my account is already setup, so it might look a little different for you):

Then click on the IFTTT Platform link:

Once you are in the IFTTT Platform (just sign up for the free teir), click on “Applets”:

Then click “New Applet”:

You’ll create an new Applets for each unique push notification message that you want to use with your Micropython device. So first choose “Webhooks” as the trigger:

And then select “receive a web request” from the drop-down menu:

Then name the “Field label” and “Default value” (they can be whatever you want, just remember what you named the “Default value” because we will use that to trigger the push notification). In these example screen shots, I was setting up a push notification so my Micropython device would notify me when I should open my house windows to let the cooler air in, or close my windows when it was close to getting hotter outside than inside (you can check out that project here). But go ahead and name “Field label” and “Default value” whatever makes sense for how you will be using them.

Then click “Add action”:

And find “Pushbullet” and select it (you’ll need to give IFTTT permission to access your Pushbullet account — just follow the prompts):

Select, “Push a note” from the dropdown and give your Applet a title:

And customize the message the notification will send:

If you want to add custom variables, click add ingredient and choose Value1 etc. to be able to push variables to your notification message from your Micropython device.

Then click “Save”. And then if you are needing to send any additional notifications, go ahead and replicate these steps again.

Once you have all the Applets created that you need for your project, go to the Applets tab and click on the title of one of your Applets:

Then click on the title again:

Then click to connect your Applet.

And repeat for the other any other Applets you created.

While you are here, click on the Webhooks icon as well:

And then click on “Documentation”:

You’ll be taken to a page that gives you the url you will use to send push notifications to your device from your Micropython code:

Populate the “{event}” with the default value in your applet (like “open_windows” or whatever you chose) and and use that url in your Micropython code (see the example code below)! You can also pass additional values in the url (like the current temperature inside) with a url structured like this:

https://maker.ifttt.com/trigger/window_close/with/key/YOUR_KEY?value1=12&value2=44

So here’s our sample code:

import urequests"""
Remember if you want to pass variables, you'll need to change the ifttt_url variable to eual this: 'https://maker.ifttt.com/trigger/window_close/with/key/' + ifttt_key + '?value1=' + some_variable + '&value2=' + another_varaible
And then populate the variables with values from your Micropython device (for some_variable and another_variable).
"""
#Your IFTTT Key:
ifttt_key = 'YOUR_KEY_HERE'
ifttt_url = 'https://maker.ifttt.com/trigger/window_close/with/key/' + ifttt_key'send_message = urequests.get(ifttt_url) send_message.close()

And that’s all! Enjoy!

If you enjoyed this article, please clap n number of times and share it!

--

--