diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1835e159..55dd43b8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.278 + rev: v0.1.3 hooks: - id: ruff args: diff --git a/custom_components/miele/__init__.py b/custom_components/miele/__init__.py index 9df0fbb3..89f192dd 100644 --- a/custom_components/miele/__init__.py +++ b/custom_components/miele/__init__.py @@ -60,6 +60,7 @@ TEST_DATA_21, TEST_DATA_23, TEST_DATA_24, + TEST_DATA_27, TEST_DATA_74, ) from .services import async_setup_services @@ -206,6 +207,7 @@ async def _callback_update_data(data) -> None: # data["1223021"] = TEST_DATA_21 # data["1223023"] = TEST_DATA_23 # data["1223024"] = TEST_DATA_24 + # data["1223027"] = TEST_DATA_27 # data["1223074"] = TEST_DATA_74 flat_result: dict = {} try: @@ -287,6 +289,7 @@ async def async_fetch(): # result["1223021"] = TEST_DATA_21 # result["1223023"] = TEST_DATA_23 # result["1223024"] = TEST_DATA_24 + # result["1223027"] = TEST_DATA_27 # result["1223074"] = TEST_DATA_74 try: diff --git a/custom_components/miele/binary_sensor.py b/custom_components/miele/binary_sensor.py index 88c6e007..ebd586fb 100644 --- a/custom_components/miele/binary_sensor.py +++ b/custom_components/miele/binary_sensor.py @@ -126,7 +126,6 @@ class MieleBinarySensorDefinition: STEAM_OVEN_MICRO, DIALOG_OVEN, WINE_CABINET_FREEZER, - HOB_INDUCT_EXTR, ], description=MieleBinarySensorDescription( key="info", diff --git a/custom_components/miele/devcap.py b/custom_components/miele/devcap.py index 6203b1ff..2c8f09dd 100644 --- a/custom_components/miele/devcap.py +++ b/custom_components/miele/devcap.py @@ -955,6 +955,101 @@ }, } +TEST_DATA_27 = { + "ident": { + "type": { + "key_localized": "Device type", + "value_raw": 27, + "value_localized": "Induction hob", + }, + "deviceName": "", + "protocolVersion": 203, + "deviceIdentLabel": { + "fabNumber": "**REDACTED**", + "fabIndex": "00", + "techType": "KM7897", + "matNumber": "", + "swids": ["000"], + }, + "xkmIdentLabel": { + "techType": "EK039W", + "releaseVersion": "02.72", + }, + }, + "state": { + "ProgramID": { + "value_raw": 0, + "value_localized": "", + "key_localized": "Program name", + }, + "status": { + "value_raw": 5, + "value_localized": "In use", + "key_localized": "status", + }, + "programType": { + "value_raw": 0, + "value_localized": "Program", + "key_localized": "Program type", + }, + "programPhase": { + "value_raw": 0, + "value_localized": "", + "key_localized": "Program phase", + }, + "remainingTime": [0, 0], + "startTime": [0, 0], + "targetTemperature": [ + {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, + {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, + {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, + ], + "temperature": [ + {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, + {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, + {"value_raw": -32768, "value_localized": None, "unit": "Celsius"}, + ], + "signalInfo": False, + "signalFailure": False, + "signalDoor": False, + "remoteEnable": { + "fullRemoteControl": True, + "smartGrid": False, + "mobileStart": False, + }, + "ambientLight": None, + "light": None, + "elapsedTime": [], + "spinningSpeed": { + "unit": "rpm", + "value_raw": None, + "value_localized": "", + "key_localized": "Spin speed", + }, + "dryingStep": { + "value_raw": None, + "value_localized": "", + "key_localized": "Drying level", + }, + "ventilationStep": { + "value_raw": None, + "value_localized": "", + "key_localized": "Fan level", + }, + "plateStep": [ + {"value_raw": 0, "value_localized": 0, "key_localized": "Power level"}, + {"value_raw": 3, "value_localized": 2, "key_localized": "Power level"}, + {"value_raw": 7, "value_localized": 4, "key_localized": "Power level"}, + {"value_raw": 15, "value_localized": 8, "key_localized": "Power level"}, + {"value_raw": 220, "value_localized": 10, "key_localized": "Power level"}, + {"value_raw": 12, "value_localized": 10, "key_localized": "Power level"}, + {"value_raw": 118, "value_localized": 10, "key_localized": "Power level"}, + ], + "ecoFeedback": None, + "batteryLevel": None, + }, +} + TEST_DATA_74 = { "ident": { "type": { diff --git a/custom_components/miele/number.py b/custom_components/miele/number.py index 2b5c04d2..a7db9b36 100644 --- a/custom_components/miele/number.py +++ b/custom_components/miele/number.py @@ -21,13 +21,14 @@ ) from . import get_coordinator -from .const import API, DOMAIN, HOB_INDUCT_EXTR, MANUFACTURER +from .const import API, DOMAIN, HOB_INDUCT_EXTR, HOB_INDUCTION, MANUFACTURER _LOGGER = logging.getLogger(__name__) PLATE_MAP = { 0: 0, 110: 0.5, + 220: 0.5, 1: 1, 2: 1.5, 3: 2, @@ -45,7 +46,9 @@ 15: 8, 16: 8.5, 17: 9, + 18: 9.5, 117: 10, + 118: 10, } @@ -83,7 +86,7 @@ class MieleNumberDefinition: key="plate", data_tag="state|plateStep|0|value_raw", icon="mdi:stove", - translation_key="plate_0", + translation_key="plate_1", zone=0, native_min_value=0.0, native_max_value=10.0, @@ -98,7 +101,7 @@ class MieleNumberDefinition: key="plate", data_tag="state|plateStep|1|value_raw", icon="mdi:stove", - translation_key="plate_1", + translation_key="plate_2", zone=1, native_min_value=0.0, native_max_value=10.0, @@ -113,7 +116,7 @@ class MieleNumberDefinition: key="plate", data_tag="state|plateStep|2|value_raw", icon="mdi:stove", - translation_key="plate_2", + translation_key="plate_3", zone=2, native_min_value=0.0, native_max_value=10.0, @@ -128,7 +131,7 @@ class MieleNumberDefinition: key="plate", data_tag="state|plateStep|3|value_raw", icon="mdi:stove", - translation_key="plate_3", + translation_key="plate_4", zone=3, native_min_value=0.0, native_max_value=10.0, @@ -143,13 +146,103 @@ class MieleNumberDefinition: key="plate", data_tag="state|plateStep|4|value_raw", icon="mdi:stove", + translation_key="plate_5", + zone=4, + native_min_value=0.0, + native_max_value=10.0, + native_step=0.5, + ), + ), + MieleNumberDefinition( + types=[ + HOB_INDUCTION, + ], + description=MieleNumberDescription( + key="plate", + data_tag="state|plateStep|0|value_raw", + icon="mdi:stove", + translation_key="plate_1", + zone=0, + native_min_value=0.0, + native_max_value=10.0, + native_step=0.5, + ), + ), + MieleNumberDefinition( + types=[ + HOB_INDUCTION, + ], + description=MieleNumberDescription( + key="plate", + data_tag="state|plateStep|1|value_raw", + icon="mdi:stove", + translation_key="plate_2", + zone=1, + native_min_value=0.0, + native_max_value=10.0, + native_step=0.5, + ), + ), + MieleNumberDefinition( + types=[ + HOB_INDUCTION, + ], + description=MieleNumberDescription( + key="plate", + data_tag="state|plateStep|2|value_raw", + icon="mdi:stove", + translation_key="plate_3", + zone=2, + native_min_value=0.0, + native_max_value=10.0, + native_step=0.5, + ), + ), + MieleNumberDefinition( + types=[ + HOB_INDUCTION, + ], + description=MieleNumberDescription( + key="plate", + data_tag="state|plateStep|3|value_raw", + icon="mdi:stove", translation_key="plate_4", + zone=3, + native_min_value=0.0, + native_max_value=10.0, + native_step=0.5, + ), + ), + MieleNumberDefinition( + types=[ + HOB_INDUCTION, + ], + description=MieleNumberDescription( + key="plate", + data_tag="state|plateStep|4|value_raw", + icon="mdi:stove", + translation_key="plate_5", zone=4, native_min_value=0.0, native_max_value=10.0, native_step=0.5, ), ), + MieleNumberDefinition( + types=[ + HOB_INDUCTION, + ], + description=MieleNumberDescription( + key="plate", + data_tag="state|plateStep|5|value_raw", + icon="mdi:stove", + translation_key="plate_6", + zone=5, + native_min_value=0.0, + native_max_value=10.0, + native_step=0.5, + ), + ), ) @@ -211,13 +304,7 @@ def __init__( ] self._attr_has_entity_name = True self._attr_unique_id = f"{self._ed.key}-{self._ed.zone}{self._ent}" - # _LOGGER.debug("icon: %s | %s", self._ed.icon, self._ed.icon) - # self._attr_icon = self._ed.icon self._attr_mode = NumberMode.SLIDER - # self._attr_max_value = self._ed.max_value - # self._attr_min_value = self._ed.min_value - # self._attr_step = self._ed.step - # self._attr_supported_features = self._ed.supported_features self._attr_device_info = DeviceInfo( identifiers={(DOMAIN, self._ent)}, name=appl_type, diff --git a/custom_components/miele/translations/en.json b/custom_components/miele/translations/en.json index 228a1b39..8200c0bf 100644 --- a/custom_components/miele/translations/en.json +++ b/custom_components/miele/translations/en.json @@ -120,9 +120,6 @@ } }, "number": { - "plate_0": { - "name": "Plate 0" - }, "plate_1": { "name": "Plate 1" }, @@ -134,6 +131,12 @@ }, "plate_4": { "name": "Plate 4" + }, + "plate_5": { + "name": "Plate 5" + }, + "plate_6": { + "name": "Plate 6" } }, "sensor": { diff --git a/custom_components/miele/translations/sv.json b/custom_components/miele/translations/sv.json index fdaae239..fddc1020 100644 --- a/custom_components/miele/translations/sv.json +++ b/custom_components/miele/translations/sv.json @@ -80,9 +80,6 @@ } }, "number": { - "plate_0": { - "name": "Platta 0" - }, "plate_1": { "name": "Platta 1" }, @@ -94,6 +91,12 @@ }, "plate_4": { "name": "Platta 4" + }, + "plate_5": { + "name": "Platta 5" + }, + "plate_6": { + "name": "Platta 6" } }, "sensor": { @@ -169,7 +172,7 @@ "descaling": "Avkalkning", "down_duvets": "Duntäcken", "down_filled_items": "Dunfyllda plagg", - "drain_spin": "Tömning\/centrifugering", + "drain_spin": "Tömning/centrifugering", "eco": "ECO", "eco_40_60": "ECO 40-60", "eco_fan_heat": "Eco varmluft", @@ -217,7 +220,7 @@ "rinse": "Sköljning", "rinse_out_lint": "Spola ut ludd", "ristretto": "Ristretto", - "separate_rinse_starch": "Separat sköljning\/stärkning", + "separate_rinse_starch": "Separat sköljning/stärkning", "shirts": "Skjortor", "silent": "Tyst", "silks": "Siden", @@ -356,7 +359,7 @@ "running": "Igång", "service": "Service", "supercooling": "Snabbkylning", - "supercooling_superfreezing": "Snabbkylning\/snabbinfrysning", + "supercooling_superfreezing": "Snabbkylning/snabbinfrysning", "superfreezing": "Snabbinfrysning", "superheating": "Supervärmning", "waiting_to_start": "Väntar på start"