Skip to content

Commit

Permalink
Merge pull request #357 from astrandb/InductionHob
Browse files Browse the repository at this point in the history
 Add 6 zone Induction Hob
  • Loading branch information
astrandb authored Nov 3, 2023
2 parents b134f8d + ba71660 commit 3a6b596
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 3 additions & 0 deletions custom_components/miele/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion custom_components/miele/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class MieleBinarySensorDefinition:
STEAM_OVEN_MICRO,
DIALOG_OVEN,
WINE_CABINET_FREEZER,
HOB_INDUCT_EXTR,
],
description=MieleBinarySensorDescription(
key="info",
Expand Down
95 changes: 95 additions & 0 deletions custom_components/miele/devcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
109 changes: 98 additions & 11 deletions custom_components/miele/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -45,7 +46,9 @@
15: 8,
16: 8.5,
17: 9,
18: 9.5,
117: 10,
118: 10,
}


Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
),
),
)


Expand Down Expand Up @@ -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,
Expand Down
9 changes: 6 additions & 3 deletions custom_components/miele/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@
}
},
"number": {
"plate_0": {
"name": "Plate 0"
},
"plate_1": {
"name": "Plate 1"
},
Expand All @@ -134,6 +131,12 @@
},
"plate_4": {
"name": "Plate 4"
},
"plate_5": {
"name": "Plate 5"
},
"plate_6": {
"name": "Plate 6"
}
},
"sensor": {
Expand Down
15 changes: 9 additions & 6 deletions custom_components/miele/translations/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@
}
},
"number": {
"plate_0": {
"name": "Platta 0"
},
"plate_1": {
"name": "Platta 1"
},
Expand All @@ -94,6 +91,12 @@
},
"plate_4": {
"name": "Platta 4"
},
"plate_5": {
"name": "Platta 5"
},
"plate_6": {
"name": "Platta 6"
}
},
"sensor": {
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 3a6b596

Please sign in to comment.