Skip to content

fluteds/ha-mtmr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ha-mtmr

Home Assistant controls for the macOS Touch Bar via MTMR.

  • Toggle lights and switches with live state display
  • Brightness up/down for all on lights, or scoped to a single light/group
  • Color temperature up/down for lights in mired mode
  • Trigger scenes, scripts, and automations
  • Climate display and setpoint control (±0.5°)
  • Cycle and display input_select entities
  • Send push notifications via the HA notify service
  • Display live sensor readings (temperature, CO2, etc.)
  • Presence indicator - shows your current room when home (bed, desk, etc.) or your HA zone when away
  • Open HA in the browser
  • Group all HA buttons behind a single 🏠 Home popover to save space
  • State caching - buttons read from /tmp/ha_cache/ so opens are instant; cache is busted on toggle so state reflects within ~5 seconds

The image displays the top section of a user interface with various icons and text on a black background. From left to right, there is a light bulb icon, text reading "O Desk O NL," followed by sun icons and a lightning bolt icon, and "O Bed." Next are media control icons for play/pause, previous, and next tracks. The text "RAYE – Nightingale Lane" is followed by a sun icon with "17°C." Further right is a muted speaker icon, a graph, a crescent moon icon, a circle icon, more sun icons, and a battery icon showing 98% with the time left "2:01."

Setup

  1. Install by cloning the repo then copying .ha to your home directory
cp ha ~/.ha
chmod +x ~/.ha
cp ha_config.example ~/.ha_config
  1. Configure

Edit ~/.ha_config:

HA_URL="https://your-ha-domain.com"
HA_TOKEN="your_long_lived_access_token"

Get a token in HA → Profile → Long-Lived Access Tokens.

  1. Add to MTMR

Copy items from mtmr-items.jsonc into your ~/Library/Application Support/MTMR/items.json, replacing entity IDs with your own. Find your entity IDs in HA → Developer Tools → States.

Reload MTMR.

Commands

# Lights
~/.ha status <entity_id> [ShortName]             # show state for Touch Bar display
~/.ha toggle <entity_id>                         # toggle on/off
~/.ha brightness_up                              # +10% brightness on all on lights
~/.ha brightness_down                            # -10% brightness on all on lights
~/.ha brightness_up_group <entity_id>            # +10% brightness on a specific light/group
~/.ha brightness_down_group <entity_id>          # -10% brightness on a specific light/group
~/.ha color_temp_up                              # warmer (all on lights in color_temp mode)
~/.ha color_temp_down                            # cooler (all on lights in color_temp mode)

# Scenes, scripts, automations
~/.ha scene_activate <entity_id>                 # activate a scene
~/.ha script <entity_id>                         # run a script
~/.ha automation <entity_id>                     # trigger an automation

# Climate
~/.ha climate <entity_id>                        # show current temp and setpoint
~/.ha climate_up <entity_id>                     # increase setpoint by 0.5°
~/.ha climate_down <entity_id>                   # decrease setpoint by 0.5°

# Input select
~/.ha input_select_status <entity_id> [Label]    # display current option
~/.ha input_select_next <entity_id>              # cycle to next option

# Sensors and presence
~/.ha sensor <entity_id> [ShortName]             # display a sensor value with unit
~/.ha person <entity_id>                         # show home/away for a person entity
~/.ha where                                      # show current room or zone (edit entity IDs in script)

# Notifications
~/.ha notify "message" [notify_service]          # send a push notification (default service: notify)

# Other
~/.ha open                                       # open Home Assistant in the browser

Presence / where

The where command checks person.person_name and cross-references Aqara FP2 bedroom zones. Edit the entity IDs in the where case of ha to match your setup.

State Display
At desk (FP2 zone) 💻 Desk
In bed (FP2 zone) 🛏 Bed
Elsewhere in bedroom 🛏 Bedroom
Home, location unknown 🏠 Home
At gym zone 🏋 Gym
At work zone 💼 Work
Away 🚗 Away

Notes

  • Tested on macOS 15 with MTMR 0.27
  • Requires curl and python3 (both included with macOS)
  • shellScript action type crashes MTMR - actions must use appleScript with do shell script

About

Home Assistant controls for the macOS Touch Bar via MTMR

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages