-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[electroluxappliance] Initial contribution (#17663)
* First version Signed-off-by: Jan Gustafsson <[email protected]>
- Loading branch information
1 parent
5929ef8
commit da97e57
Showing
27 changed files
with
3,170 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/openhab/openhab-addons |
122 changes: 122 additions & 0 deletions
122
bundles/org.openhab.binding.electroluxappliance/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Electrolux Appliance Binding | ||
|
||
This is a binding for Electrolux appliances. | ||
|
||
## Supported Things | ||
|
||
This binding supports the following thing types: | ||
|
||
- api: Bridge - Implements the Electrolux Group API that is used to communicate with the different appliances | ||
- air-purifier: The Electrolux Air Purifier | ||
- washing-machine: The Electrolux Washing Machine | ||
|
||
## Discovery | ||
|
||
After the configuration of the `api` bridge, your Electrolux appliances will be automatically discovered and placed as a thing in the inbox. | ||
|
||
### Configuration Options | ||
|
||
Only the bridge requires manual configuration. | ||
The Electrolux appliance things can be added by hand, or you can let the discovery mechanism automatically find them. | ||
|
||
#### `api` Bridge | ||
|
||
| Parameter | Description | Type | Default | Required | | ||
|--------------|--------------------------------------------------------|--------|----------|----------| | ||
| apiKey | Your created API key on developer.electrolux.one | String | NA | yes | | ||
| refreshToken | Your created refresh token on developer.electrolux.one | String | NA | yes | | ||
| refresh | Specifies the refresh interval in second | Number | 600 | yes | | ||
|
||
#### `air-purifier` Electrolux Air Purifier | ||
|
||
| Parameter | Description | Type | Default | Required | | ||
|--------------|--------------------------------------------------------------------------|--------|----------|----------| | ||
| serialNumber | Serial Number of your Electrolux appliance found in the Electrolux app | Number | NA | yes | | ||
|
||
#### `washing-machine` Electrolux Washing Machine | ||
|
||
| Parameter | Description | Type | Default | Required | | ||
|--------------|--------------------------------------------------------------------------|--------|----------|----------| | ||
| serialNumber | Serial Number of your Electrolux appliance found in the Electrolux app | Number | NA | yes | | ||
|
||
## Channels | ||
|
||
### Electrolux Air Purifier | ||
|
||
The following channels are supported: | ||
|
||
| Channel Type ID | Item Type | Description | | ||
|-----------------------------|-----------------------|--------------------------------------------------------------------------------| | ||
| temperature | Number:Temperature | This channel reports the current temperature. | | ||
| humidity | Number:Dimensionless | This channel reports the current humidity in percentage. | | ||
| tvoc | Number:Dimensionless | This channel reports the total Volatile Organic Compounds in ppb. | | ||
| pm1 | Number:Density | This channel reports the Particulate Matter 1 in microgram/m3. | | ||
| pm2_5 | Number:Density | This channel reports the Particulate Matter 2.5 in microgram/m3. | | ||
| pm10 | Number:Density | This channel reports the Particulate Matter 10 in microgram/m3. | | ||
| co2 | Number:Dimensionless | This channel reports the CO2 level in ppm. | | ||
| fan-speed | Number | This channel sets and reports the current fan speed (1-9). | | ||
| filter-life | Number:Dimensionless | This channel reports the remaining filter life in %. | | ||
| ionizer | Switch | This channel sets and reports the status of the Ionizer function (On/Off). | | ||
| door-state | Contact | This channel reports the status of the door (Opened/Closed). | | ||
| work-mode | String | This channel sets and reports the current work mode (Auto, Manual, PowerOff.) | | ||
| ui-light | Switch | This channel sets and reports the status of the UI Light function (On/Off). | | ||
| safety-lock | Switch | This channel sets and reports the status of the Safety Lock function. | | ||
| status | String | This channel is used to fetch latest status from the API. | | ||
|
||
### Electrolux Washing Machine | ||
|
||
The following channels are supported: | ||
|
||
| Channel Type ID | Item Type | Description | | ||
|------------------------------|-----------------------|--------------------------------------------------------------------------------| | ||
| door-state | Contact | This channel reports the status of the door (Opened/Closed). | | ||
| door-lock | Contact | This channel reports the status of the door lock. | | ||
| time-to-start | Number:Time | This channel reports the remaining time for a delayed start washing program. | | ||
| time-to-end | Number:Time | This channel reports the remaining time to the end for a washing program. | | ||
| cycle-phase | String | This channel reports the washing cycle phase. | | ||
| analog-temperature | String | This channel reports the washing temperature. | | ||
| steam-value | String | This channel reports the washing steam value. | | ||
| programs-order | String | This channel reports the washing program. | | ||
| analog-spin-speed | String | This channel reports the washing spin speed. | | ||
| appliance-state | String | This channel reports the appliance state. | | ||
| appliance-mode | String | This channel reports the appliance mode. | | ||
| appliance-total-working-time | Number:Time | This channel reports the total working time for the washing machine. | | ||
| appliance-ui-sw-version | String | This channel reports the appliance UI SW version. | | ||
| optisense-result | String | This channel reports the optisense result. | | ||
| detergent-extradosage | String | This channel reports the detergent extra dosage. | | ||
| softener-extradosage | String | This channel reports the softener extra dosage. | | ||
| water-usage | Number:Volume | This channel reports the water usage in litres. | | ||
| total-wash-cycles-count | Number | This channel reports the total number of washing cycles. | | ||
| status | String | This channel is used to fetch latest status from the API. | | ||
|
||
## Full Example | ||
|
||
### `demo.things` Example | ||
|
||
```java | ||
// Bridge configuration | ||
Bridge electroluxappliance:api:myAPI "Electrolux Group API" [apiKey="12345678", refreshToken="12345678", refresh="300"] { | ||
Thing air-purifier myair-purifier "Electrolux Pure A9" [ serialNummber="123456789" ] | ||
} | ||
``` | ||
|
||
## `demo.items` Example | ||
|
||
```java | ||
// CO2 | ||
Number:Dimensionless electroluxapplianceCO2 "Electrolux Air CO2 [%d ppm]" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:co2"} | ||
// Temperature | ||
Number:Temperature electroluxapplianceTemperature "Electrolux Air Temperature" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:temperature"} | ||
// Door status | ||
Contact electroluxapplianceDoor "Electrolux Air Door Status" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:doorOpen"} | ||
// Work mode | ||
String electroluxapplianceWorkModeSetting "electroluxappliance Work Mode Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:workMode"} | ||
// Fan speed | ||
Number electroluxapplianceFanSpeed "Electrolux Air Fan Speed Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:fanSpeed"} | ||
// UI Light | ||
Switch electroluxapplianceUILight "Electrolux Air UI Light Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:uiLight"} | ||
// Ionizer | ||
Switch electroluxapplianceIonizer "Electrolux Air Ionizer Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:ionizer"} | ||
// Safety Lock | ||
Switch electroluxapplianceSafetyLock "Electrolux Air Safety Lock Setting" {channel="electroluxappliance:air-purifier:myAPI:myair-purifier:safetyLock"} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>4.3.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.electroluxappliance</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: Electrolux Appliance Binding</name> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.electroluxappliance/src/main/feature/feature.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.electroluxappliance-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
||
<feature name="openhab-binding-electroluxappliance" description="Electrolux Appliance Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.electroluxappliance/${project.version}</bundle> | ||
</feature> | ||
</features> |
91 changes: 91 additions & 0 deletions
91
...org/openhab/binding/electroluxappliance/internal/ElectroluxApplianceBindingConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/** | ||
* Copyright (c) 2010-2024 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.electroluxappliance.internal; | ||
|
||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link ElectroluxApplianceBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxApplianceBindingConstants { | ||
|
||
public static final String BINDING_ID = "electroluxappliance"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_ELECTROLUX_AIR_PURIFIER = new ThingTypeUID(BINDING_ID, "air-purifier"); | ||
public static final ThingTypeUID THING_TYPE_ELECTROLUX_WASHING_MACHINE = new ThingTypeUID(BINDING_ID, | ||
"washing-machine"); | ||
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "api"); | ||
|
||
// List of all common Channel ids | ||
public static final String CHANNEL_DOOR_STATE = "door-state"; | ||
|
||
// List of all Channel ids for Air Purifers | ||
public static final String CHANNEL_STATUS = "status"; | ||
public static final String CHANNEL_TEMPERATURE = "temperature"; | ||
public static final String CHANNEL_HUMIDITY = "humidity"; | ||
public static final String CHANNEL_TVOC = "tvoc"; | ||
public static final String CHANNEL_PM1 = "pm1"; | ||
public static final String CHANNEL_PM25 = "pm2_5"; | ||
public static final String CHANNEL_PM10 = "pm10"; | ||
public static final String CHANNEL_CO2 = "co2"; | ||
public static final String CHANNEL_FILTER_LIFE = "filter-life"; | ||
public static final String CHANNEL_FAN_SPEED = "fan-speed"; | ||
public static final String CHANNEL_WORK_MODE = "work-mode"; | ||
public static final String CHANNEL_IONIZER = "ionizer"; | ||
public static final String CHANNEL_UI_LIGHT = "ui-light"; | ||
public static final String CHANNEL_SAFETY_LOCK = "safety-lock"; | ||
|
||
// List of all Channel ids for Washing Machines | ||
public static final String CHANNEL_DOOR_LOCK = "door-lock"; | ||
public static final String CHANNEL_TIME_TO_START = "time-to-start"; | ||
public static final String CHANNEL_TIME_TO_END = "time-to-end"; | ||
public static final String CHANNEL_APPLIANCE_UI_SW_VERSION = "appliance-ui-sw-version"; | ||
public static final String CHANNEL_APPLIANCE_TOTAL_WORKING_TIME = "appliance-total-working-time"; | ||
public static final String CHANNEL_APPLIANCE_STATE = "appliance-state"; | ||
public static final String CHANNEL_APPLIANCE_MODE = "appliance-mode"; | ||
public static final String CHANNEL_OPTISENSE_RESULT = "optisense-result"; | ||
public static final String CHANNEL_DETERGENT_EXTRA_DOSAGE = "detergent-extradosage"; | ||
public static final String CHANNEL_SOFTENER_EXTRA_DOSAGE = "softener-extradosage"; | ||
public static final String CHANNEL_WATER_USAGE = "water-usage"; | ||
public static final String CHANNEL_CYCLE_PHASE = "cycle-phase"; | ||
public static final String CHANNEL_TOTAL_WASH_CYCLES_COUNT = "total-wash-cycles-count"; | ||
public static final String CHANNEL_ANALOG_TEMPERATURE = "analog-temperature"; | ||
public static final String CHANNEL_ANALOG_SPIN_SPEED = "analog-spin-speed"; | ||
public static final String CHANNEL_STEAM_VALUE = "steam-value"; | ||
public static final String CHANNEL_PROGRAMS_ORDER = "programs-order"; | ||
|
||
// List of all Properties ids | ||
public static final String PROPERTY_BRAND = "brand"; | ||
public static final String PROPERTY_COLOUR = "colour"; | ||
public static final String PROPERTY_MODEL = "model"; | ||
public static final String PROPERTY_DEVICE = "device"; | ||
public static final String PROPERTY_FW_VERSION = "fwVersion"; | ||
public static final String PROPERTY_SERIAL_NUMBER = "serialNumber"; | ||
public static final String PROPERTY_WORKMODE = "workmode"; | ||
|
||
// List of all Commands for Air Purifiers | ||
public static final String COMMAND_WORKMODE_POWEROFF = "PowerOff"; | ||
public static final String COMMAND_WORKMODE_AUTO = "Auto"; | ||
public static final String COMMAND_WORKMODE_MANUAL = "Manual"; | ||
|
||
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(THING_TYPE_BRIDGE, | ||
THING_TYPE_ELECTROLUX_AIR_PURIFIER, THING_TYPE_ELECTROLUX_WASHING_MACHINE); | ||
} |
27 changes: 27 additions & 0 deletions
27
.../openhab/binding/electroluxappliance/internal/ElectroluxApplianceBridgeConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Copyright (c) 2010-2024 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.electroluxappliance.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link ElectroluxApplianceBridgeConfiguration} class contains fields mapping bridge configuration parameters. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxApplianceBridgeConfiguration { | ||
public String apiKey = ""; | ||
public String refreshToken = ""; | ||
public int refresh = 600; | ||
} |
31 changes: 31 additions & 0 deletions
31
...va/org/openhab/binding/electroluxappliance/internal/ElectroluxApplianceConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Copyright (c) 2010-2024 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.electroluxappliance.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link ElectroluxApplianceConfiguration} class contains fields mapping thing configuration parameters. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxApplianceConfiguration { | ||
public static final String SERIAL_NUMBER_LABEL = "serialNumber"; | ||
|
||
private String serialNumber = ""; | ||
|
||
public String getSerialNumber() { | ||
return serialNumber; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...n/java/org/openhab/binding/electroluxappliance/internal/ElectroluxApplianceException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright (c) 2010-2024 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.electroluxappliance.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* {@link ElectroluxApplianceException} is used when there is exception communicating with Electrolux Delta API. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxApplianceException extends Exception { | ||
|
||
private static final long serialVersionUID = 2543564118231301159L; | ||
|
||
public ElectroluxApplianceException(Exception source) { | ||
super(source); | ||
} | ||
|
||
public ElectroluxApplianceException(String message) { | ||
super(message); | ||
} | ||
|
||
@Override | ||
public @Nullable String getMessage() { | ||
Throwable throwable = getCause(); | ||
if (throwable != null) { | ||
String localMessage = throwable.getMessage(); | ||
if (localMessage != null) { | ||
return localMessage; | ||
} | ||
} | ||
return ""; | ||
} | ||
} |
Oops, something went wrong.