grizzly v0.4.2 Grizzly View Source

Grizzly functions for controlling Z-Wave devices and the Z-Wave network.

Sending commands to Z-Wave

The most fundamental function in Grizzly is Grizzly.send_command/3.

The way to use this function is to provide a connected thing, a command, and the command arguments if needed.

A connected thing is either Grizzly.Conn.t(), Grizzly.Controller, or Grizzly.Node.t().

A command is a module that implements the Grizzly.Command behaviour.

The args are a keyword list that are supported by the command, this argument is optional so you can use Grizzly.send_command/2.

An example of getting a door lock state would look like:

iex> Grizzly.send_command(door_lock, Grizzly.CommandClass.DoorLock.OperationGet)
{:ok, :unsecured}

To know more commands and their arugments see the modules under the Grizzly.CommandClass name space.

Link to this section Summary

Types

A type the repersents things the have/can establish connections to the Z/IP network.

Functions

Put network in inclusion mode

Put network out of inclusion mode

Close a connection

Get the command classes supported by a node.

Whether the node's command class versions are known

Whether a node is connected.

Get the version of a node's command class, if the node does not have a version for this command class this function will try to get it from the Z-Wave network.

Get a node from the network

List the nodes on the Z-Wave network

Whether a node has a given command class

Check to see if the network is busy

Check to see if the network is ready

Put network in exclusion mode

Put network out of exclusion mode

Reset the Z-Wave Module to a clean state

Send a command to the Z-Wave device, first checking if in inclusion/exclusion state.

Put the controller in learn mode for a few seconds

Subscribe to notifications about a topic

Update the command class version of a node

Link to this section Types

Link to this type

connected() View Source
connected() :: Grizzly.Conn.t() | Grizzly.Controller | Grizzly.Node.t()

A type the repersents things the have/can establish connections to the Z/IP network.

  1. Conn.t - A Connection struct
  2. Grizzly.Controller - The controller process, this is a global, started on application start process
  3. Node.t - This is a Z-Wave Node that has been connected to the network
Link to this type

seq_number() View Source
seq_number() :: 0..255

Link to this section Functions

Link to this function

add_node(opts \\ []) View Source
add_node([Grizzly.Inclusion.opt()]) ::
  :ok | {:error, {:invalid_option, Grizzly.Inclusion.invalid_opts_reason()}}

Put network in inclusion mode

Link to this function

add_node_stop() View Source
add_node_stop() :: :ok

Put network out of inclusion mode

Link to this function

close_connection(conn) View Source
close_connection(Grizzly.Conn.t()) :: :ok

Close a connection

Link to this function

command_class_names(node) View Source
command_class_names(Grizzly.Node.t()) :: [atom()]

Get the command classes supported by a node.

Link to this function

command_class_versions_known?(zw_node) View Source
command_class_versions_known?(Grizzly.Node.t()) :: boolean()

Whether the node's command class versions are known

Whether a node is connected.

Link to this function

get_command_class_version(node, command_class_name) View Source
get_command_class_version(Grizzly.Node.t(), atom()) ::
  {:ok, non_neg_integer()} | {:error, atom()}

Get the version of a node's command class, if the node does not have a version for this command class this function will try to get it from the Z-Wave network.

Link to this function

get_node(node_id) View Source
get_node(Grizzly.Node.node_id()) ::
  {:ok, Grizzly.Node.t()} | {:error, :node_not_found}

Get a node from the network

This does not make a DTLS connection to the Node.t() and if you want to connect to the node use Grizzly.Node.connect/1.

Link to this function

get_nodes() View Source
get_nodes() :: {:ok, [Grizzly.Node.t()]} | {:error, :unable_to_get_nodes}

List the nodes on the Z-Wave network

Link to this function

has_command_class?(node, command_class_name) View Source
has_command_class?(Grizzly.Node.t(), atom()) :: boolean()

Whether a node has a given command class

Link to this function

network_busy?() View Source
network_busy?() :: boolean()

Check to see if the network is busy

Link to this function

network_ready?() View Source
network_ready?() :: boolean()

Check to see if the network is ready

Link to this function

remove_node(opts \\ []) View Source
remove_node([Grizzly.Inclusion.opt()]) :: :ok

Put network in exclusion mode

Put network out of exclusion mode

Link to this function

reset_controller() View Source
reset_controller() :: :ok | {:error, :network_busy}

Reset the Z-Wave Module to a clean state

Link to this function

send_command(connected, command_module, command_opts \\ []) View Source
send_command(connected(), command_module :: module(), command_opts :: keyword()) ::
  :ok | {:ok, any()} | {:error, any()}

Send a command to the Z-Wave device, first checking if in inclusion/exclusion state.

Given a connected thing, Conn, Node, or Controller for example, a command module, and opts to the command module send and process the command.

See individual command modules for information about what options it takes.

Link to this function

start_learn_mode(opts \\ []) View Source
start_learn_mode([Grizzly.Inclusion.opt()]) :: :ok

Put the controller in learn mode for a few seconds

Link to this function

subscribe(topic) View Source
subscribe(Grizzly.Notifications.topic()) :: :ok | {:error, :already_subscribed}

Subscribe to notifications about a topic

See Grizzly.Notifications for more information

Link to this function

update_command_class_versions(zw_node) View Source
update_command_class_versions(Grizzly.Node.t()) :: Grizzly.Node.t()

Update the command class version of a node