Skip to content

Add support for device diagnostics download #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 18 commits into from
Closed
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ _Work in progress_

This is a first release / Proof of Concept

The capabilities are based on Miele API version 1.0.5
The capabilities are based on Miele API version 1.0.5. The official capability overview is here https://www.miele.com/developer/assets/API_V1.x.x_capabilities_by_device.pdf . Note that this matrix is not entirely correct. Some device lack support and some devices support features that are not marked.

All supported appliances will show a status sensor, some appliances will show more sensors, however only freezers and refridgerators will have a more complete support. Changes on the appliances will be pushed to HA and displayed immediately. As a backup the status is read from the cloud every 60 seconds.
All supported appliances will show a status sensor, some appliances will show more sensors, however only freezers, refridgerators, dishwashers and washer/dryers will have a more complete support. Changes on the appliances will be pushed to HA and displayed immediately. As a backup the status is read from the cloud every 60 seconds.

In an upcoming release there will be support for more appliance types.
In upcoming releases there will be support for more appliance types and more complete support for existing appliances.


Known limitations: There is only limited error and exception handling in this pre-release.
Expand Down
8 changes: 7 additions & 1 deletion custom_components/miele/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from . import config_flow
from .api import AsyncConfigEntryAuth
from .const import DOMAIN, OAUTH2_AUTHORIZE, OAUTH2_TOKEN
from .devcap import TEST_DATA_7, TEST_DATA_24

# from .pymiele import MieleAuthException

Expand Down Expand Up @@ -126,6 +127,8 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

async def _callback_update_data(data) -> None:
# _LOGGER.debug("Callback data: %s", data)
# data["1223007"] = TEST_DATA_7
# data["1223024"] = TEST_DATA_24
flat_result: dict = {}
for idx, ent in enumerate(data):
flat_result[ent] = dict(flatdict.FlatterDict(data[ent], delimiter="|"))
Expand All @@ -144,10 +147,10 @@ async def _callback_update_data(data) -> None:

async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
hass.data[DOMAIN][entry.entry_id]["listener"].cancel()
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)
hass.data[DOMAIN][entry.entry_id]["listener"].cancel()
return unload_ok


Expand All @@ -169,6 +172,9 @@ async def async_fetch():
raise ConfigEntryAuthFailed("Authentication failure when fetching data")
result = await res.json()
flat_result: dict = {}
# result["1223007"] = TEST_DATA_7
# result["1223024"] = TEST_DATA_24

for idx, ent in enumerate(result):
flat_result[ent] = dict(flatdict.FlatterDict(result[ent], delimiter="|"))
# _LOGGER.debug("Data: %s", flat_result)
Expand Down
138 changes: 90 additions & 48 deletions custom_components/miele/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,33 @@
)

from . import get_coordinator
from .const import DOMAIN
from .const import (
COFFEE_SYSTEM,
DIALOG_OVEN,
DISH_WARMER,
DISHWASHER,
DOMAIN,
FREEZER,
FRIDGE,
FRIDGE_FREEZER,
HOB_HIGHLIGHT,
HOB_INDUCTION,
HOOD,
MICROWAVE,
OVEN,
OVEN_MICROWAVE,
ROBOT_VACUUM_CLEANER,
STEAM_OVEN,
STEAM_OVEN_COMBI,
STEAM_OVEN_MICRO,
TUMBLE_DRYER,
WASHER_DRYER,
WASHING_MACHINE,
WINE_CABINET,
WINE_CABINET_FREEZER,
WINE_CONDITIONING_UNIT,
WINE_STORAGE_CONDITIONING_UNIT,
)

_LOGGER = logging.getLogger(__name__)

Expand All @@ -44,7 +70,23 @@ class MieleBinarySensorDefinition:

