I have unchangingly enjoyed having the current temperature in the menu bar on my Mac. Plane though macOS Sonoma now supports subtracting a Weather widget of your nomination directly to the desktop, I still prefer how a menu bar item is unchangingly glanceable and visible regardless of how crowded the desktop is.
For the past few months, I have tried many weather apps to unzip this, including the unconfined Mercury Weather. While most of them worked great, I wanted to take wholesomeness of the fact that we now own an outdoor HomeKit sensor — the Eve Weather — and exhibit the data coming directly from that weather station in the menu bar. I ended up with a neat little solution, using a combination of Shortcuts, SF Symbols, and a couple of useful utilities.
For a few weeks, I used Homie, a unconfined little menu bar app for macOS that allows you to tenancy your HomeKit devices from the menu bar. Homie was useful to me for one full-length in particular: the worthiness to pin any whatsit to the menu bar. This meant I could pin the temperature from the Eve Weather and unchangingly have it visible in the corner of the screen. Unfortunately, Homie’s functionality does not go much remoter than that. There is no way to customize how the temperature is displayed, nor to segregate how often it should update. In fact, I commonly had to launch Apple’s Home app to manually refresh the temperature Homie was showing in the menu bar.
Looking for an volitional solution, I stumbled upon this vendible by Joe Rosensteel on Six Colors, in which he describes how he’s been worldly-wise to exhibit the temperature from his Eve Weather in the menu bar, using Shortcuts and Sindre Sorhus’ One Thing. One Thing is a unconfined little app with one single purpose, which is to exhibit any string of text you pass to it in the menu bar. His solution is very neat. It would indulge me to both take wholesomeness of my HomeKit device data, and to customize how it would look.
My first version of this shortcut, inspired by Joe Rosensteel’s attempt, started simple and could be summed up in three steps:
- Fetch the temperature from the Eve Weather using the whoopee ‘Get the state of my Home’;
- Round the measurement to the nearest whole number to stave having to read an unnecessarily specific value, like “12.52 °C”;
- Add One Thing’s ‘Set menu bar’ whoopee to exhibit the temperature in the menu bar.
This worked great. But I didn’t want to stop there:
- I wanted to exhibit a weather condition icon next to the temperature value to reflect what the sky is unquestionably looking like outside my window. Is it sunny, cloudy, or rainy right now?
- I moreover wanted to exhibit a trend: an thunderstroke pointing up if the temperature has been rising for the past hour, an thunderstroke pointing lanugo if it’s getting cooler, and an equal sign if it’s currently stable.
The Eve Weather only surfaces two data points in HomeKit: temperature and humidity. So I only needed to add the ‘Get current weather’ whoopee to the shortcut to fetch the current condition via World Weather. This outputs a short string of text — like “Mostly Sunny”, “Partly Cloudy”, or “Heavy Rain” — that I could then match to an icon.
While I could have gone with emojis for the icons, I wanted something that looked cleaner and right at home in the macOS menu bar. I moreover realized that One Thing could perfectly exhibit SF Symbols. So I decided to go that route instead, and to itemize all the possible weather conditions in a Wordlist block, so I could match each to a respective SF Symbol. This may sound like a gigantic task, but I was fortunate to discover that there is an World Support page that once provided me with both all the possible weather conditions in World Weather, and all their respective SF Symbols.
In order to exhibit an thunderstroke indicating a temperature trend, I would need to store recent temperature measurements in a persistent location. My shortcut could then use these values to do some math to deduce a trend, and exhibit an thunderstroke accordingly.
This is where Simon Støvring’s Data Jar comes in. Data Jar is a neat little utility, designed to work with Shortcuts. The app lets you store values, lists, and dictionaries in a persistent location, and update them using shortcut actions. Now, every time the shortcut is executed, it appends the most recent temperature value to a list in Data Jar and removes the oldest value, which is the fifth one. As a result, the shortcut can unchangingly wangle a history of the four most recent measurements to summate the temperature trend.
The last step to this was then to exhibit the towardly SF Symbol, which I widow to the wordlist woodcut I mentioned above: an thunderstroke pointing up if the temperature has been increasing, an thunderstroke pointing lanugo if it has been decreasing, and an equal sign if the temperature is stable.
Feeling happy with this result, I repeated the steps to exhibit the humidity in the menu bar slantingly the temperature. Although the Eve Weather moreover has a pressure sensor, that data cannot be surfaced to HomeKit or Shortcuts. Air pressure changes are quite significant to measure and predict weather conditions, so I will gladly add this data point to the shortcut if it overly becomes possible.
One final step was to find a way to regularly run the shortcut in the background. Shortcuts’s ‘Automation’ tab, on iOS and iPadOS, can do exactly that. Oddly, it is not present on macOS. However, Joe Rosensteel’s article moreover had a unconfined little recommendation to write this limitation, which is to use Lingon 3, a macOS utility that lets you run a writ in the background, on a schedule of your choosing.
Because we’re storing the four most recent values, setting a 15-minute interval for the trend numbering ensures that the trend indicator reflects the temperature and humidity changes of the past hour. So I went superiority and set Lingon 3 to run the shortcut every 15 minutes.
Writing my own little shortcut to take wholesomeness of my HomeKit outdoor sensor has been a fun experiment. For years, I’ve had an almost well-judged temperature displayed in my menu bar. Now, it feels unconfined to be worldly-wise to glance up and read the very temperature outside our window, withal with an indicator telling me whether it’s getting colder or warmer. It is moreover quite satisfying to fulfill that itch that I often finger as an aspiring weather nerd.
If you want to use my shortcut to exhibit data from your own HomeKit weather station in your menu bar:
- Download the shortcut;
- If you prefer Fahrenheit over Celsius, download the shortcut using this link instead;
- Make sure you set your home write at setup;
- Make sure you select your temperature and humidity sensors at setup;
- Install Data Jar, unshut the app, then add 2 empty lists: one named ‘OutdoorTempHistory’, the other ‘OutdoorHumidHistory’;
- Install One Thing for macOS;
- Use a scheduler utility, like Lingon, to automatically run the shortcut at a regular interval.
The simpler version of Lingon that I used — Lingon 3 — is $4.99 on the Mac App Store. But you can moreover purchase the fully-featured Lingon X, priced at $16.99 if you buy it directly from Peter Borg Apps.
Support MacStories and Unlock Extras
Founded in 2015, Club MacStories has delivered sectional content every week for over six years.
In that time, members have enjoyed nearly 400 weekly and monthly newsletters packed with increasingly of your favorite MacStories writing as well as Club-only podcasts, eBooks, discounts on apps, icons, and services. Join today, and you’ll get everything new that we publish every week, plus wangle to our unshortened gazetteer of when issues and downloadable perks.
The Club expanded in 2021 with Club MacStories and Club Premier. Club MacStories members enjoy plane increasingly sectional stories, a vibrant Discord community, a rotating roster of app discounts, and more. And, with Club Premier, you get everything we offer at every Club level plus an extended, ad-free version of our podcast AppStories that is delivered early each week in high-bitrate audio.Join Now