Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ async def run():
profile = data.profile # RETURNS a Profile.* value
await client.set_profile(Profile.HOME) # Permanently HOME profile
await client.set_profile(Profile.AWAY) # Permanently AWAY profile
await client.set_profile(Profile.AUTO) # Permanently AUTO profile (requires firmware v3.1.4+)
await client.set_profile(Profile.FIREPLACE) # FIREPLACE mode for configured timeout
await client.set_profile(Profile.FIREPLACE, 120) # FIREPLACE mode for 120 min
await client.set_profile(Profile.FIREPLACE, 65535) # FIREPLACE mode, never TIMEOUT
Expand Down
4 changes: 4 additions & 0 deletions tests/test_vallox_fan_speed.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ async def test_set_fan_speed_boost(vallox: Vallox):
async def test_set_fan_speed_wrong(vallox: Vallox):
with pytest.raises(ValloxInvalidInputException):
await vallox.set_fan_speed(Profile.FIREPLACE, 19)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_fan_speed(Profile.EXTRA, 19)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_fan_speed(Profile.AUTO, 19)


async def test_set_fan_speed_home_invalid_percentage(vallox: Vallox):
Expand Down
20 changes: 20 additions & 0 deletions tests/test_vallox_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@
"A_CYC_EXTRA_TIMER": 30,
},
),
(
Profile.AUTO,
None,
{
"A_CYC_STATE": 2,
"A_CYC_BOOST_TIMER": 0,
"A_CYC_FIREPLACE_TIMER": 0,
"A_CYC_EXTRA_TIMER": 0,
},
),
],
)
async def test_set_profile(vallox: Vallox, profile, fetch_metrics, expected_values):
Expand Down Expand Up @@ -155,6 +165,16 @@ async def test_set_profile(vallox: Vallox, profile, fetch_metrics, expected_valu
Profile.EXTRA,
31,
),
(
{
"A_CYC_STATE": 2,
"A_CYC_BOOST_TIMER": 0,
"A_CYC_FIREPLACE_TIMER": 0,
"A_CYC_EXTRA_TIMER": 0,
},
Profile.AUTO,
None,
),
],
)
async def test_profiles(
Expand Down
4 changes: 4 additions & 0 deletions tests/test_vallox_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ async def test_set_rh_sensor_control_for_invalid_profile(vallox):
await vallox.set_rh_sensor_control(Profile.FIREPLACE, True)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_rh_sensor_control(Profile.EXTRA, True)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_rh_sensor_control(Profile.AUTO, True)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -71,6 +73,8 @@ async def test_set_co2_sensor_control_with_invalid_profile(vallox):
await vallox.set_co2_sensor_control(Profile.FIREPLACE, True)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_co2_sensor_control(Profile.EXTRA, True)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_co2_sensor_control(Profile.AUTO, True)


@pytest.mark.parametrize(
Expand Down
4 changes: 4 additions & 0 deletions tests/test_vallox_temperatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ async def test_vallox_set_temperature(vallox, profile, metric, value):
async def test_vallox_set_temperature_not_supported(vallox):
with pytest.raises(ValloxInvalidInputException):
await vallox.set_temperature(Profile.FIREPLACE, 19)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_temperature(Profile.EXTRA, 19)
with pytest.raises(ValloxInvalidInputException):
await vallox.set_temperature(Profile.AUTO, 19)


async def test_vallox_get_temperature(vallox):
Expand Down
21 changes: 17 additions & 4 deletions vallox_websocket_api/vallox.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Profile(IntEnum):
BOOST = 3
FIREPLACE = 4
EXTRA = 5
AUTO = 6


PROFILE_TO_SET_TEMPERATURE_METRIC_MAP = {
Expand Down Expand Up @@ -239,14 +240,16 @@ def profile(self) -> Profile:
"""Get the current profile of the unit"""
if self.get("A_CYC_BOOST_TIMER", 0) > 0:
return Profile.BOOST
if self.get("A_CYC_FIREPLACE_TIMER", 0) > 0:
elif self.get("A_CYC_FIREPLACE_TIMER", 0) > 0:
return Profile.FIREPLACE
if self.get("A_CYC_EXTRA_TIMER", 0) > 0:
elif self.get("A_CYC_EXTRA_TIMER", 0) > 0:
return Profile.EXTRA
if self.get("A_CYC_STATE") == 1:
return Profile.AWAY
elif self.get("A_CYC_STATE") == 0:
return Profile.HOME
elif self.get("A_CYC_STATE") == 1:
return Profile.AWAY
elif self.get("A_CYC_STATE") == 2:
return Profile.AUTO
return Profile.NONE

@property
Expand Down Expand Up @@ -511,6 +514,16 @@ async def lazy_fetch_metric_value(metric: str) -> int:
"A_CYC_EXTRA_TIMER": 0,
}
)
elif profile == Profile.AUTO:
logger.info("Setting unit to AUTO profile")
await self.set_values(
{
"A_CYC_STATE": 2,
"A_CYC_BOOST_TIMER": 0,
"A_CYC_FIREPLACE_TIMER": 0,
"A_CYC_EXTRA_TIMER": 0,
}
)
elif profile == Profile.FIREPLACE:
dur = set_duration or await lazy_fetch_metric_value("A_CYC_FIREPLACE_TIME")
logger.info(f"Setting unit to FIREPLACE profile for {dur} minutes")
Expand Down