I have always enjoyed having the current temperature in the menu bar on my Mac. Even though macOS Sonoma now supports adding a Weather widget of your choice directly to the desktop, I still prefer how a menu bar item is always glanceable and visible regardless of how crowded the desktop is.
For the past few months, I have tried many weather apps to achieve this, including the great Mercury Weather. While most of them worked great, I wanted to take advantage of the fact that we now own an outdoor HomeKit sensor — the Eve Weather — and display 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 great little menu bar app for macOS that allows you to control your HomeKit devices from the menu bar. Homie was useful to me for one feature in particular: the ability to pin any accessory to the menu bar. This meant I could pin the temperature from the Eve Weather and always have it visible in the corner of the screen. Unfortunately, Homie’s functionality does not go much further than that. There is no way to customize how the temperature is displayed, nor to choose how often it should update. In fact, I frequently had to launch Apple’s Home app to manually refresh the temperature Homie was showing in the menu bar.
Looking for an alternative solution, I stumbled upon this article by Joe Rosensteel on Six Colors, in which he describes how he’s been able to display the temperature from his Eve Weather in the menu bar, using Shortcuts and Sindre Sorhus’ One Thing. One Thing is a great little app with one single purpose, which is to display any string of text you pass to it in the menu bar. His solution is very neat. It would allow me to both take advantage 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 action ‘Get the state of my Home’;
- Round the measurement to the nearest whole number to avoid having to read an unnecessarily specific value, like “12.52 °C”;
- Add One Thing’s ‘Set menu bar’ action to display the temperature in the menu bar.
This worked great. But I didn’t want to stop there:
- I wanted to display a weather condition icon next to the temperature value to reflect what the sky is actually looking like outside my window. Is it sunny, cloudy, or rainy right now?
- I also wanted to display a trend: an arrow pointing up if the temperature has been rising for the past hour, an arrow pointing down 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’ action to the shortcut to fetch the current condition via Apple 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 also realized that One Thing could perfectly display SF Symbols. So I decided to go that route instead, and to catalog all the possible weather conditions in a Dictionary block, so I could match each to a corresponding SF Symbol. This may sound like a gigantic task, but I was fortunate to discover that there is an Apple Support page that already provided me with both all the possible weather conditions in Apple Weather, and all their corresponding SF Symbols.
In order to display an arrow 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 display an arrow 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 always access a history of the four most recent measurements to calculate the temperature trend.
The last step to this was then to display the appropriate SF Symbol, which I added to the dictionary block I mentioned above: an arrow pointing up if the temperature has been increasing, an arrow pointing down if it has been decreasing, and an equal sign if the temperature is stable.
Feeling happy with this result, I repeated the steps to display the humidity in the menu bar alongside the temperature. Although the Eve Weather also 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 ever 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 also had a great little recommendation to address this limitation, which is to use Lingon 3, a macOS utility that lets you run a command 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 calculation ensures that the trend indicator reflects the temperature and humidity changes of the past hour. So I went ahead and set Lingon 3 to run the shortcut every 15 minutes.
Writing my own little shortcut to take advantage of my HomeKit outdoor sensor has been a fun experiment. For years, I’ve had an almost accurate temperature displayed in my menu bar. Now, it feels great to be able to glance up and read the actual temperature outside our window, along with an indicator telling me whether it’s getting colder or warmer. It is also quite satisfying to fulfill that itch that I often feel as an aspiring weather nerd.
If you want to use my shortcut to display 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 address at setup;
- Make sure you select your temperature and humidity sensors at setup;
- Install Data Jar, open 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 also purchase the fully-featured Lingon X, priced at $16.99 if you buy it directly from Peter Borg Apps.