View Source Grizzly.SwitchBinary (grizzly v8.6.6)

Commands for working with devices that support the Switch Binary command class

Summary

Types

The report received after requesting the state fo the switch using the get/1 function.

Optional parameters used when setting the switch state

The value the switch's state can be set to

Functions

Request the current state of the switch

Set the target value of the binary switch

Types

report()

@type report() :: %{
  target_value: Grizzly.ZWave.Commands.SwitchBinaryReport.value(),
  current_value: Grizzly.ZWave.Commands.SwitchBinaryReport.value() | nil,
  duration: byte() | nil,
  version: 1 | 2
}

The report received after requesting the state fo the switch using the get/1 function.

set_opt()

@type set_opt() :: {:duration, non_neg_integer()}

Optional parameters used when setting the switch state

  • :duration - the duration that the transition from current state to target state should take (version 2).

set_value()

@type set_value() :: :on | :off

The value the switch's state can be set to

Functions

get(node_id, command_opts \\ [])

@spec get(Grizzly.ZWave.node_id(), [Grizzly.command_opt()]) ::
  {:ok, report()}
  | {:queued, reference(), non_neg_integer()}
  | {:error,
     :timeout | :including | :updating_firmware | :nack_response | any()}

Request the current state of the switch

This command will return a report() in response.

set(node_id, target_value, opts \\ [])

@spec set(Grizzly.ZWave.node_id(), set_value(), [set_opt() | Grizzly.command_opt()]) ::
  :ok
  | {:queued, reference(), non_neg_integer()}
  | {:error,
     :timeout | :including | :updating_firmware | :nack_response | any()}

Set the target value of the binary switch

Devices that support version 2 of the switch binary command class and optionally be passed a duration that specifies the duration of the transition from the current value to the target value.