Grizzly.SwitchBinary (grizzly v0.22.3) View Source

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

Link to this section 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

Link to this section Types

Specs

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.

Specs

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).

Specs

set_value() :: :on | :off

The value the switch's state can be set to

Link to this section Functions

Link to this function

get(node_id, command_opts \\ [])

View Source

Specs

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.

Link to this function

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

View Source

Specs

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.