View Source Grizzly.ZWave.CommandClasses.Meter (grizzly v7.4.0)

"Meter" Command Class

The Meter Command Class is used to advertise instantaneous and accumulated numerical readings.

Summary

Functions

Decode meter scale

Decode meter type

Decode rate type

Decode supported scales bitmasks.

Encode meter type

Encode meter rate type

Encode supported meter scales as two bit masks. The first bitmask encodes "byte 1" scales and the second bitmask encodes "byte 2" scales. We assume that there is no byte 3, 4, encoding etc. A bit 1 indicates support.

Types

@type meter_rate_type() :: :export | :import | :import_export | :unspecified
@type meter_scale() ::
  :a
  | :cubic_feet
  | :cubic_meters
  | :kvah
  | :kvar
  | :kvarh
  | :kwh
  | :power_factor
  | :pulse_count
  | :us_gallons
  | :v
  | :w
@type meter_type() :: :electric | :gas | :water | :heating | :cooling

Functions

Link to this function

decode_meter_scale(byte, arg2)

View Source
@spec decode_meter_scale(
  {byte(), byte()},
  meter_type() | non_neg_integer()
) :: {:ok, meter_scale()} | {:error, Grizzly.ZWave.DecodeError.t()}

Decode meter scale

@spec decode_meter_type(non_neg_integer()) ::
  {:ok, meter_type()} | {:error, Grizzly.ZWave.DecodeError.t()}

Decode meter type

@spec decode_rate_type(non_neg_integer()) ::
  {:ok, meter_rate_type()} | {:error, Grizzly.ZWave.DecodeError.t()}

Decode rate type

Link to this function

decode_supported_scales_bitmasks(arg, meter_type)

View Source
@spec decode_supported_scales_bitmasks(
  {binary(), binary()},
  meter_type()
) :: {:ok, [meter_scale()]}

Decode supported scales bitmasks.

Link to this function

encode_meter_scale(atom1, atom2)

View Source
@spec encode_meter_scale(meter_scale(), meter_type()) :: {0..7, 0..1}
@spec encode_meter_type(meter_type()) :: 1..5

Encode meter type

@spec encode_rate_type(meter_rate_type()) :: 0..3

Encode meter rate type

Link to this function

encode_supported_scales_bitmasks(supported_scales, meter_type)

View Source
@spec encode_supported_scales_bitmasks([meter_scale()], meter_type()) ::
  {byte(), byte()}

Encode supported meter scales as two bit masks. The first bitmask encodes "byte 1" scales and the second bitmask encodes "byte 2" scales. We assume that there is no byte 3, 4, encoding etc. A bit 1 indicates support.