Skip to content

Commit

Permalink
fix: Quiet mode to set value 2 not 1 (#88)
Browse files Browse the repository at this point in the history
This was found to be the correct value from testing, see issue #87
  • Loading branch information
cmroche committed Jun 27, 2024
1 parent f780770 commit 129a190
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion greeclimate/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def quiet(self) -> bool:

@quiet.setter
def quiet(self, value: bool):
self.set_property(Props.QUIET, int(value))
self.set_property(Props.QUIET, 2 if value else 0)

@property
def turbo(self) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_mock_state_on():
"Lig": 1,
"SwingLfRig": 1,
"SwUpDn": 1,
"Quiet": 1,
"Quiet": 2,
"Tur": 1,
"StHt": 1,
"SvSt": 1,
Expand Down
19 changes: 19 additions & 0 deletions tests/test_issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,22 @@ async def test_issue_69_TemSen_40_should_not_set_firmware_v4(mock_request):

await device.update_state()
assert device.version is None

"""Tests for issue 72"""

@pytest.mark.asyncio
@patch("greeclimate.network.send_state")
async def test_issue_87_quiet_should_set_2(mock_request):
"""Check that quiet mode uses 2 instead of 1"""
from tests.test_device import generate_device_mock_async

mock_v3_state = { "Quiet": 2 }
mock_request.return_value = mock_v3_state
device = await generate_device_mock_async()

assert device.get_property(Props.QUIET) is None
device.quiet = True
await device.push_state_update()

mock_request.assert_called_once()
assert device.get_property(Props.QUIET) == 2

0 comments on commit 129a190

Please sign in to comment.