API Reference

Client

class aioguardian.Client(ip_address: str, *, port: int = 7777, request_timeout: int = 10, command_retries: int = 3)

Define the class that can send commands to a Guardian device.

Parameters:
  • ip_address (str) – The IP address or FQDN of the Guardian device
  • port (int) – The port to connect to
  • request_timeout (int) – The number of seconds to wait before timing out a request
  • command_retries (int) – The number of attempts to retry a command that times out
connect() → None

Connect to the Guardian device.

disconnect() → None

Close the connection.

execute_raw_command(command_code: int, *, params: Optional[dict] = None, silent: bool = True) → dict

Execute a command via its integer-based command code.

A mapping of command-code-to-command can be seen in the Command helper.

Parameters:
  • command (int) – The command code to execute
  • params (dict) – Any parameters to send along with the command
  • silent (bool) – If True, silence “beep” tones associated with this command
Return type:

dict

Command Helpers

Define command helpers.

class aioguardian.helpers.command.Command

Define a Guardian UDP command mapping.

iot_publish_state = 65
sensor_pair_dump = 48
sensor_pair_sensor = 49
sensor_paired_sensor_status = 51
sensor_unpair_sensor = 50
system_diagnostics = 1
system_factory_reset = 255
system_onboard_sensor_status = 80
system_ping = 0
system_reboot = 2
system_upgrade_firmware = 4
valve_close = 18
valve_halt = 19
valve_open = 17
valve_reset = 20
valve_status = 16
wifi_configure = 34
wifi_disable_ap = 36
wifi_enable_ap = 35
wifi_list = 38
wifi_reset = 33
wifi_scan = 37
wifi_status = 32
aioguardian.helpers.command.get_command_from_code(command_code: int) → aioguardian.helpers.command.Command

Return the command for a particular code.

Parameters:command_code (int) – The command code to search for
Return type:aioguardian.helpers.command.Command()
aioguardian.helpers.command.get_command_from_name(command_name: str) → aioguardian.helpers.command.Command

Return the command for a particular name.

Parameters:command_name (str) – The command name to search for
Return type:aioguardian.helpers.command.Command()

Command Classes

The classes should not be instantiated directly; rather, they exist as properties of a aioguardian.Client() class:

IOT

class aioguardian.commands.iot.IOTCommands(execute_command: Callable[[...], Coroutine[T_co, T_contra, V_co]])

Define an object to manage IOT commands.

Note that this class shouldn’t be instantiated directly; an instance of it will automatically be added to the Client (as client.iot).

publish_state(*, silent: bool = True) → dict

Publish the device’s complete state to the Guardian cloud.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict

Sensor

class aioguardian.commands.sensor.SensorCommands(execute_command: Callable[[...], Coroutine[T_co, T_contra, V_co]])

Define an object to manage sensor commands.

Note that this class shouldn’t be instantiated directly; an instance of it will automatically be added to the Client (as client.sensor).

pair_dump(*, silent: bool = True) → dict

Dump information on all paired sensors.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
pair_sensor(uid: str, *, silent: bool = True) → dict

Pair a new sensor to the device.

Parameters:
  • uid (str) – The UID of the sensor to pair
  • silent (bool) – If True, silence “beep” tones associated with this command
Return type:

dict

paired_sensor_status(uid: str, *, silent: bool = True) → dict

Get the status (leak, temperature, etc.) of a paired sensor.

Parameters:
  • uid (str) – The UID of the sensor to pair
  • silent (bool) – If True, silence “beep” tones associated with this command
Return type:

dict

unpair_sensor(uid: str, *, silent: bool = True) → dict

Unpair a sensor from the device.

Parameters:
  • uid (str) – The UID of the sensor to unpair
  • silent (bool) – If True, silence “beep” tones associated with this command
Return type:

dict

System

class aioguardian.commands.system.SystemCommands(execute_command: Callable[[...], Coroutine[T_co, T_contra, V_co]])

Define an object to manage system commands.

Note that this class shouldn’t be instantiated directly; an instance of it will automatically be added to the Client (as client.system).

diagnostics(*, silent: bool = True) → dict

Retrieve diagnostics info.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
factory_reset(*, silent: bool = True) → dict

Perform a factory reset on the device.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
onboard_sensor_status(*, silent: bool = True) → dict

Retrieve status of the valve controller’s onboard sensors.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
ping(*, silent: bool = True) → dict

Ping the device.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
reboot(*, silent: bool = True) → dict

Reboot the device.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
upgrade_firmware(*, url: str = None, port: int = None, filename: str = None, silent: bool = True) → dict

Upgrade the firmware on the device.

Parameters:
  • url (str) – The firmware file’s optional URL
  • port (int) – The firmware file’s optional port
  • filename (str) – The firmware file’s optional filename
  • silent (bool) – If True, silence “beep” tones associated with this command
Return type:

dict

Valve

class aioguardian.commands.valve.ValveCommands(execute_command: Callable[[...], Coroutine[T_co, T_contra, V_co]])

Define an object to manage valve commands.

Note that this class shouldn’t be instantiated directly; an instance of it will automatically be added to the Client (as client.valve).

close() → dict

Close the valve.

Return type:dict
halt() → dict

Halt the valve.

Note that calling this method will cause the device to no longer respond to leak events; therefore, it is not recommended to leave the device in a “halted” state indefinitely.

Return type:dict
open() → dict

Open the valve.

Return type:dict
reset(*, silent: bool = True) → dict

Reset the valve.

This fully resets system motor diagnostics (including open/close count and lifetime average current draw) and cannot be undone.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
status(*, silent: bool = True) → dict

Retrieve status of the valve.

In the payload that is returned, the state attribute of the valve can be any one of the following:

  • closed
  • closing
  • default
  • finish_closing
  • finish_opening
  • free_spin
  • halted
  • opened
  • opening
  • stalled
  • start_closing
  • start_halt
  • start_opening
Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict

WiFi

class aioguardian.commands.wifi.WiFiCommands(execute_command: Callable[[...], Coroutine[T_co, T_contra, V_co]])

Define an object to manage WiFi commands.

Note that this class shouldn’t be instantiated directly; an instance of it will automatically be added to the Client (as client.wifi).

configure(ssid: str, password: str, *, silent: bool = True) → dict

Configure the device to a wireless network.

Parameters:
  • ssid (str) – The SSID to connect to
  • password (str) – The SSID’s password
  • silent (bool) – If True, silence “beep” tones associated with this command
Return type:

dict

disable_ap(*, silent: bool = True) → dict

Disable the device’s onboard WiFi access point.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
enable_ap(*, silent: bool = True) → dict

Enable the device’s onboard WiFi access point.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
list(*, silent: bool = True) → dict

List previously scanned nearby SSIDs.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
reset(*, silent: bool = True) → dict

Erase and reset all WiFi settings.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
scan(*, silent: bool = True) → dict

Scan for nearby SSIDs.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict
status(*, silent: bool = True) → dict

Return the current WiFi status of the device.

Parameters:silent (bool) – If True, silence “beep” tones associated with this command
Return type:dict

Errors

Define exception types for aioguardian.

exception aioguardian.errors.CommandError

Define an error related to commands (invalid commands, invalid params, etc.).

exception aioguardian.errors.GuardianError

Define a base error from which all others inherit.

exception aioguardian.errors.SocketError

Define an error related to UDP socket issues.