

In addition to the current temperature, the Netatmo API provides information about the temperature trend, in terms of whether it’s going up, down, or is stable this is reflected in my script by an up arrow or down arrow next to the temperature (I opted to show nothing if the trend is stable, for simplicity).

Once I had the script working, I added a few additional refinements.
SWIFTBAR MACOS CODE
So I couldn’t simply hardcode in the tokens used in the example page-instead, I had to add code to request a token. Netatmo uses a framework called OAuth, which not only requires a more complex process to obtain an authorization token, but also provides tokens that expire after a certain amount of time. The example code shown on the API page includes an authorization token…but that token is only temporary. Data is returned in JSON format, allowing you to pick out the specific information you want.īut the real challenge came in dealing with authentication. Like many APIs, Netatmo’s can be accessed using a variety of programming or scripting languages. Writing the script itself proved to be fairly straightforward it was largely built on a similar script that I’d made to display the current UV level. 1 (The inside module, by comparison, also measures noise and CO2 levels.) However, the outside module collects relatively little information: just temperature and humidity. I was more interested in the outside temperature, though I may adapt it in the future to provide information from both. The standard Netatmo system is composed of two modules: one that sits inside your house and one that goes outside.

Netatmo provides an API to let you retrieve data from its weather stations, and its documentation page even allows you to test it out with your own device (you’ll need to log in to your Netatmo account first). If there’s two things that we here at Six Colors love, it’s putting data in our Macs’ menu bars and the weather-also, of course, combining those two things.įollowing Jason’s previous excursions into adding weather info to his menu bar, I decided to embark upon a similar task with my recently acquired Netatmo weather station and our perennial favorite menu bar utility, SwiftBar.
