hammerspoon script to toggle a Home-assistant switch on wake/sleep of my MacBook
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
init.lua

README.md

HASS-hammerspoon

hammerspoon init.lua script to toggle a Home-assistant switch when my MacBook wakes/sleeps. Makes use of hs.http.post. Just brew install hammerspoon, navigate to ~/.hammerspoon and add init.lua. If you don't use a password on your HASS instance, just delete headers from init.lua.

In my home-assistant I use a dummy command_line switch to represent the Mac, and in my config I simply have:

switch:
  - platform: command_line
    switches:
      macbook_power:
        command_on: ""
        command_off: ""