View Source Grizzly.VirtualDevices (grizzly v4.0.0)

Virtual devices

Virtual devices are in-memory devices that act like a Z-Wave device

Link to this section Summary

Types

Options for adding a virtual devices

Id for a virtual device

Options for removing virtual devices

Functions

Add a new virtual device to the virtual device network

List all the virtual devices on the virtual device network

Remove a virtual device from the virtual device network

Send a Z-Wave command to a virtual device

Link to this section Types

@type add_opt() :: {:inclusion_handler, Grizzly.handler()}

Options for adding a virtual devices

  • :inclusion_handler - if an inclusion handler is provider via the add options it will override the initial inclusion handle argument to the network server if one was provided only for that one call to add_device/2.
@type id() :: {:virtual, integer()}

Id for a virtual device

@type remove_opt() :: {:inclusion_handler, Grizzly.handler()}

Options for removing virtual devices

  • :inclusion_handler - if an inclusion handler is provider via the add options it will override the initial inclusion handle argument to the network server if one was provided only for that one call to remove_device/2.

Link to this section Functions

Link to this function

add_device(device, opts \\ [])

View Source
@spec add_device(
  Grizzly.VirtualDevices.Device.t()
  | {Grizzly.VirtualDevices.Device.t(), term()},
  [
    add_opt()
  ]
) :: {:ok, id()}

Add a new virtual device to the virtual device network

To add a virtual device you must supply a module that implements the Grizzly.VirtualDevices.Device behaviour.

If the device takes any options you can pass a tuple of {device, opts}.

@spec list_nodes() :: [id()]

List all the virtual devices on the virtual device network

Link to this function

remove_device(virtual_device_id, opts \\ [])

View Source
@spec remove_device(id(), [remove_opt()]) :: :ok

Remove a virtual device from the virtual device network

Link to this function

send_command(node_id, command)

View Source

Send a Z-Wave command to a virtual device