BINARY_SENSOR_TYPES: Final[tuple[MieleBinarySensorDefinition, ...]] = (
MieleBinarySensorDefinition(
types=[12, 13, 15, 16, 19, 20, 21, 31, 32, 33, 34, 45, 67],
types=[
DISHWASHER,
OVEN,
OVEN_MICROWAVE,
STEAM_OVEN,
MICROWAVE,
FRIDGE,
FREEZER,
FRIDGE_FREEZER,
WASHER_DRYER,
STEAM_OVEN_COMBI,
WINE_CABINET,
WINE_CONDITIONING_UNIT,
WINE_STORAGE_CONDITIONING_UNIT,
STEAM_OVEN_MICRO,
WINE_CABINET_FREEZER,
],
description=MieleBinarySensorDescription(
key="door",
data_tag="state|signalDoor",
Expand All @@ -55,28 +97,28 @@ class MieleBinarySensorDefinition:
),
MieleBinarySensorDefinition(
types=[
1,
2,
7,
12,
13,
15,
16,
17,
18,
19,
20,
21,
23,
24,
25,
31,
32,
33,
34,
45,
67,
68,
WASHING_MACHINE,
TUMBLE_DRYER,
DISHWASHER,
OVEN,
OVEN_MICROWAVE,
STEAM_OVEN,
MICROWAVE,
COFFEE_SYSTEM,
HOOD,
FRIDGE,
FREEZER,
FRIDGE_FREEZER,
ROBOT_VACUUM_CLEANER,
WASHER_DRYER,
DISH_WARMER,
STEAM_OVEN_COMBI,
WINE_CABINET,
WINE_CONDITIONING_UNIT,
WINE_STORAGE_CONDITIONING_UNIT,
STEAM_OVEN_MICRO,
DIALOG_OVEN,
WINE_CABINET_FREEZER,
],
description=MieleBinarySensorDescription(
key="info",
Expand All @@ -89,30 +131,30 @@ class MieleBinarySensorDefinition:
),
MieleBinarySensorDefinition(
types=[
1,
2,
7,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
23,
24,
25,
27,
31,
32,
33,
34,
45,
67,
68,
WASHING_MACHINE,
TUMBLE_DRYER,
DISHWASHER,
OVEN,
OVEN_MICROWAVE,
HOB_HIGHLIGHT,
STEAM_OVEN,
MICROWAVE,
COFFEE_SYSTEM,
HOOD,
FRIDGE,
FREEZER,
FRIDGE_FREEZER,
ROBOT_VACUUM_CLEANER,
WASHER_DRYER,
DISH_WARMER,
HOB_INDUCTION,
STEAM_OVEN_COMBI,
WINE_CABINET,
WINE_CONDITIONING_UNIT,
WINE_STORAGE_CONDITIONING_UNIT,
STEAM_OVEN_MICRO,
DIALOG_OVEN,
WINE_CABINET_FREEZER,
],
description=MieleBinarySensorDescription(
key="failure",
Expand Down
145 changes: 145 additions & 0 deletions custom_components/miele/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,148 @@
MIELE_API = "https://api.mcs3.miele.com/v1"
OAUTH2_AUTHORIZE = "https://api.mcs3.miele.com/thirdparty/login"
OAUTH2_TOKEN = "https://api.mcs3.miele.com/thirdparty/token"

STATE_STATUS = {
0: "reserved",
1: "off",
2: "on",
3: "programmed",
4: "programmed_waiting_to_start",
5: "running",
6: "pause",
7: "end_programmed",
8: "failure",
9: "programme interrupted",
10: "idle",
11: "rinse hold",
13: "superfreezing",
14: "supercooling",
15: "superheating",
146: "supercooling_superfreezing",
255: "not_connected",
}

STATE_PROGRAM_TYPE = {
0: "normal_operation_mode",
1: "own_program",
2: "automatic_program",
3: "cleaning_care_program",
}

STATE_PROGRAM_ID = {
1: "cottons",
3: "minimum_iron",
38: "quick_power_wash",
}

STATE_PROGRAM_PHASE = {
# Washing Machine
256: "not_running",
257: "pre_wash",
258: "soak",
259: "pre_wash",
260: "main_wash",
261: "rinse",
262: "rinse_hold",
263: "main_wash",
264: "cooling_down",
265: "drain",
266: "spin",
267: "anti_crease",
268: "finished",
269: "venting",
270: "starch_stop",
271: "freshen_up_and_moisten",
272: "steam_smoothing",
279: "hygiene",
280: "drying",
285: "disinfecting",
295: "steam_smoothing",
# Dryer
512: "not_running",
513: "program_running",
514: "drying",
515: "machine_iron",
516: "hand_iron",
517: "normal",
518: "normal_plus",
519: "cooling_down",
520: "hand_iron",
521: "anti_crease",
522: "finished",
523: "extra_dry",
524: "hand_iron",
526: "moisten",
528: "timed_drying",
529: "warm_air",
530: "steam_smoothing",
531: "comfort_cooling",
532: "rinse_out_lint",
533: "rinses",
534: "smoothing",
538: "slightly_dry",
539: "safety_cooling",
# Dishwasher
1792: "not_running",
1793: "reactivating",
1794: "pre_wash",
1795: "main_wash",
1796: "rinse",
1797: "interim_rinse",
1798: "final_rinse",
1799: "drying",
1800: "finished",
1801: "pre_wash",
}

WASHING_MACHINE = 1
TUMBLE_DRYER = 2
DISHWASHER = 7
OVEN = 12
OVEN_MICROWAVE = 13
HOB_HIGHLIGHT = 14
STEAM_OVEN = 15
MICROWAVE = 16
COFFEE_SYSTEM = 17
HOOD = 18
FRIDGE = 19
FREEZER = 20
FRIDGE_FREEZER = 21
ROBOT_VACUUM_CLEANER = 23
WASHER_DRYER = 24
DISH_WARMER = 25
HOB_INDUCTION = 27
STEAM_OVEN_COMBI = 31
WINE_CABINET = 32
WINE_CONDITIONING_UNIT = 33
WINE_STORAGE_CONDITIONING_UNIT = 34
STEAM_OVEN_MICRO = 45
DIALOG_OVEN = 67
WINE_CABINET_FREEZER = 68

APPLIANCE_TYPES = {
WASHING_MACHINE: "washing_machine",
TUMBLE_DRYER: "tumble_dryer",
DISHWASHER: "dishwasher",
OVEN: "oven",
OVEN_MICROWAVE: "oven_microwave",
HOB_HIGHLIGHT: "hob_highlight",
STEAM_OVEN: "steam_oven",
MICROWAVE: "microwave",
COFFEE_SYSTEM: "coffee_system",
HOOD: "hood",
FRIDGE: "fridge",
FREEZER: "freezer",
FRIDGE_FREEZER: "fridge_freezer",
ROBOT_VACUUM_CLEANER: "robot_vacuum_cleaner",
WASHER_DRYER: "washer_dryer",
DISH_WARMER: "dish_warmer",
HOB_INDUCTION: "hob_induction",
STEAM_OVEN_COMBI: "steam_oven_combi",
WINE_CABINET: "wine_cabinet",
WINE_CONDITIONING_UNIT: "wine_conditioning_unit",
WINE_STORAGE_CONDITIONING_UNIT: "wine_storage_conditioning_unit",
STEAM_OVEN_MICRO: "steam_oven_micro",
DIALOG_OVEN: "dialog_oven",
WINE_CABINET_FREEZER: "wine_cabinet_freezer",
}
Loading