Skip to content

Commit b21cce6

Browse files
bjyoungbloodjfcloutier
authored andcommitted
Rename humidity control setpoint types
Renamed `:humidifier` and `:dehumidifier` to `:humidify` and `:dehumidify` to align with the humidity control mode names.
1 parent 02618fd commit b21cce6

8 files changed

+23
-23
lines changed

lib/grizzly/zwave/command_classes/humidity_control_setpoint.ex

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule Grizzly.ZWave.CommandClasses.HumidityControlSetpoint do
77

88
require Logger
99

10-
@type type :: :humidifier | :dehumidifier | :auto
10+
@type type :: :humidify | :dehumidify | :auto
1111
@type scale :: :percentage | :absolute
1212

1313
@impl Grizzly.ZWave.CommandClass
@@ -16,26 +16,26 @@ defmodule Grizzly.ZWave.CommandClasses.HumidityControlSetpoint do
1616
@impl Grizzly.ZWave.CommandClass
1717
def name(), do: :humidity_control_setpoint
1818

19-
@spec encode_type(:auto | :dehumidifier | :humidifier) :: 1 | 2 | 3
20-
def encode_type(:humidifier), do: 0x01
21-
def encode_type(:dehumidifier), do: 0x02
19+
@spec encode_type(type()) :: 1 | 2 | 3
20+
def encode_type(:humidify), do: 0x01
21+
def encode_type(:dehumidify), do: 0x02
2222
def encode_type(:auto), do: 0x03
2323

24-
@spec decode_type(byte()) :: :auto | :dehumidifier | :humidifier | :unknown
25-
def decode_type(0x01), do: :humidifier
26-
def decode_type(0x02), do: :dehumidifier
24+
@spec decode_type(byte()) :: type() | :unknown
25+
def decode_type(0x01), do: :humidify
26+
def decode_type(0x02), do: :dehumidify
2727
def decode_type(0x03), do: :auto
2828

2929
def decode_type(v) do
3030
Logger.error("[Grizzly] Unknown humidity control setpoint type: #{v}")
3131
:unknown
3232
end
3333

34-
@spec encode_scale(:absolute | :percentage) :: 0 | 1
34+
@spec encode_scale(scale()) :: 0 | 1
3535
def encode_scale(:percentage), do: 0x00
3636
def encode_scale(:absolute), do: 0x01
3737

38-
@spec decode_scale(byte()) :: :absolute | :percentage | :unknown
38+
@spec decode_scale(byte()) :: scale() | :unknown
3939
def decode_scale(0x00), do: :percentage
4040
def decode_scale(0x01), do: :absolute
4141

test/grizzly/zwave/commands/humidity_control_setpoint_capabilities_get_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointCapabilitiesGetTest do
44
alias Grizzly.ZWave.Commands.HumidityControlSetpointCapabilitiesGet
55

66
test "encode/1 correctly encodes command" do
7-
{:ok, command} = HumidityControlSetpointCapabilitiesGet.new(setpoint_type: :humidifier)
7+
{:ok, command} = HumidityControlSetpointCapabilitiesGet.new(setpoint_type: :humidify)
88
assert <<1>> == HumidityControlSetpointCapabilitiesGet.encode_params(command)
99

1010
{:ok, command} = HumidityControlSetpointCapabilitiesGet.new(setpoint_type: :auto)
1111
assert <<3>> == HumidityControlSetpointCapabilitiesGet.encode_params(command)
1212
end
1313

1414
test "decode/1 correctly decodes command" do
15-
assert {:ok, [setpoint_type: :humidifier]} ==
15+
assert {:ok, [setpoint_type: :humidify]} ==
1616
HumidityControlSetpointCapabilitiesGet.decode_params(<<1>>)
1717

1818
assert {:ok, [setpoint_type: :auto]} ==

