Skip to content

Commit

Permalink
Merge pull request #61 from kingy444/version2
Browse files Browse the repository at this point in the history
Electrolux Status - Version2
  • Loading branch information
albaintor authored Oct 14, 2024
2 parents aba9e17 + f54261f commit dc2e78b
Show file tree
Hide file tree
Showing 60 changed files with 4,622 additions and 1,139 deletions.
126 changes: 77 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,98 @@
# Home Assistant Electrolux Care Integration V2 (Not Official)
# Home Assistant Electrolux Status (formerly Home Assistant Electrolux Care Integration V2)

[![Validate with HACS](https://github.com/albaintor/homeassistant_electrolux_status/actions/workflows/hacs.yml/badge.svg)](https://github.com/albaintor/homeassistant_electrolux_status/actions/workflows/hacs.yml)
[![Validate with hassfest](https://github.com/albaintor/homeassistant_electrolux_status/actions/workflows/hassfest.yml/badge.svg)](https://github.com/albaintor/homeassistant_electrolux_status/actions/workflows/hassfest.yml)
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/albaintor)

## This new integration is based on new APIs and may be unstable
As the former project has been deleted, you will need to delete the existing HACS integration and :
- Searech for "Electrolux Care Integration V2 (Not Official)" in HACS
- Or add a new repository in HACS : https://github.com/albaintor/homeassistant_electrolux_status
## Information
This is an integration to Home Assistant to communicate with the Electrolux Devices via One Connect Platform. It works with Electrolux and Electrolux owned brands, like AEG, Frigidaire, Husqvarna.
***Disclaimer*** *This Home Assistant integration was not made by Electrolux. It is not official, not developed, and not supported by Electrolux.*

## Contributing
If you are interested in contributing to the project and assisting with the integration of the new APIs, your contributions are more than welcome! Feel free to fork the repository, make changes, and submit a pull request.

Thank you for your understanding and support.

## Details
This is an integration to Home Assistant to communicate with the Electrolux OCP Platform (probably for One Connectivity Platform), Electrolux owned brands, like: Electrolux, AEG, Frigidaire, Husqvarna.
| Major Contributors | Support Link |
|-------------|--------------|
| albaintor | [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/albaintor) |
| kingy444 | [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/kingy444) |

Tested with Electrolux and AEG washer-dryer, but probably could be used with some internet connected ovens, diswashers, fridges, airconditioners.
## Prerequisites
All devices need configured and Alias set in the Electrolux app prior to configuration.
If this does not occur the home assistant integration may raise an authentication error depending on device type and region such as:
- My Electrolux Care/My AEG Care (EMEA region)
- Electrolux Kitchen/AEG Kitchen (EMEA region)
- Electrolux Life (APAC region)
- Electrolux Home+ (LATAM region)
- Electrolux Oven/Frigidaire 2.0 (NA region)

**Last changes :**
- Added support for temperatures
- Added Wifi link quality sensor
- Renamed connection state to connectivity status (old entity should be deleted if exists)
## Installation
*If the integration does not appear add a new repository in HACS manually: `https://github.com/albaintor/homeassistant_electrolux_status`*
1. Search for `Electrolux Status` in HACS.
2. Click install.
3. In the HA UI go to `Configuration` -> `Integrations` and search for `Electrolux Status`.
4. Insert your Electrolux credentials

**Known issues :**
- This integration is based on new APIs and may be unstable
- Some commands don't work (to be investigated) : several dropdown lists like setting analog temperature...
- Upstream API does not currently support `language`

### Supported and tested devices

This list is not exhaustive as your appliance may work even if not present here
- ELECTROLUX EDH803BEWA - UltimateCare 800
- ELECTROLUX EW9H283BY - PerfectCare 900
- ELECTROLUX EWF1041ZDWA - UltimateCare 900 AutoDose
- ELECTROLUX EEM69410W - MaxiFlex 700
- ELECTROLUX EOD6P77WZ - SteamBake 600
- ELECTROLUX KODDP77WX - SteamBake 600
- ELECTROLUX EHE6799SA - 609L UltimateTaste 900
- ELECTROLUX EW9H869E9 - PerfectCare 900 Dryer
- ELECTROLUX EW9H188SPC - PerfectCare 900 Dryer
- ELECTROLUX EW8F8669Q8 - PerfectCare 800 Washer
- ELECTROLUX EW9F149SP - PerfectCare 900 Washer
- ELECTROLUX EW9W161BC - PerfectCare 900 Washer & Dryer
- ELECTROLUX KEGB9300W - Dishwasher
- ELECTROLUX EEG69410W - Dishwasher
- ELECTROLUX YH7W979P9 - Airdryer
- AEG L6FBG841CA - 6000 Series Autodose
- AEG L7FENQ96 - 7000 Series ProSteam Autodose
- AEG L7FBE941Q - 7000 Series Prosense Autodose
- AEG L8FEC96QS - 8000 Series Ökomix Autodose
- AEG L9WBA61BC - 9000 Series ÖKOKombi DualSense SensiDry
- AEG BPE558370M - SteamBake 6000
- AEG FSE76738P - 7000 GlassCare
This list is non-exhaustive and your appliance may work even if not present here

## Prerequisites
All devices need configured and Alias set (otherwise the home assistant integration raises the authentication error) into following applications (depends on device type and region):
- My Electrolux Care/My AEG Care (EMEA region)
- Electrolux Kitchen/AEG Kitchen (EMEA region)
- Electrolux Life (APAC region)
- Electrolux Home+ (LATAM region)
- Electrolux Oven/Frigidaire 2.0 (NA region)
**Fridge**

## Installation
1. Click install.
2. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Electrolux status". If you can't find it, add a personalized depot in HACS > Integrations > 3 dots button on the right and type in https://github.com/albaintor/homeassistant_electrolux_status
3. Insert the Electrolux Care Application credentials
| Manufacturer | Model | Description |
| :----------- | :---- | :---------- |
| ELECTROLUX | EHE6899SA | 609L UltimateTaste 900 |
| ELECTROLUX | EHE6799SA | 609L UltimateTaste 900 |

**Dishwasher**

| Manufacturer | Model | Description |
| :----------- | :---- | :---------- |
| ELECTROLUX | EEM69410W | MaxiFlex 700|
| ELECTROLUX | EEM69410W | GlassCare 700 |
| ELECTROLUX | KEGB9300W | GlassCare 700 |
| ELECTROLUX | EEG69410W | GlassCare 700 |
| AEG | FSE76738P | 7000 GlassCare |

**Dryer**

| Manufacturer | Model | Description |
| :----------- | :---- | :---------- |
| ELECTROLUX | EDH803BEWA | UltimateCare 800 |
| ELECTROLUX | EW9H283BY | PerfectCare 900 |
| ELECTROLUX | EW9H869E9 | PerfectCare 900 |
| ELECTROLUX | EW9H869E9 | PerfectCare 900 |
| ELECTROLUX | EW9H188SPC | PerfectCare 900 |
| ELECTROLUX | YH7W979P9 | Airdryer |

**Washing Machine**

| Manufacturer | Model | Description |
| :----------- | :---- | :---------- |
| ELECTROLUX | EWF1041ZDWA | UltimateCare 900 AutoDose |
| ELECTROLUX | EW8F8669Q8 | PerfectCare 800 |
| ELECTROLUX | EW9F149SP | PerfectCare 900 |
| AEG | L6FBG841CA | 6000 Series Autodose |
| AEG | L7FENQ96 | 7000 Series ProSteam Autodose |
| AEG | L7FBE941Q | 7000 Series Prosense Autodose |
| AEG | L8FEC96QS | 8000 Series Ökomix Autodose |
| AEG | L9WBA61BC | 9000 Series ÖKOKombi DualSense SensiDry |

**Washer / Dryer Combo**

| Manufacturer | Model | Description |
| :----------- | :---- | :---------- |
| ELECTROLUX | EW9W161BC | PerfectCare 900 Washer & Dryer |

## Disclaimer
This Home Assistant integration was not made by Electrolux. It is not official, not developed, and not supported by Electrolux.
**Oven**

| Manufacturer | Model | Description |
| :----------- | :---- | :---------- |
| ELECTROLUX | EOD6P77WZ | SteamBake 600 |
| ELECTROLUX | KODDP77WX | SteamBake 600 |
| AEG | BPE558370M | SteamBake 6000 |
83 changes: 46 additions & 37 deletions custom_components/electrolux_status/__init__.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
"""electrolux status integration."""
import asyncio

import logging

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.core import Config
from homeassistant.const import (
CONF_LANGUAGE,
CONF_PASSWORD,
CONF_USERNAME,
EVENT_HOMEASSISTANT_STOP,
)
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady

from .api import Appliance, Appliances, ElectroluxLibraryEntity
from .const import CONF_LANGUAGE, DEFAULT_LANGUAGE, DEFAULT_WEBSOCKET_RENEWAL_DELAY, CONF_RENEW_INTERVAL, \
TIME_ENTITIES_TO_UPDATE
from .const import CONF_PASSWORD
from .const import CONF_USERNAME
from .const import DOMAIN
from .const import PLATFORMS
from .const import languages
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.typing import ConfigType

from .const import (
CONF_RENEW_INTERVAL,
DEFAULT_LANGUAGE,
DEFAULT_WEBSOCKET_RENEWAL_DELAY,
DOMAIN,
PLATFORMS,
languages,
)
from .coordinator import ElectroluxCoordinator
from .pyelectroluxconnect_util import pyelectroluxconnect_util
from .util import get_electrolux_session

_LOGGER: logging.Logger = logging.getLogger(__package__)


# noinspection PyUnusedLocal
async def async_setup(hass: HomeAssistant, config: Config):
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up this integration using YAML is not supported."""
return True


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up this integration using UI."""
if hass.data.get(DOMAIN) is None:
hass.data.setdefault(DOMAIN, {})
Expand All @@ -40,11 +46,19 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
username = entry.data.get(CONF_USERNAME)
password = entry.data.get(CONF_PASSWORD)
language = languages.get(entry.data.get(CONF_LANGUAGE, DEFAULT_LANGUAGE), "eng")
session = async_get_clientsession(hass)

client = get_electrolux_session(username, password, session, language)
coordinator = ElectroluxCoordinator(
hass,
client=client,
renew_interval=renew_interval,
username=username,
)

client = pyelectroluxconnect_util.get_session(username, password, language)
coordinator = ElectroluxCoordinator(hass, client=client, renew_interval=renew_interval)
await coordinator.get_stored_token()
if not await coordinator.async_login():
raise Exception("Electrolux wrong credentials")
raise ConfigEntryAuthFailed("Electrolux wrong credentials")

# Bug ?
if coordinator.config_entry is None:
Expand All @@ -57,13 +71,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
await coordinator.setup_entities()
_LOGGER.debug("async_setup_entry listen_websocket")
coordinator.listen_websocket()
#_LOGGER.debug("async_setup_entry launch_websocket_renewal_task")
#await coordinator.launch_websocket_renewal_task()
# _LOGGER.debug("async_setup_entry launch_websocket_renewal_task")
# await coordinator.launch_websocket_renewal_task()

entry.async_on_unload(
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STOP, coordinator.api.close)
)

entry.async_on_unload(entry.add_update_listener(update_listener))

_LOGGER.debug("async_setup_entry async_config_entry_first_refresh")
# Fill in the values for first time
await coordinator.async_config_entry_first_refresh()
Expand All @@ -73,32 +89,25 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

_LOGGER.debug("async_setup_entry extend PLATFORMS")
coordinator.platforms.extend(PLATFORMS)

# Call async_setup_entry in entity files
_LOGGER.debug("async_setup_entry async_forward_entry_setups")
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
_LOGGER.debug("async_setup_entry add_update_listener")
entry.add_update_listener(async_reload_entry)

_LOGGER.debug("async_setup_entry OVER")
return True


async def update_listener(hass: HomeAssistant, config_entry: ConfigEntry) -> None:
"""Update listener."""
await hass.config_entries.async_reload(config_entry.entry_id)


async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Handle removal of an entry."""
coordinator:ElectroluxCoordinator = hass.data[DOMAIN][entry.entry_id]
coordinator: ElectroluxCoordinator = hass.data[DOMAIN][entry.entry_id]
await coordinator.close_websocket()
unloaded = all(
await asyncio.gather(
*[
hass.config_entries.async_forward_entry_unload(entry, platform)
for platform in PLATFORMS
if platform in coordinator.platforms
]
)
)
if unloaded:
hass.data[DOMAIN].pop(entry.entry_id)

return unloaded
return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)


async def async_reload_entry(hass: HomeAssistant, entry: ConfigEntry) -> None:
Expand Down
Loading

0 comments on commit dc2e78b

Please sign in to comment.