mirror of
https://github.com/home-assistant/core.git
synced 2026-09-26 09:23:17 -04:00
Pump pyliebherrhomeapi to 0.3.0 (#163450)
This commit is contained in:
@@ -13,49 +13,49 @@
|
||||
"off": "mdi:glass-cocktail-off"
|
||||
}
|
||||
},
|
||||
"supercool": {
|
||||
"super_cool": {
|
||||
"default": "mdi:snowflake",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"supercool_bottom_zone": {
|
||||
"super_cool_bottom_zone": {
|
||||
"default": "mdi:snowflake",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"supercool_middle_zone": {
|
||||
"super_cool_middle_zone": {
|
||||
"default": "mdi:snowflake",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"supercool_top_zone": {
|
||||
"super_cool_top_zone": {
|
||||
"default": "mdi:snowflake",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"superfrost": {
|
||||
"super_frost": {
|
||||
"default": "mdi:snowflake-alert",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"superfrost_bottom_zone": {
|
||||
"super_frost_bottom_zone": {
|
||||
"default": "mdi:snowflake-alert",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"superfrost_middle_zone": {
|
||||
"super_frost_middle_zone": {
|
||||
"default": "mdi:snowflake-alert",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
}
|
||||
},
|
||||
"superfrost_top_zone": {
|
||||
"super_frost_top_zone": {
|
||||
"default": "mdi:snowflake-alert",
|
||||
"state": {
|
||||
"off": "mdi:snowflake-off"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"iot_class": "cloud_polling",
|
||||
"loggers": ["pyliebherrhomeapi"],
|
||||
"quality_scale": "silver",
|
||||
"requirements": ["pyliebherrhomeapi==0.2.1"],
|
||||
"requirements": ["pyliebherrhomeapi==0.3.0"],
|
||||
"zeroconf": [
|
||||
{
|
||||
"name": "liebherr*",
|
||||
|
||||
@@ -60,33 +60,33 @@
|
||||
},
|
||||
"switch": {
|
||||
"night_mode": {
|
||||
"name": "Night mode"
|
||||
"name": "NightMode"
|
||||
},
|
||||
"party_mode": {
|
||||
"name": "Party mode"
|
||||
"name": "PartyMode"
|
||||
},
|
||||
"supercool": {
|
||||
"super_cool": {
|
||||
"name": "SuperCool"
|
||||
},
|
||||
"supercool_bottom_zone": {
|
||||
"super_cool_bottom_zone": {
|
||||
"name": "Bottom zone SuperCool"
|
||||
},
|
||||
"supercool_middle_zone": {
|
||||
"super_cool_middle_zone": {
|
||||
"name": "Middle zone SuperCool"
|
||||
},
|
||||
"supercool_top_zone": {
|
||||
"super_cool_top_zone": {
|
||||
"name": "Top zone SuperCool"
|
||||
},
|
||||
"superfrost": {
|
||||
"super_frost": {
|
||||
"name": "SuperFrost"
|
||||
},
|
||||
"superfrost_bottom_zone": {
|
||||
"super_frost_bottom_zone": {
|
||||
"name": "Bottom zone SuperFrost"
|
||||
},
|
||||
"superfrost_middle_zone": {
|
||||
"super_frost_middle_zone": {
|
||||
"name": "Middle zone SuperFrost"
|
||||
},
|
||||
"superfrost_top_zone": {
|
||||
"super_frost_top_zone": {
|
||||
"name": "Top zone SuperFrost"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,12 @@ from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
from pyliebherrhomeapi import ToggleControl, ZonePosition
|
||||
from pyliebherrhomeapi.const import (
|
||||
CONTROL_NIGHT_MODE,
|
||||
CONTROL_PARTY_MODE,
|
||||
CONTROL_SUPER_COOL,
|
||||
CONTROL_SUPER_FROST,
|
||||
)
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity, SwitchEntityDescription
|
||||
from homeassistant.core import HomeAssistant
|
||||
@@ -17,12 +23,6 @@ from .entity import ZONE_POSITION_MAP, LiebherrEntity
|
||||
|
||||
PARALLEL_UPDATES = 1
|
||||
|
||||
# Control names from the API
|
||||
CONTROL_SUPERCOOL = "supercool"
|
||||
CONTROL_SUPERFROST = "superfrost"
|
||||
CONTROL_PARTY_MODE = "partymode"
|
||||
CONTROL_NIGHT_MODE = "nightmode"
|
||||
|
||||
|
||||
@dataclass(frozen=True, kw_only=True)
|
||||
class LiebherrSwitchEntityDescription(SwitchEntityDescription):
|
||||
@@ -46,21 +46,21 @@ class LiebherrDeviceSwitchEntityDescription(LiebherrSwitchEntityDescription):
|
||||
|
||||
|
||||
ZONE_SWITCH_TYPES: dict[str, LiebherrZoneSwitchEntityDescription] = {
|
||||
CONTROL_SUPERCOOL: LiebherrZoneSwitchEntityDescription(
|
||||
key="supercool",
|
||||
translation_key="supercool",
|
||||
control_name=CONTROL_SUPERCOOL,
|
||||
set_fn=lambda coordinator, zone_id, value: coordinator.client.set_supercool(
|
||||
CONTROL_SUPER_COOL: LiebherrZoneSwitchEntityDescription(
|
||||
key="super_cool",
|
||||
translation_key="super_cool",
|
||||
control_name=CONTROL_SUPER_COOL,
|
||||
set_fn=lambda coordinator, zone_id, value: coordinator.client.set_super_cool(
|
||||
device_id=coordinator.device_id,
|
||||
zone_id=zone_id,
|
||||
value=value,
|
||||
),
|
||||
),
|
||||
CONTROL_SUPERFROST: LiebherrZoneSwitchEntityDescription(
|
||||
key="superfrost",
|
||||
translation_key="superfrost",
|
||||
control_name=CONTROL_SUPERFROST,
|
||||
set_fn=lambda coordinator, zone_id, value: coordinator.client.set_superfrost(
|
||||
CONTROL_SUPER_FROST: LiebherrZoneSwitchEntityDescription(
|
||||
key="super_frost",
|
||||
translation_key="super_frost",
|
||||
control_name=CONTROL_SUPER_FROST,
|
||||
set_fn=lambda coordinator, zone_id, value: coordinator.client.set_super_frost(
|
||||
device_id=coordinator.device_id,
|
||||
zone_id=zone_id,
|
||||
value=value,
|
||||
@@ -118,7 +118,7 @@ async def async_setup_entry(
|
||||
)
|
||||
)
|
||||
|
||||
# Device-wide switches (Party Mode, Night Mode)
|
||||
# Device-wide switches (PartyMode, NightMode)
|
||||
elif device_desc := DEVICE_SWITCH_TYPES.get(control.name):
|
||||
entities.append(
|
||||
LiebherrDeviceSwitch(
|
||||
|
||||
Generated
+1
-1
@@ -2218,7 +2218,7 @@ pylgnetcast==0.3.9
|
||||
pylibrespot-java==0.1.1
|
||||
|
||||
# homeassistant.components.liebherr
|
||||
pyliebherrhomeapi==0.2.1
|
||||
pyliebherrhomeapi==0.3.0
|
||||
|
||||
# homeassistant.components.litejet
|
||||
pylitejet==0.6.3
|
||||
|
||||
Generated
+1
-1
@@ -1889,7 +1889,7 @@ pylgnetcast==0.3.9
|
||||
pylibrespot-java==0.1.1
|
||||
|
||||
# homeassistant.components.liebherr
|
||||
pyliebherrhomeapi==0.2.1
|
||||
pyliebherrhomeapi==0.3.0
|
||||
|
||||
# homeassistant.components.litejet
|
||||
pylitejet==0.6.3
|
||||
|
||||
@@ -136,8 +136,8 @@ def mock_liebherr_client() -> Generator[MagicMock]:
|
||||
MOCK_DEVICE_STATE
|
||||
)
|
||||
client.set_temperature = AsyncMock()
|
||||
client.set_supercool = AsyncMock()
|
||||
client.set_superfrost = AsyncMock()
|
||||
client.set_super_cool = AsyncMock()
|
||||
client.set_super_frost = AsyncMock()
|
||||
client.set_party_mode = AsyncMock()
|
||||
client.set_night_mode = AsyncMock()
|
||||
yield client
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
'device': dict({
|
||||
'device_id': 'test_device_id',
|
||||
'device_name': 'CBNes1234',
|
||||
'device_type': 'COMBI',
|
||||
'device_type': 'combi',
|
||||
'image_url': None,
|
||||
'nickname': 'Test Fridge',
|
||||
}),
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'supercool',
|
||||
'unique_id': 'single_zone_id_supercool_1',
|
||||
'translation_key': 'super_cool',
|
||||
'unique_id': 'single_zone_id_super_cool_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -79,8 +79,8 @@
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'superfrost_bottom_zone',
|
||||
'unique_id': 'test_device_id_superfrost_2',
|
||||
'translation_key': 'super_frost_bottom_zone',
|
||||
'unique_id': 'test_device_id_super_frost_2',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
@@ -97,7 +97,7 @@
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_switches[switch.test_fridge_night_mode-entry]
|
||||
# name: test_switches[switch.test_fridge_nightmode-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@@ -110,7 +110,7 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.test_fridge_night_mode',
|
||||
'entity_id': 'switch.test_fridge_nightmode',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
@@ -118,12 +118,12 @@
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Night mode',
|
||||
'object_id_base': 'NightMode',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Night mode',
|
||||
'original_name': 'NightMode',
|
||||
'platform': 'liebherr',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
@@ -133,20 +133,20 @@
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_switches[switch.test_fridge_night_mode-state]
|
||||
# name: test_switches[switch.test_fridge_nightmode-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Fridge Night mode',
|
||||
'friendly_name': 'Test Fridge NightMode',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.test_fridge_night_mode',
|
||||
'entity_id': 'switch.test_fridge_nightmode',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'on',
|
||||
})
|
||||
# ---
|
||||
# name: test_switches[switch.test_fridge_party_mode-entry]
|
||||
# name: test_switches[switch.test_fridge_partymode-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
@@ -159,7 +159,7 @@
|
||||
'disabled_by': None,
|
||||
'domain': 'switch',
|
||||
'entity_category': None,
|
||||
'entity_id': 'switch.test_fridge_party_mode',
|
||||
'entity_id': 'switch.test_fridge_partymode',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
@@ -167,12 +167,12 @@
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Party mode',
|
||||
'object_id_base': 'PartyMode',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Party mode',
|
||||
'original_name': 'PartyMode',
|
||||
'platform': 'liebherr',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
@@ -182,13 +182,13 @@
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_switches[switch.test_fridge_party_mode-state]
|
||||
# name: test_switches[switch.test_fridge_partymode-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'friendly_name': 'Test Fridge Party mode',
|
||||
'friendly_name': 'Test Fridge PartyMode',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'switch.test_fridge_party_mode',
|
||||
'entity_id': 'switch.test_fridge_partymode',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
@@ -226,8 +226,8 @@
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'supercool_top_zone',
|
||||
'unique_id': 'test_device_id_supercool_1',
|
||||
'translation_key': 'super_cool_top_zone',
|
||||
'unique_id': 'test_device_id_super_cool_1',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -65,29 +65,29 @@ async def test_switches(
|
||||
(
|
||||
"switch.test_fridge_top_zone_supercool",
|
||||
SERVICE_TURN_ON,
|
||||
"set_supercool",
|
||||
"set_super_cool",
|
||||
{"device_id": "test_device_id", "zone_id": 1, "value": True},
|
||||
),
|
||||
(
|
||||
"switch.test_fridge_top_zone_supercool",
|
||||
SERVICE_TURN_OFF,
|
||||
"set_supercool",
|
||||
"set_super_cool",
|
||||
{"device_id": "test_device_id", "zone_id": 1, "value": False},
|
||||
),
|
||||
(
|
||||
"switch.test_fridge_bottom_zone_superfrost",
|
||||
SERVICE_TURN_ON,
|
||||
"set_superfrost",
|
||||
"set_super_frost",
|
||||
{"device_id": "test_device_id", "zone_id": 2, "value": True},
|
||||
),
|
||||
(
|
||||
"switch.test_fridge_party_mode",
|
||||
"switch.test_fridge_partymode",
|
||||
SERVICE_TURN_ON,
|
||||
"set_party_mode",
|
||||
{"device_id": "test_device_id", "value": True},
|
||||
),
|
||||
(
|
||||
"switch.test_fridge_night_mode",
|
||||
"switch.test_fridge_nightmode",
|
||||
SERVICE_TURN_OFF,
|
||||
"set_night_mode",
|
||||
{"device_id": "test_device_id", "value": False},
|
||||
@@ -122,8 +122,8 @@ async def test_switch_service_calls(
|
||||
@pytest.mark.parametrize(
|
||||
("entity_id", "method"),
|
||||
[
|
||||
("switch.test_fridge_top_zone_supercool", "set_supercool"),
|
||||
("switch.test_fridge_party_mode", "set_party_mode"),
|
||||
("switch.test_fridge_top_zone_supercool", "set_super_cool"),
|
||||
("switch.test_fridge_partymode", "set_party_mode"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("init_integration")
|
||||
|
||||
Reference in New Issue
Block a user