-
Adafruit IoT Monthly - February 2019
Welcome to the Adafruit IOT Monthly for the cold month of February (anyone out there making an internet-enabled hot-cocoa machine?). This newsletter (in blog form) highlights projects and updates about Adafruit IO – our Internet-of-Things Service for makers, news, stories, and advances in the world of IoT.
Adafruit IO News: Features and Updates
IO News highlights what’s new on Adafruit IO, our internet-of-things service for makers. There’s been some new updates to the platform since we’ve blogged an IoT Monthly.
New Feature: Feed Webhooks
For Adafruit IO, webhooks are unique URLs that you can use to send data to your feeds from anywhere on the internet, without having to share you IO API secret keys. They’re kind of like one-off API endpoints that you can manage separately from your security credentials and feed privacy. There have long been requests for “shared write access” to feeds, which can be done using the feed sharing feature already built into IO, but that requires everyone sending data to have an Adafruit IO account and use their credentials to send data. That, unfortunately, limits you from, for example, creating a simple web form to publish data directly to a feed.
Read more about this feature on the Adafruit IO Development Blog
Library Update: Adafruit IO Python
We’ve renamed the Python library for Adafruit IO to reflect the naming scheme for our other library - Adafruit IO Arduino. So, IO Client Python is now known as Adafruit IO Python. The IO Team has recently added a few services to Adafruit IO - Dark Sky for weather forecasting and a random data service to create random colors, words, numbers. Until now, you haven’t been able to use these services with the Adafruit IO Python library.
Powered by Adafruit IO: Projects from the Community
Each month, we select our favorite projects from around the internet which use Adafruit IO. Here are some of our favorites:
How to Automate your Home with Adafruit IO
https://www.youtube.com/watch?v=JHmK6N-dhvM MakerIO published a new video on home automation using Adafruit IO. For the sake of simplicity, Robin uses two Huzzah boards to create a ping-pong application between the two of them. One board houses a button, which changes the state of the other board’s LED based on the first button. This simple example can be applied to home automation – one board could be used to control the lights in your home, the garage door, or anything wired up to a relay.
Are you working on a project which uses Adafruit IO and want to show it off? Add the #adafruitio hashtag to your tweets, join our Discord channel (http://adafru.it/discord), or join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.
New Adafruit Learning System Guides
Have you heard about making, cosplay and electronics, but don’t know where to start? Visit the Adafruit Learning System for over 1500 tutorials for electronics projects, ideas and techniques! We’ve selected two, internet-of-things-based guides from the learning system:
LoRa/LoRaWAN Weather Logging Network
Want to build your own network? This new guide uses the Adafruit LoRa radio bonnet with OLED and two Feathers with BME280 sensors to build a Weather Monitoring Network.
Adding a WiFi Co-Processor to CircuitPython
This guide will show you how to connect your CircuitPython board to the Internet by using an ESP8266 or ESP32 as the ‘Wireless modem’ – we’ll even show you how to upload the required AT command firmware to the chip, all from your CircuitPython board
See this guide today - there’s even an example for posting to Adafruit IO!
#IOTuesday: IOT News and Projects from around the ‘net
We publish the latest and most interesting IoT news and projects from around the `net every Tuesday. Here’s some of our favorite recent stories.
The SweRV RISC-V Core from Western Digital
Western Digital announced at the RISC-V Summit three new open-source innovations designed to support Western Digital’s internal RISC-V development efforts and those of the growing RISC-V ecosystem. In his keynote address, Western Digital’s Chief Technology Officer Martin Fink unveiled plans to release a new open source RISC-V core, an open standard initiative for cache coherent memory over a network and an open source RISC-V instruction set simulator.
TWIST is DIY Tweeting Weather Station
Ever wanted to monitor your city’s Current Weather Conditions, Carbon Footprint, Noise and Pollution levels? Do you want be a Climate Change Crusader or set-up your own Tweeting Weather Station and share your local weather conditions with the world? Meet Tweeting Weather IoT Station aka TWIST – a DIY, Open-Source Environmental Monitoring and Meteorological Data Acquisition Platform.
IoT Camera Mover
In making videos for my projects I have often wanted to get a smooth shot of a part, such as a pan of an Arduino Nano. I have seen about 3 projects where people made devices that could pan a camera, but they were either not internet-connected or they were very expensive. So I set out to improve them.
The Internet of Unprofitable Things (never hardcode what you don’t own into an IoT device)
Andy posts on The Ongoing Struggle a story that anyone developing an electronic product but especially an Internet of Things (IoT) product should heed. The subtitle is the NTPmare shortly after Christmas.
How to control a device with a Kronaby smartwatch with IFTTT
Via Mike Diamond on What I Made Today, a look at a special breed of watch that incorporates the characteristics of a regular watch (digital or analog), with select functions of the Smart Watch.
The hybrid smartwatch that caught my attention was the small Swedish company, Kronaby. They specialize in beautifully-designed analog (hybrid) smart watches that radiate prestige, while quietly synchronizing with your phone. They offer multiple functions – applied through their simple, easy-to-use and equally well-designed app. This post is for general interest, but may be most useful to the Kronaby owner who wants to know what their IFTTT function is, and how to use it with their watch.
Let us know how you’re using IO or IO+ on the forums or in our Discord chat room.
-
New Feature! Feed Webhooks
New Feature: Feed Webhooks
What’s a webhook? According to Wikipedia:
A webhook in web development is a method of augmenting or altering the behaviour of a web page, or web application, with custom callbacks. These callbacks may be maintained, modified, and managed by third-party users and developers who may not necessarily be affiliated with the originating website or application.
For Adafruit IO, webhooks are unique URLs that you can use to send data to your feeds from anywhere on the internet, without having to share you IO API secret keys. They’re kind of like one-off API endpoints that you can manage separately from your security credentials and feed privacy.
There have long been requests for “shared write access” to feeds, which can be done using the feed sharing feature already built into IO, but that requires everyone sending data to have an Adafruit IO account and use their credentials to send data. That, unfortunately, limits you from, for example, creating a simple web form to publish data directly to a feed.
There are a few use cases we’ve come up with so far, but we hope to be surprised with what the community can come up with. Here’s two things you can try.
One-off IFTTT Applets
First, other web services that can publish to Webhook URLs like IFTTT’s maker webhooks can be used to directly send data to a feed without entering Adafruit credentials or signing into your Adafruit IO account through IFTTT.
We already support IFTTT directly, but we can’t support every service that exists on the web. We can work with any service that knows how to send webhook-style requests, though :D
Public write-only connections to IO feeds
Second, webhook URLs can be used directly in simple HTML forms, to create a deploy-anywhere application that sends data directly to your feed. For example:
<form target="_blank" action="https://io.adafruit.com/api/v2/webhooks/feed/dQTc61soU5S4tMv8jSuSjY9uSqVz" method="post"> <label> Make a choice: <select name="value"> <option value="YES" selected>Yes</option> <option value="NO">No</option> </select> </label> <button type="submit">Save my vote!</button> </form>
And the actual form in action:
After clicking “Save my vote!” you should see a standard Adafruit IO data record on a new tab, which means your vote was recorded. If you see a “request failed - Throttle error” message instead, that’s because this particular webhook URL’s data rate limit of 3 events per minute has already been reached.
By setting a very low data rate for the webhook, I can share the URL publicly without risking my account, unlike sharing my Adafruit IO Keys. Even better, if the webhook ends up flooded with data, I can just delete it from my account to shut off the stream. And because webhook URLs are write-only, I don’t need to make the feed public.
Publicly controllable Christmas light displays? Crowd-sourced weather monitoring system? GitHub -> Discord -> Adafruit IO cross-posting webhook circle of fun? Let us know what you come up with. Join us in the forum or on Discord in the adafruit-io channel with questions, comments, or suggestions!
-
New Feature: External Service Integrations
Adafruit IO knows the weather!
Or, more accurately, Dark Sky knows the weather and now Adafruit IO knows how to pass it on.
But wait, there’s more!
Adafruit IO ❤️’s Services
We’re excited to introduce you to Adafruit IO’s new “External Service Integration” feature. Also known as “Service Integrations”, also known as “Services”. You can find a link to the new Services page in the navigation sidebar.
The first thing you may notice if you’ve used If This Then That (IFTTT) with Adafruit IO is that we moved that service over to the new Services page.
We’ve also started building out a Zapier integration–currently in private beta–so if you prefer Zapier to IFTTT or you’d just like to keep your options open, you’ll find that on the services homepage also.
But the star of the show is the new Dark Sky-powered weather service.
Weather Data in Adafruit IO
We have wanted to add weather data to Adafruit IO for a long time, and even made an attempt more than two years ago. The biggest issues we faced are that: 1) free weather data services are inconsistent or have very low API limits and 2) even paid weather services often don’t include interesting weather data.
With Dark Sky, we were able to overcome the second problem, but the first still puts some limits on the service we’re able to offer. This means that at launch the weather service is also our first IO Plus exclusive feature.
When you create a new weather location, you have direct access to Dark Sky’s Developer API data through Adafruit IO with some minor limits. Specifically, we’re passing sending a subset of all available forecast data (~4KB of JSON) instead of all available forecast data (~30KB of JSON), and limiting MQTT subscriptions to just one type of data at a time. For example: just the current weather, 5 minute forecast, or 1 day forecast rather than all current and forecasted data with every update.
The Weather API is available via HTTP GET requests or MQTT subscriptions from any authenticated device. IO Plus subscribers can find full documentation for the weather service on the weather service home page.
This is just the first iteration of the Weather API and we’re very interested in hearing your feedback. If you’re an Adafruit IO Plus subscriber, give it a try and let us know what you think.
Random Data Service
Also available now, and to all Adafruit IO accounts, is our brand new Random Data Service! We’ve picked a few types of data (randomly, ha!) to generate and built the system in a way that allows separate Adafruit IO accounts to receive the same data based on the seed value used.
Once every minute, MQTT subscribers get a brand new, hand-crafted (kind of), guaranteed random value. You could build a pair of one time password devices, a color-cycling sculpture, a nonsense Tweeting robot, a dice roller / coin flipper / choose your own adventure pilot…? We don’t know! We just built the thing and hoping that you’ll find an interesting use for it.
We wrote a Ruby library to go along with it for generating word and color values and we’re 100% open to pull requests (celebrate Hacktoberfest with us!) or feature requests if you have an idea for new kinds of data that can be randomly generated.
We’re Just Getting Started
We’re going to be spending a lot of our time in the coming year connecting new services directly to Adafruit IO and improving our existing Triggers system. Keep checking back and please feel encouraged to get in touch with us on the Adafruit IO forum with any questions, concerns, or bug reports.
-
Dashboard Updates: Indicator and Icon Blocks, Drag-and-Drop Images
We’re excited to tell you about two new blocks we’ve added to Adafruit IO dashboards this week to help you build richer interfaces. Icons and Indicators, two features that have been requested a lot in the last few years.
Icon
Icon blocks take a feed value and display the appropriate icon, when the feed value is a string selected from the collection shown here.
You can use Icon blocks as live changeable visual displays by sending different values to the feed, as in the example above, or as permanent labels to improve the display of your data. Drop a text block next to an icon block on your dashboard and drop some icons into the text block to see how they look.
Indicator
Indicator blocks let you pick an
ON
color and anOFF
color and then describe which state the Indicator block should be in based on conditions you set. The block compares the selected feed’s current value to the given conditions and chooses a color accordingly.You can use one condition or as many as you like. Conditions, by default, use Javascript’s
parseFloat
function to attempt to convert the feed’s current value and the condition values to a number for comparison. If either value, the feed or the string, can’t be converted to a number (isNaN(f_value) === true
), then the condition is compared string-to-string.For example, I could create an indicator for a temperature sensor that stays in the
ON
state as long as the value is between 70 and 78.In Javascript, those conditions would be evaluated like this:
function compare(feed_value) { return feed_value >= 70 && feed_value <= 78; }
Or I could create an indicator that turns on whenever my feed matches a particular value.
In this case, the code equivalent would be:
function compare(feed_value) { return feed_value === "ALPHA" || feed_value === "BETA" || feed_value === "GAMMA" || feed_value === "BONANZA"; }
We don’t do any checking on your conditions to make sure they’re logically consistent. The conditions editor will happily let you enter impossible conditions (for example
< 2 and > 2
or= 1 and = 0
), so make sure to do your own testing before creating the block.You may notice in the block editor screenshot above that we’ve given you access the “Test Value” that’s used in the block preview. That should help in testing your conditional logic to make sure the indicator turns on and off at the times you are expecting. Set your conditions and play with the value to see when they trigger. No data is sent to IO when you change the test value, so it’s safe to play with settings on any block.
BONUS! Drag and drop for image blocks
It’s now possible to drag and drop images onto any Image dashboard block to automatically publish the properly formatted Base64 image data string to your feed.
There are some important things to keep in mind when using this feature. Normal feeds are limited to 1KB of data, or about 1024 bytes, for publishing. Turning off feed history from the feed settings page allows publishing up to 100KB, or 102400 bytes, of data. Image conversion from binary to Base64 happens inside the browser, with no image pre-compression, and more importantly, conversion from binary to Base64 expands the size of the image data.
You’ll have to do your own testing to figure out what an appropriate image size and format (png, gif, or bmp) for you are. For example, the .png image used for testing below has an on disk size of 68089 bytes, but a Base64 value of 90788 bytes, an expansion factor of about 150%, which is really close to the limit.
test image
test publishing in block editor
One funny artifact of the drag and drop feature is that IO doesn’t actually care if you’re using the block to publish image data. Any file that can be converted into Base64 (which is any file) can be dropped onto an image block and sent to MQTT subscribers.
Let us know what you’re making!
Join us in the Adafruit IO forum or on Discord in the adafruit-io channel with questions, comments, or suggestions. We love seeing what you all come up with when we add new features to Adafruit IO!
-
New Feature Launch: Feed Sharing
New Feature Launch: Feed Sharing!
You’ve always been able to make your feeds completely public or completely private. Private feeds are hidden from the outside world, no other user can see them and no one browsing Adafruit IO can stumble across them. Public feeds are available as a read-only data source to anyone in the world. Until now, though, there hasn’t been a way to receive data from other Adafruit IO users in your feeds and no way to share your data with just one person.
Feed sharing introduces the ability to share a particular feed with a particular user as a read-only or read-write feed. This means you can keep a feed “private” as far as the whole world is concerned, but allow another Adafruit IO account to send data to it and read data from it.
There are a few new features we had to add to Adafruit IO to make sharing directly with other users possible. Here’s a quick guide to sharing and how to find your way around the new parts of Adafruit IO.
Sharing a feed
Step 1 is to invite another account to share your feed. You can do that from any existing feed page using the new “Sharing” form.
When you invite an account, the person you invite will receive a brief notification email and see the invitation on their shares page. If you share to an email address and they haven’t signed up yet, the person you shared with will have the chance to create a new Adafruit IO account.
If you share with an existing Adafruit IO user via the email address on their Adafruit account or their Adafruit IO username, they’ll be able to review and approve your invitation immediately. After you’ve shared, the user you’re sharing with will get an email:
And a link to the sharing invitation review page:
The sharing page
This is the hub for all your sharing information. Right now you’ll see listings for feeds you are sharing with other Adafruit IO users, and feeds other Adafruit IO users are sharing with you. If you’re blocking any users from inviting you to share with you, you’ll see those accounts listed on this page too.
As we add sharing features to Adafruit IO, this will be where they show up first.
Sharing feed writes
Since you’re able to share feeds as read/write data streams with other registered Adafruit IO users, data rate limiting has to come into the picture. For this new feature, all data rate usage comes from the publishing user. That means when you share your feed with another user and they publish data to it, your data rate usage will remain unchanged while theirs will be affected.
Related MQTT changes
In order to support in-browser MQTT subscriptions to other users’ shared, non-public feeds, we’ve made changes to the output of our
*/json
MQTT topics. Because these topics aren’t used in any of our libraries and aren’t highlighted in our guides, this change will have very little impact on existing MQTT subscribers. Less than 0.4% of MQTT subscriptions will be affected.Before, the output of a subscription to
test_username/feeds/feed-a/json
looked like this:{ "username": "test_username", "owner": { "id": 1, "username": "test_username" }, "id": 4, "name": "Feed B", "description": null, "history": true, "unit_type": null, "unit_symbol": null, "last_value": "-23.908", "visibility": "private", "license": null, "created_at": "2018-05-21T20:52:17Z", "updated_at": "2018-07-26T18:38:00Z", "status_notify": false, "status_timeout": 60, "enabled": true, "key": "feed-b", "groups": [ { "id": 1, "key": "default", "name": "Default", "user_id": 1 } ] }
That’s the same JSON record you would get if you used the HTTP API to retrieve
/api/v2/test_username/feeds/feed-b
, which is helpful if you want information about the feed, but kind of unhelpful if you actually want the new feed data record that prompted the MQTT message.After the launch of feed sharing, the same MQTT subscription output looks like this:
{ "last_value": "-23.908", "updated_at": "2018-07-26 18:38:00 UTC", "key": "feed-b", "data": { "created_at": "2018-07-26T18:38:00.560Z", "value": "-23.908", "location": [ 39.4194156246497, -76.69504058954743, null ], "id": "0DY1QDB7K3VN8YDCYCAD538Z5Q" } }
Because of the always-on nature of the MQTT API and the difficulty of changing topics all at once on client devices, we include the legacy
last_value
field in the new JSON output. If you have a client using*/json
MQTT topic subscriptions, you should update fromjson.last_value
tojson.data.value
to access your feed’s data. After a few months of this new MQTT JSON output format, we will deprecate thelast_value
field and remove it from the MQTT API.Social web services and your safety and security
Because Adafruit IO is an open web service, we don’t review every single feed sharing invitation before it’s sent. In order to prevent repetitive unwelcome sharing invitations from anyone, we will always give you the ability to: ignore individual invites, block a user from being able to invite you to share, or unsubscribe from all sharing invitation emails.
When you ignore an invite, it will be cleared from your sharing page and the user who invited you won’t be able to invite you to that feed again, but they will be able to invite you to share any other feed they own.
When you block a user, they will no longer be able to share any feeds with you at all. Users will never be explicitly informed that you have blocked them, but they may be able to infer it if they can’t share anything with you. Sharing blocks are permanent until and unless you remove them.
Choosing to unsubscribe from sharing invitation emails will keep your inbox clean, so you’ll have to visit your sharing page to see if you have any new sharing invitations.
Adding a social layer to Adafruit IO has always been part of our plan, but we’ll never make your shares public. If you keep every feed and do all your sharing through direct user-to-user feed sharing, your public Adafruit IO page will still exist but remain empty. We believe that your information should be private by default.
While we do not require moderator approval for social activity on Adafruit IO, we do monitor use of the platform. If we believe a feature is being abused for any reason, we continue to reserve the right to disable the feature or limit your use of Adafruit IO. We care about building the best Internet of Things platform for makers and part of that is making sure that it continues to be a safe space for everyone who uses it.
Guides are coming!
We’ll be adding more information to the Adafruit IO welcome guide with most of this information and we’re always checking the Adafruit IO forums, so if you have any questions about feed sharing please stop by and ask.
This is the first iteration of a pretty new feature for us and we’re excited to see how people use it! Join us in the forum or on Discord in the adafruit-io channel with questions, comments, or suggestions.