Skip to content

Commit da97e57

Browse files
authored
[electroluxappliance] Initial contribution (openhab#17663)
* First version Signed-off-by: Jan Gustafsson <[email protected]>
1 parent 5929ef8 commit da97e57

27 files changed

+3170
-0
lines changed

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
/bundles/org.openhab.binding.ecovacs/ @maniac103
9797
/bundles/org.openhab.binding.ecowatt/ @lolodomo
9898
/bundles/org.openhab.binding.ekey/ @hmerk
99+
/bundles/org.openhab.binding.electroluxappliance/ @jannegpriv
99100
/bundles/org.openhab.binding.elerotransmitterstick/ @vbier
100101
/bundles/org.openhab.binding.elroconnects/ @mherwege
101102
/bundles/org.openhab.binding.emotiva/ @espenaf

bom/openhab-addons/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,11 @@
471471
<artifactId>org.openhab.binding.ekey</artifactId>
472472
<version>${project.version}</version>
473473
</dependency>
474+
<dependency>
475+
<groupId>org.openhab.addons.bundles</groupId>
476+
<artifactId>org.openhab.binding.electroluxappliance</artifactId>
477+
<version>${project.version}</version>
478+
</dependency>
474479
<dependency>
475480
<groupId>org.openhab.addons.bundles</groupId>
476481
<artifactId>org.openhab.binding.elerotransmitterstick</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
This content is produced and maintained by the openHAB project.
2+
3+
* Project home: https://www.openhab.org
4+
5+
== Declared Project Licenses
6+
7+
This program and the accompanying materials are made available under the terms
8+
of the Eclipse Public License 2.0 which is available at
9+
https://www.eclipse.org/legal/epl-2.0/.
10+
11+
== Source Code
12+
13+
https://github.com/openhab/openhab-addons
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Electrolux Appliance Binding
2+
3+
This is a binding for Electrolux appliances.
4+
5+
## Supported Things
6+
7+
This binding supports the following thing types:
8+
9+
- api: Bridge - Implements the Electrolux Group API that is used to communicate with the different appliances
10+
- air-purifier: The Electrolux Air Purifier
11+
- washing-machine: The Electrolux Washing Machine
12+
13+
## Discovery
14+
15+
After the configuration of the `api` bridge, your Electrolux appliances will be automatically discovered and placed as a thing in the inbox.
16+
17+
### Configuration Options
18+
19+
Only the bridge requires manual configuration.
20+
The Electrolux appliance things can be added by hand, or you can let the discovery mechanism automatically find them.
21+
22+
#### `api` Bridge
23+
24+
| Parameter | Description | Type | Default | Required |
25+
|--------------|--------------------------------------------------------|--------|----------|----------|
26+
| apiKey | Your created API key on developer.electrolux.one | String | NA | yes |
27+
| refreshToken | Your created refresh token on developer.electrolux.one | String | NA | yes |
28+
| refresh | Specifies the refresh interval in second | Number | 600 | yes |
29+
30+
#### `air-purifier` Electrolux Air Purifier
31+
32+
| Parameter | Description | Type | Default | Required |
33+
|--------------|--------------------------------------------------------------------------|--------|----------|----------|
34+
| serialNumber | Serial Number of your Electrolux appliance found in the Electrolux app | Number | NA | yes |
35+
36+
#### `washing-machine` Electrolux Washing Machine
37+
38+
| Parameter | Description | Type | Default | Required |
39+
|--------------|--------------------------------------------------------------------------|--------|----------|----------|
40+
| serialNumber | Serial Number of your Electrolux appliance found in the Electrolux app | Number | NA | yes |
41+
42+
## Channels
43+
44+
### Electrolux Air Purifier
45+
46+
The following channels are supported:
47+
48+
| Channel Type ID | Item Type | Description |
49+
|-----------------------------|-----------------------|--------------------------------------------------------------------------------|
50+
| temperature | Number:Temperature | This channel reports the current temperature. |
51+
| humidity | Number:Dimensionless | This channel reports the current humidity in percentage. |
52+
| tvoc | Number:Dimensionless | This channel reports the total Volatile Organic Compounds in ppb. |
53+
| pm1 | Number:Density | This channel reports the Particulate Matter 1 in microgram/m3. |
54+
| pm2_5 | Number:Density | This channel reports the Particulate Matter 2.5 in microgram/m3. |
55+
| pm10 | Number:Density | This channel reports the Particulate Matter 10 in microgram/m3. |
56+
| co2 | Number:Dimensionless | This channel reports the CO2 level in ppm. |
57+
| fan-speed | Number | This channel sets and reports the current fan speed (1-9). |
58+
| filter-life | Number:Dimensionless | This channel reports the remaining filter life in %. |
59+
| ionizer | Switch | This channel sets and reports the status of the Ionizer function (On/Off). |
60+
| door-state | Contact | This channel reports the status of the door (Opened/Closed). |
61+
| work-mode | String | This channel sets and reports the current work mode (Auto, Manual, PowerOff.) |
62+
| ui-light | Switch | This channel sets and reports the status of the UI Light function (On/Off). |
63+
| safety-lock | Switch | This channel sets and reports the status of the Safety Lock function. |
64+
| status | String | This channel is used to fetch latest status from the API. |
65+
66+
### Electrolux Washing Machine
67+
68+
The following channels are supported:
69+
70+
| Channel Type ID | Item Type | Description |
71+
|------------------------------|-----------------------|--------------------------------------------------------------------------------|
72+
| door-state | Contact | This channel reports the status of the door (Opened/Closed). |
73+
| door-lock | Contact | This channel reports the status of the door lock. |
74+
| time-to-start | Number:Time | This channel reports the remaining time for a delayed start washing program. |
75+
| time-to-end | Number:Time | This channel reports the remaining time to the end for a washing program. |
76+
| cycle-phase | String | This channel reports the washing cycle phase. |
77+
| analog-temperature | String | This channel reports the washing temperature. |
78+
| steam-value | String | This channel reports the washing steam value. |
79+
| programs-order | String | This channel reports the washing program. |
80+
| analog-spin-speed | String | This channel reports the washing spin speed. |
81+
| appliance-state | String | This channel reports the appliance state. |
82+
| appliance-mode | String | This channel reports the appliance mode. |
83+
| appliance-total-working-time | Number:Time | This channel reports the total working time for the washing machine. |
84+
| appliance-ui-sw-version | String | This channel reports the appliance UI SW version. |
85+
| optisense-result | String | This channel reports the optisense result. |
86+
| detergent-extradosage | String | This channel reports the detergent extra dosage. |
87+
| softener-extradosage | String | This channel reports the softener extra dosage. |
88+
| water-usage | Number:Volume | This channel reports the water usage in litres. |
89+
| total-wash-cycles-count | Number | This channel reports the total number of washing cycles. |
90+
| status | String | This channel is used to fetch latest status from the API. |
91+
92+
## Full Example
93+
94+
### `demo.things` Example
95+
96+
```java
97+
// Bridge configuration
98+
Bridge electroluxappliance:api:myAPI "Electrolux Group API" [apiKey="12345678", refreshToken="12345678", refresh="300"] {
99+
Thing air-purifier myair-purifier "Electrolux Pure A9" [ serialNummber="123456789" ]
100+
}
101+
```
102+
103+
## `demo.items` Example
104+
105+
```java
106+
// CO2
107+
Number:Dimensionless electroluxapplianceCO2 "Electrolux Air CO2 [%d ppm]" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:co2"}
108+
// Temperature
109+
Number:Temperature electroluxapplianceTemperature "Electrolux Air Temperature" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:temperature"}
110+
// Door status
111+
Contact electroluxapplianceDoor "Electrolux Air Door Status" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:doorOpen"}
112+
// Work mode
113+
String electroluxapplianceWorkModeSetting "electroluxappliance Work Mode Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:workMode"}
114+
// Fan speed
115+
Number electroluxapplianceFanSpeed "Electrolux Air Fan Speed Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:fanSpeed"}
116+
// UI Light
117+
Switch electroluxapplianceUILight "Electrolux Air UI Light Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:uiLight"}
118+
// Ionizer
119+
Switch electroluxapplianceIonizer "Electrolux Air Ionizer Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:ionizer"}
120+
// Safety Lock
121+
Switch electroluxapplianceSafetyLock "Electrolux Air Safety Lock Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:safetyLock"}
122+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.openhab.addons.bundles</groupId>
9+
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
10+
<version>4.3.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>org.openhab.binding.electroluxappliance</artifactId>
14+
15+
<name>openHAB Add-ons :: Bundles :: Electrolux Appliance Binding</name>
16+
17+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<features name="org.openhab.binding.electroluxappliance-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
3+
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
4+
5+
<feature name="openhab-binding-electroluxappliance" description="Electrolux Appliance Binding" version="${project.version}">
6+
<feature>openhab-runtime-base</feature>
7+
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.electroluxappliance/${project.version}</bundle>
8+
</feature>
9+
</features>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/**
2+
* Copyright (c) 2010-2024 Contributors to the openHAB project
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0
10+
*
11+
* SPDX-License-Identifier: EPL-2.0
12+
*/
13+
package org.openhab.binding.electroluxappliance.internal;
14+
15+
import java.util.Set;
16+
17+
import org.eclipse.jdt.annotation.NonNullByDefault;
18+
import org.openhab.core.thing.ThingTypeUID;
19+
20+
/**
21+
* The {@link ElectroluxApplianceBindingConstants} class defines common constants, which are
22+
* used across the whole binding.
23+
*
24+
* @author Jan Gustafsson - Initial contribution
25+
*/
26+
@NonNullByDefault
27+
public class ElectroluxApplianceBindingConstants {
28+
29+
public static final String BINDING_ID = "electroluxappliance";
30+
31+
// List of all Thing Type UIDs
32+
public static final ThingTypeUID THING_TYPE_ELECTROLUX_AIR_PURIFIER = new ThingTypeUID(BINDING_ID, "air-purifier");
33+
public static final ThingTypeUID THING_TYPE_ELECTROLUX_WASHING_MACHINE = new ThingTypeUID(BINDING_ID,
34+
"washing-machine");
35+
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "api");
36+
37+
// List of all common Channel ids
38+
public static final String CHANNEL_DOOR_STATE = "door-state";
39+
40+
// List of all Channel ids for Air Purifers
41+
public static final String CHANNEL_STATUS = "status";
42+
public static final String CHANNEL_TEMPERATURE = "temperature";
43+
public static final String CHANNEL_HUMIDITY = "humidity";
44+
public static final String CHANNEL_TVOC = "tvoc";
45+
public static final String CHANNEL_PM1 = "pm1";
46+
public static final String CHANNEL_PM25 = "pm2_5";
47+
public static final String CHANNEL_PM10 = "pm10";
48+
public static final String CHANNEL_CO2 = "co2";
49+
public static final String CHANNEL_FILTER_LIFE = "filter-life";
50+
public static final String CHANNEL_FAN_SPEED = "fan-speed";
51+
public static final String CHANNEL_WORK_MODE = "work-mode";
52+
public static final String CHANNEL_IONIZER = "ionizer";
53+
public static final String CHANNEL_UI_LIGHT = "ui-light";
54+
public static final String CHANNEL_SAFETY_LOCK = "safety-lock";
55+
56+
// List of all Channel ids for Washing Machines
57+
public static final String CHANNEL_DOOR_LOCK = "door-lock";
58+
public static final String CHANNEL_TIME_TO_START = "time-to-start";
59+
public static final String CHANNEL_TIME_TO_END = "time-to-end";
60+
public static final String CHANNEL_APPLIANCE_UI_SW_VERSION = "appliance-ui-sw-version";
61+
public static final String CHANNEL_APPLIANCE_TOTAL_WORKING_TIME = "appliance-total-working-time";
62+
public static final String CHANNEL_APPLIANCE_STATE = "appliance-state";
63+
public static final String CHANNEL_APPLIANCE_MODE = "appliance-mode";
64+
public static final String CHANNEL_OPTISENSE_RESULT = "optisense-result";
65+
public static final String CHANNEL_DETERGENT_EXTRA_DOSAGE = "detergent-extradosage";
66+
public static final String CHANNEL_SOFTENER_EXTRA_DOSAGE = "softener-extradosage";
67+
public static final String CHANNEL_WATER_USAGE = "water-usage";
68+
public static final String CHANNEL_CYCLE_PHASE = "cycle-phase";
69+
public static final String CHANNEL_TOTAL_WASH_CYCLES_COUNT = "total-wash-cycles-count";
70+
public static final String CHANNEL_ANALOG_TEMPERATURE = "analog-temperature";
71+
public static final String CHANNEL_ANALOG_SPIN_SPEED = "analog-spin-speed";
72+
public static final String CHANNEL_STEAM_VALUE = "steam-value";
73+
public static final String CHANNEL_PROGRAMS_ORDER = "programs-order";
74+
75+
// List of all Properties ids
76+
public static final String PROPERTY_BRAND = "brand";
77+
public static final String PROPERTY_COLOUR = "colour";
78+
public static final String PROPERTY_MODEL = "model";
79+
public static final String PROPERTY_DEVICE = "device";
80+
public static final String PROPERTY_FW_VERSION = "fwVersion";
81+
public static final String PROPERTY_SERIAL_NUMBER = "serialNumber";
82+
public static final String PROPERTY_WORKMODE = "workmode";
83+
84+
// List of all Commands for Air Purifiers
85+
public static final String COMMAND_WORKMODE_POWEROFF = "PowerOff";
86+
public static final String COMMAND_WORKMODE_AUTO = "Auto";
87+
public static final String COMMAND_WORKMODE_MANUAL = "Manual";
88+
89+
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_BRIDGE,
90+
THING_TYPE_ELECTROLUX_AIR_PURIFIER, THING_TYPE_ELECTROLUX_WASHING_MACHINE);
91+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (c) 2010-2024 Contributors to the openHAB project
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0
10+
*
11+
* SPDX-License-Identifier: EPL-2.0
12+
*/
13+
package org.openhab.binding.electroluxappliance.internal;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
17+
/**
18+
* The {@link ElectroluxApplianceBridgeConfiguration} class contains fields mapping bridge configuration parameters.
19+
*
20+
* @author Jan Gustafsson - Initial contribution
21+
*/
22+
@NonNullByDefault
23+
public class ElectroluxApplianceBridgeConfiguration {
24+
public String apiKey = "";
25+
public String refreshToken = "";
26+
public int refresh = 600;
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/**
2+
* Copyright (c) 2010-2024 Contributors to the openHAB project
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0
10+
*
11+
* SPDX-License-Identifier: EPL-2.0
12+
*/
13+
package org.openhab.binding.electroluxappliance.internal;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
17+
/**
18+
* The {@link ElectroluxApplianceConfiguration} class contains fields mapping thing configuration parameters.
19+
*
20+
* @author Jan Gustafsson - Initial contribution
21+
*/
22+
@NonNullByDefault
23+
public class ElectroluxApplianceConfiguration {
24+
public static final String SERIAL_NUMBER_LABEL = "serialNumber";
25+
26+
private String serialNumber = "";
27+
28+
public String getSerialNumber() {
29+
return serialNumber;
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/**
2+
* Copyright (c) 2010-2024 Contributors to the openHAB project
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0
10+
*
11+
* SPDX-License-Identifier: EPL-2.0
12+
*/
13+
package org.openhab.binding.electroluxappliance.internal;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
import org.eclipse.jdt.annotation.Nullable;
17+
18+
/**
19+
* {@link ElectroluxApplianceException} is used when there is exception communicating with Electrolux Delta API.
20+
*
21+
* @author Jan Gustafsson - Initial contribution
22+
*/
23+
@NonNullByDefault
24+
public class ElectroluxApplianceException extends Exception {
25+
26+
private static final long serialVersionUID = 2543564118231301159L;
27+
28+
public ElectroluxApplianceException(Exception source) {
29+
super(source);
30+
}
31+
32+
public ElectroluxApplianceException(String message) {
33+
super(message);
34+
}
35+
36+
@Override
37+
public @Nullable String getMessage() {
38+
Throwable throwable = getCause();
39+
if (throwable != null) {
40+
String localMessage = throwable.getMessage();
41+
if (localMessage != null) {
42+
return localMessage;
43+
}
44+
}
45+
return "";
46+
}
47+
}

0 commit comments

Comments
 (0)