test/grizzly/zwave/commands/humidity_control_setpoint_capabilities_report_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointCapabilitiesReportTest d
66
test "encodes params correctly" do
77
{:ok, command} =
88
HumidityControlSetpointCapabilitiesReport.new(
9-
setpoint_type: :humidifier,
9+
setpoint_type: :humidify,
1010
min_value: 1.1,
1111
min_scale: :percentage,
1212
max_value: 10,
@@ -21,7 +21,7 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointCapabilitiesReportTest d
2121
binary = <<0x01, 0b00100001, 11, 0b00001001, 10>>
2222

2323
assert {:ok, params} = HumidityControlSetpointCapabilitiesReport.decode_params(binary)
24-
assert params[:setpoint_type] == :humidifier
24+
assert params[:setpoint_type] == :humidify
2525
assert params[:min_value] == 1.1
2626
assert params[:min_scale] == :percentage
2727
assert params[:max_value] == 10

test/grizzly/zwave/commands/humidity_control_setpoint_get_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointGetTest do
44
alias Grizzly.ZWave.Commands.HumidityControlSetpointGet
55

66
test "encode/1 correctly encodes command" do
7-
{:ok, command} = HumidityControlSetpointGet.new(setpoint_type: :humidifier)
7+
{:ok, command} = HumidityControlSetpointGet.new(setpoint_type: :humidify)
88
assert <<1>> == HumidityControlSetpointGet.encode_params(command)
99

1010
{:ok, command} = HumidityControlSetpointGet.new(setpoint_type: :auto)
1111
assert <<3>> == HumidityControlSetpointGet.encode_params(command)
1212
end
1313

1414
test "decode/1 correctly decodes command" do
15-
assert {:ok, [setpoint_type: :humidifier]} ==
15+
assert {:ok, [setpoint_type: :humidify]} ==
1616
HumidityControlSetpointGet.decode_params(<<1>>)
1717

1818
assert {:ok, [setpoint_type: :auto]} ==

test/grizzly/zwave/commands/humidity_control_setpoint_report_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointReportTest do
66
test "encodes params correctly" do
77
{:ok, command} =
88
HumidityControlSetpointReport.new(
9-
setpoint_type: :humidifier,
9+
setpoint_type: :humidify,
1010
value: 1.1,
1111
scale: :absolute
1212
)
@@ -19,7 +19,7 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointReportTest do
1919
binary = <<0x01, 0b00101001, 11>>
2020

2121
assert {:ok, params} = HumidityControlSetpointReport.decode_params(binary)
22-
assert params[:setpoint_type] == :humidifier
22+
assert params[:setpoint_type] == :humidify
2323
assert params[:value] == 1.1
2424
assert params[:scale] == :absolute
2525
end

test/grizzly/zwave/commands/humidity_control_setpoint_scale_supported_get_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointScaleSupportedGetTest do
44
alias Grizzly.ZWave.Commands.HumidityControlSetpointScaleSupportedGet
55

66
test "encode/1 correctly encodes command" do
7-
{:ok, command} = HumidityControlSetpointScaleSupportedGet.new(setpoint_type: :humidifier)
7+
{:ok, command} = HumidityControlSetpointScaleSupportedGet.new(setpoint_type: :humidify)
88
assert <<1>> == HumidityControlSetpointScaleSupportedGet.encode_params(command)
99

1010
{:ok, command} = HumidityControlSetpointScaleSupportedGet.new(setpoint_type: :auto)
1111
assert <<3>> == HumidityControlSetpointScaleSupportedGet.encode_params(command)
1212
end
1313

1414
test "decode/1 correctly decodes command" do
15-
assert {:ok, [setpoint_type: :humidifier]} ==
15+
assert {:ok, [setpoint_type: :humidify]} ==
1616
HumidityControlSetpointScaleSupportedGet.decode_params(<<1>>)
1717

1818
assert {:ok, [setpoint_type: :auto]} ==

test/grizzly/zwave/commands/humidity_control_setpoint_set_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointSetTest do
66
test "encodes params correctly" do
77
{:ok, command} =
88
HumidityControlSetpointSet.new(
9-
setpoint_type: :humidifier,
9+
setpoint_type: :humidify,
1010
value: 1.1,
1111
scale: :absolute
1212
)
@@ -19,7 +19,7 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointSetTest do
1919
binary = <<0x01, 0b00101001, 11>>
2020

2121
assert {:ok, params} = HumidityControlSetpointSet.decode_params(binary)
22-
assert params[:setpoint_type] == :humidifier
22+
assert params[:setpoint_type] == :humidify
2323
assert params[:value] == 1.1
2424
assert params[:scale] == :absolute
2525
end

test/grizzly/zwave/commands/humidity_control_setpoint_supported_report_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ defmodule Grizzly.ZWave.Commands.HumidityControlSetpointSupportedReportTest do
55

66
test "encodes params correctly" do
77
{:ok, command} =
8-
HumidityControlSetpointSupportedReport.new(setpoint_types: [:humidifier, :auto])
8+
HumidityControlSetpointSupportedReport.new(setpoint_types: [:humidify, :auto])
99

1010
assert <<0b1010>> == HumidityControlSetpointSupportedReport.encode_params(command)
1111
end
1212

1313
test "decodes params correctly" do
1414
assert {:ok, params} = HumidityControlSetpointSupportedReport.decode_params(<<0b1010>>)
15-
assert params[:setpoint_types] == [:humidifier, :auto]
15+
assert params[:setpoint_types] == [:humidify, :auto]
1616
end
1717
end

0 commit comments

Comments
 (0)