Main Sequence Generator Pro
DYI: Notifications from SGPro to an electricimp device
This is a quick way to send notifications from SGPpro to a device. Depending on the type of message the SGpro sends to the device, the device will light up a certain color LED. I am using an electricimp, if you are nor familiar with this particular device start here. SGP sends emails with the following titles:
- SGPro Error
- SGPro Warning
- Test Message from SGPro
The messages will be from SGPro through a mailgun account and routed to the electricimp. The imp will parse the message subject and accordingly will display:
- Green – All good
- Red – Error
- Yellow – Warning
- Blue – Test
- All – Unknown message
First you need to setup a free mailgun account. Follow the steps in this post. After completing this step you need to set up a route. Effectively, mailgun receives your message then sends an HTTP Post with details to your imp. There are four parts:
- Hardware Setup
- Electricimp code
- Mailgun routing setup
- SGpro Setup
1. Hardware Setup
You need an electric imp device. I also connected a LiPo battery since I wanted it to be portable. However, that is not a necessary step as you can power your imp through USB. You can also put the device in a case to make it more visually appealing.
- Electricimp breakout
- Red,Blue,Yellow,Green Led
- Mini Breadboard
- Jumper wire
- Optional: Polymer Lithium Battery
- Optional: LiPo USB charger
- Resistors (I used 200KΩ)
There is plenty room to adjust components in the list. I just used my spare parts.
The first step is to assemble and power your electricimp. Read this.
Then connect your leds to the pins via a resistor as follows. Read this first.
- Blue led goes to pin 7
- Red led goes to pin 8
- Yellow led goes to pin 9
- Green led goes to pin 5
All the cathodes are connected to ground.
This step might take awhile, be patient.
2. Electricimp code
The imp uses an online IDE. Read this to understand how to setup and program the imp.
My code is available here. Finally make a note of the agent’s address (the one circled) It should look like this:
3. Mailgun routing setup
Before this step you need to have a mailgun account setup. See my post and follow instructions.
Now lets set up the routing options. Read more about routes here. In mailgun, select the following routes:
Create a new route
The rules are pretty simple.
- Filter Expression = email@example.com
- Actions : Store(Notify:https://agent.electricimp.com/xxxxxxx
4. SGPro Setup
In SGPro add a new Address, which is the firstname.lastname@example.org. Press Test and you should see :
DYI: Notifications from SGPro to your iphone
SGPro added notifications through email. This is a quick way to get notifications in Prowl (and Growl) on your iphone.
First you need to purchase Prowl form the iTunes store here. Or through your iPhone’s store
You also have to have a mail account. I created a mailgun account so I do not clutter my main mailbox.
To create a mailgun account, and get the settings go to www.mailgun.com. Sign up for a free account. Then form the mail panel:
You will be given API Keys and the default postmaster@XXX.mailgun.org account. You will need to create a new account.
click on activate:
click Manage SMTP credentials
and create a new account. I used email@example.com and password. You will need this to configure the SGP mail settings
You next have to create a Prowl email account. So go to prowlapp.com
Select API Keys and generate a new key. Name it SGPPro:
Now you have an API Email for your app (firstname.lastname@example.org). Now lets tailor it together.
Start SGPro and Select Tools/Configure Notifications/Settings
For address enter the prowl email you created above
and for you settings add the settings from your mailgun server.
Use smpt.mailgun.org for SMTP Server
Username and password are the ones you created (email@example.com)
Press test and watch for the notification in your iPhone. Enjoy!!!! 😉