fokiinfinity.blogg.se

Sleepwatcher mac
Sleepwatcher mac










sleepwatcher mac
  1. #SLEEPWATCHER MAC FULL#
  2. #SLEEPWATCHER MAC MAC#
sleepwatcher mac

(i just copy, pasted and changed this from someones else’s config, AFAIK this: GitHub jhgg/Hammerspoon-Config The sleep_a (and some other modules) are in a folder called modules in the same directory as a and get initialed by the init script. Table.insert(buf, "Hammerspoon re-loaded: ") Table.insert(buf, "Hammerspoon loaded: ") This is my hammerspoon config ( a): local alert = require 'hs.alert'įor part in string.gmatch(key_path, "+") do

sleepwatcher mac

#SLEEPWATCHER MAC MAC#

something like this should also work for setting mqtt topics for your screen status or any other mac status or telemetry. Hammerspoon has a steep learning curve, but is a very usefull tool, that i don’t want to miss any more. it retries serveral times to connect to the net, to give the mac time after wakeup to connect to the network. If your mqtt broker is accessible from outside your network, this works anywhere, if the mac has an internet connection. Hs.execute('/Users/ix/Library/Application\\ Support/LaunchBar/Actions/wake.lbaction/Contents/Scripts/wake.sh', true) Hs.notify.show("Wake sequence initiated!", "", "") Hs.execute('/Users/ix/Library/Application\\ Support/LaunchBar/Actions/sleep.lbaction/Contents/Scripts/sleep.sh', true)Įlseif (eventType = hs.) then Sleep_a local sleepWatcher = require 'hs.caffeinate.watcher' sh file to call other services, too) with the hammerspoon caffeinate.watcher function: This is the module that i use to call the scripts (embedded in a. Publish_message("ixbook/sleep/status", "start") Publish.single(topic, message, hostname="mqtt-hostname", port=, auth=auth, tls=tls, retain=True) Publish_message("ixbook/sleep/status", "stop")

sleepwatcher mac

Publish.single(topic, message, hostname="", port=, auth=auth, tls=tls, retain=True) 'ca_certs':"/usr/local/etc/openssl/cert.pem", Print("Publishing to MQTT topic: " + topic) I’m getting pretty reliable results with hammerspoon now, calling the scripts when the mac awakes or goes to sleep.ĭef wait_for_internet_connection(url=' timeout=5): i also tried sleepwatcher, but moved away from that because of lacking support for newer operating systems. i used to call the scripts with scenario, which didn’t work as reliably as i wished.

  • Also it could be that launchd closes the tasks you started in your script when it reaches its end.I’m using two python scripts on my macbook that set an mqtt topic for a sleep sensor.
  • I had issues running fswatch, so I had to replace fswatch by /usr/local/bin/fswatch

    #SLEEPWATCHER MAC FULL#

  • complement any executable name by its full path.
  • If your script does not run after entering the commands above: You can check if it is loaded with the command by entering: Launchctl unload ~/Library/LaunchAgents/.plist This tells launchd to load the task and will run it immediately. Launchctl load ~/Library/LaunchAgents/.plist Now place .plist in ~/Library/LaunchAgents and run in terminal: I fixed it with a script (togglewifi.sh as below) that turns wifi off/on on wake.

    /Users/philipp/Documents/Backups/SURSERV/backup_all.sh

    Next think of a name in the following reverse domain notation .plist and create the property list file (.plist) with the following content: Mai 2018įirst of all create your bash script and place it somewhere.












    Sleepwatcher mac