Module for editing power settings on macOS
New in version 2016.3.0.
salt.modules.mac_power.
get_computer_sleep
()¶Display the amount of idle time until the computer sleeps.
A string representing the sleep settings for the computer
CLI Example:
..code-block:: bash
salt '*' power.get_computer_sleep
salt.modules.mac_power.
get_display_sleep
()¶Display the amount of idle time until the display sleeps.
A string representing the sleep settings for the displey
CLI Example:
..code-block:: bash
salt '*' power.get_display_sleep
salt.modules.mac_power.
get_harddisk_sleep
()¶Display the amount of idle time until the hard disk sleeps.
A string representing the sleep settings for the hard disk
CLI Example:
..code-block:: bash
salt '*' power.get_harddisk_sleep
salt.modules.mac_power.
get_restart_freeze
()¶Displays whether 'restart on freeze' is on or off if supported
A string value representing the "restart on freeze" settings
string
CLI Example:
salt '*' power.get_restart_freeze
salt.modules.mac_power.
get_restart_power_failure
()¶Displays whether 'restart on power failure' is on or off if supported
A string value representing the "restart on power failure" settings
string
CLI Example:
salt '*' power.get_restart_power_failure
salt.modules.mac_power.
get_sleep
()¶Displays the amount of idle time until the machine sleeps. Settings for Computer, Display, and Hard Disk are displayed.
A dictionary containing the sleep status for Computer, Display, and Hard Disk
CLI Example:
salt '*' power.get_sleep
Displays whether 'allow power button to sleep computer' is on or off if supported
A string value representing the "allow power button to sleep computer" settings
string
CLI Example:
salt '*' power.get_sleep_on_power_button
salt.modules.mac_power.
get_wake_on_modem
()¶Displays whether 'wake on modem' is on or off if supported
A string value representing the "wake on modem" settings
CLI Example:
salt '*' power.get_wake_on_modem
salt.modules.mac_power.
get_wake_on_network
()¶Displays whether 'wake on network' is on or off if supported
A string value representing the "wake on network" settings
string
CLI Example:
salt '*' power.get_wake_on_network
salt.modules.mac_power.
set_computer_sleep
(minutes)¶Set the amount of idle time until the computer sleeps. Pass "Never" of "Off" to never sleep.
minutes -- Can be an integer between 1 and 180 or "Never" or "Off"
int, str
True if successful, False if not
CLI Example:
salt '*' power.set_computer_sleep 120
salt '*' power.set_computer_sleep off
salt.modules.mac_power.
set_display_sleep
(minutes)¶Set the amount of idle time until the display sleeps. Pass "Never" of "Off" to never sleep.
minutes -- Can be an integer between 1 and 180 or "Never" or "Off"
int, str
True if successful, False if not
CLI Example:
salt '*' power.set_display_sleep 120
salt '*' power.set_display_sleep off
salt.modules.mac_power.
set_harddisk_sleep
(minutes)¶Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off" to never sleep.
minutes -- Can be an integer between 1 and 180 or "Never" or "Off"
int, str
True if successful, False if not
CLI Example:
salt '*' power.set_harddisk_sleep 120
salt '*' power.set_harddisk_sleep off
salt.modules.mac_power.
set_restart_freeze
(enabled)¶Specifies whether the server restarts automatically after a system freeze. This setting doesn't seem to be editable. The command completes successfully but the setting isn't actually updated. This is probably a macOS. The functions remains in case they ever fix the bug.
enabled (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' power.set_restart_freeze True
salt.modules.mac_power.
set_restart_power_failure
(enabled)¶Set whether or not the computer will automatically restart after a power failure.
enabled (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' power.set_restart_power_failure True
salt.modules.mac_power.
set_sleep
(minutes)¶Sets the amount of idle time until the machine sleeps. Sets the same value for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers that should never sleep.
minutes -- Can be an integer between 1 and 180 or "Never" or "Off"
int, str
True if successful, False if not
CLI Example:
salt '*' power.set_sleep 120
salt '*' power.set_sleep never
Set whether or not the power button can sleep the computer.
enabled (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' power.set_sleep_on_power_button True
salt.modules.mac_power.
set_wake_on_modem
(enabled)¶Set whether or not the computer will wake from sleep when modem activity is detected.
enabled (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' power.set_wake_on_modem True
salt.modules.mac_power.
set_wake_on_network
(enabled)¶Set whether or not the computer will wake from sleep when network activity is detected.
enabled (bool) -- True to enable, False to disable. "On" and "Off" are also acceptable values. Additionally you can pass 1 and 0 to represent True and False respectively
True if successful, False if not
CLI Example:
salt '*' power.set_wake_on_network True