I've been playing with touch bar customizations using BetterTouchTool on my new MacBook Pro to try and make it more useful for me, and I've come up with a Cumulus MX powered one I really like.
First, I set up a macOS Launch Agent to automatically query the CMX webserver API (e.g. weather-server.local:8998/api/data/currentdata) every minute and write the result to ~/.pws. It first tries via the Bonjour address then falls back to my actual external IP; this should ensure that if I'm on my local network I'm not leaving it just to hit the computer on the other side of the house, but should get the data when I'm out and about on other networks.
The 4 different states of the Touch Bar when using my CMX-powered customizations
Then, I've then set up a bunch of BTT widgets to show current conditions. These widgets utilize simple applescripts to load the locally saved data from the CMX API, then extract the information using JSON Helper which adds straightforward JSON parsing functionality to AppleScript. Each button is set up to open another button group, which I've populated with more detailed information about that parameter. Additionally, for the main 3 condition overview buttons, I've configured RegEx matching to give them highlight appearances whenever the parameter exceeds a threshold value.
It's all a bit frivolous, but as a weather nerd (I'm actually a meteorologist by trade), it's undeniably cool having live-updating weather conditions from my PWS on my keyboard. Either way, I thought that maybe it'd be worth sharing as a "non-standard" application of Cumulus MX's features!
Discussion of version 3 of Cumulus, which runs on Windows, Linux, and OS X. All Cumulus MX queries in here, please.
2 posts • Page 1 of 1
- Posts: 6
- Joined: Thu Oct 06, 2016 7:40 am
- Weather Station: Davis Vantage Pro
- Operating System: macOS Sierra
Plenty of progress over the past few days; I've discovered that BetterTouchTool supports external scripting, so I've migrated all of the update routines into a single external AppleScript file that is run after the LaunchAgent downloads the data. This is substantially more efficient as only one AppleScript needs to be run now (instead of one for each button) and the updates occur only when it attempts to fetch new data.
I've expanded the number of available parameters and implemented custom colouring for stale data (everything becomes a bit more grey and subdued) and expired data (buttons take on a dark red background). I've begun implementing custom colours depending on parameter values. For example, the current wind button will turn a shade of yellow if sustained winds are over 15 km/h (means it's actually fairly windy at my location) or gusts are over 35 km/h. The button will turn red if sustained winds are over 25 km/h or gusts exceed 50 km/h. Other conditional highlighting will be implemented for most parameters.
Some elements are cross-referenced. For example, in the main Touch Bar display where just the temperature is shown, if my PWS is also reporting a rain rate, then a rain cloud emoji is added to the left of the temperature, just to indicate that it's actively raining.
This has been a fun project, and I'm looking forward to seeing if I can extend integration with the web server API to fetch other data that can be utilized to add more information as well as enhance contextual display of parameters!
Who is online
Users browsing this forum: No registered users and 2 guests