docs » WiFiTransitions

Allow arbitrary actions when transitioning between SSIDs


API Overview

API Documentation


Signature WiFiTransitions.actions
Type Variable

Table containing a list of actions to execute for SSID transitions. Each action is itself a table with the following keys:

  • to - if given, pattern to match against the new SSID. Defaults to match any network. Transitions through the disabled state are ignored (i.e. normally a nil SSID is reported when switching SSIDs)
  • from - if given, pattern to match against the previous SSID. Defaults to match any network.
  • fn - function to execute if there is a match. Can also be a list of functions, which will be executed in sequence. Each function will receive the following arguments:
    • event - always "SSIDChange"
    • interface - name of the interface on which the SSID changed
    • old_ssid - previous SSID name
    • new_ssid - new SSID name
  • cmd - shell command to execute if there is a match. Can also be a list of commands, which will be executed in sequence using hs.execute. If fn is given, cmd is ignored.
Signature WiFiTransitions.logger
Type Variable

Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.


Signature WiFiTransitions:processTransition(new_ssid, prev_ssid, interface)
Type Method

Process the rules and execute any actions corresponding to the specified transition.

This method is called internally by the hs.wifi.watcher object when WiFi transitions happen. It does not get any system information nor does it set any Spoon state information, so it can also be used to "trigger" transitions manually, either for testing or if the automated processing fails for any reason.


  • new_ssid - new SSID name
  • prev_ssid - previous SSID name. Defaults to nil
  • interface - interface where the transition occurred. Defaults to nil
Signature WiFiTransitions:start()
Type Method

Start the WiFi watcher


  • The WiFiTransitions spoon object