Skip to content

Commit

Permalink
Fix kettle turn on for skykettle integration (dext0r#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
dext0r committed Nov 1, 2024
1 parent e00ef65 commit 4deefb5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion custom_components/yandex_smart_home/capability_onoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
from homeassistant.exceptions import ServiceNotFound
from homeassistant.helpers.service import async_call_from_config

from . import const
from .capability import STATE_CAPABILITIES_REGISTRY, ActionOnlyCapabilityMixin, StateCapability
from .const import CONF_FEATURES, CONF_STATE_UNKNOWN, CONF_TURN_OFF, CONF_TURN_ON, MediaPlayerFeature
from .helpers import ActionNotAllowed, APIError
Expand Down Expand Up @@ -449,7 +450,7 @@ class OnOffCapabilityWaterHeater(OnOffCapability):
"""Capability to turn on or off a water heater."""

_water_heater_operations = {
STATE_ON: [STATE_ON, "On", "ON", water_heater.STATE_ELECTRIC],
STATE_ON: [STATE_ON, "On", "ON", water_heater.STATE_ELECTRIC, const.SKYKETTLE_MODE_BOIL],
STATE_OFF: [STATE_OFF, "Off", "OFF"],
}

Expand Down
3 changes: 3 additions & 0 deletions custom_components/yandex_smart_home/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@
TION_FAN_SPEED_5 = "5"
TION_FAN_SPEED_6 = "6"

# https://github.com/ClusterM/skykettle-ha/blob/c1b61c4a22693d6e2b7c2f57a989df418011f2c2/custom_components/skykettle/skykettle.py#L53
SKYKETTLE_MODE_BOIL = "Boil"

# https://github.com/home-assistant/core/pull/67743
FAN_SPEED_OFF = "off"
FAN_SPEED_LOW = "low"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_capability_onoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ async def test_capability_onoff_water_heater(hass):
assert cap.parameters.dict() == {"split": True}


@pytest.mark.parametrize("op_on", ["on", "On", "ON", "electric"])
@pytest.mark.parametrize("op_on", ["on", "On", "ON", "electric", "Boil"])
@pytest.mark.parametrize("op_off", ["off", "Off", "OFF"])
async def test_capability_onoff_water_heater_set_op_mode(hass, op_on, op_off):
state = State(
Expand Down

0 comments on commit 4deefb5

Please sign in to comment.