forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[electroluxair] Initial contribution (openhab#11116)
* [electroluxair] Initial contribution of the electroluxair openHAB binding Signed-off-by: Jan Gustafsson <jannegpriv@gmail.com> * Updated after code review. Signed-off-by: Jan Gustafsson <jannegpriv@gmail.com> * Updated after code review and also copyright to 2022. Signed-off-by: Jan Gustafsson <jannegpriv@gmail.com> * [electroluxair] Initial contribution of the electroluxair openHAB binding Signed-off-by: Jan Gustafsson <jannegpriv@gmail.com> * Updated after code review. Signed-off-by: Jan Gustafsson <jannegpriv@gmail.com> * Updated after code review Signed-off-by: Jan Gustafsson <jannegpriv@gmail.com>
- Loading branch information
1 parent
e27308b
commit 61bbef9
Showing
20 changed files
with
1,917 additions
and
0 deletions.
There are no files selected for viewing
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 |
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,92 @@ | ||
# ElectroluxAir Binding | ||
|
||
This is an openHAB binding for the Pure A9 Air Purifier, by Electrolux. | ||
|
||
This binding uses the Electrolux Delta REST API. | ||
|
||
 | ||
|
||
## Supported Things | ||
|
||
This binding supports the following thing types: | ||
|
||
- api: Bridge - Implements the API that is used to communicate with the Air Purifier | ||
|
||
|
||
- electroluxpurea9: The Pure A9 Air Purifier | ||
|
||
## Discovery | ||
|
||
After the configuration of the Bridge, your Electrolux Pure A9 device will be automatically discovered and placed as a thing in the inbox. | ||
|
||
|
||
### Configuration Options | ||
|
||
Only the bridge require manual configuration. The Electrolux Pure A9 thing can be added by hand, or you can let the discovery mechanism automatically find it. | ||
|
||
|
||
#### Bridge | ||
|
||
| Parameter | Description | Type | Default | Required | | ||
|-----------|--------------------------------------------------------------|--------|----------|----------| | ||
| username | The username used to connect to the Electrolux Wellbeing app | String | NA | yes | | ||
| password | The password used to connect to the Electrolux Wellbeing app | String | NA | yes | | ||
| refresh | Specifies the refresh interval in second | Number | 600 | yes | | ||
|
||
#### Electrolux Pure A9 | ||
|
||
| Parameter | Description | Type | Default | Required | | ||
|-----------|-------------------------------------------------------------------------|--------|----------|----------| | ||
| deviceId | Product ID of your Electrolux Pure A9 found in Electrolux Wellbeing app | Number | NA | yes | | ||
|
||
|
||
## Channels | ||
|
||
### Electrolux Pure A9 | ||
|
||
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:Density | This channel reports the total Volatile Organic Compounds in microgram/m3. | | ||
| pm1 | Number:Dimensionless | This channel reports the Particulate Matter 1 in ppb. | | ||
| pm2_5 | Number:Dimensionless | This channel reports the Particulate Matter 2.5 in ppb. | | ||
| pm10 | Number:Dimensionless | This channel reports the Particulate Matter 10 in ppb. | | ||
| co2 | Number:Dimensionless | This channel reports the CO2 level in ppm. | | ||
| fanSpeed | Number | This channel sets and reports the current fan speed (1-9). | | ||
| filterLife | 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). | | ||
| doorOpen | Contact | This channel reports the status of door (Opened/Closed). | | ||
| workMode | String | This channel sets and reports the current work mode (Auto, Manual, PowerOff.)| | ||
|
||
|
||
## Full Example | ||
|
||
### Things-file | ||
|
||
```` | ||
// Bridge configuration | ||
Bridge electroluxair:api:myAPI "Electrolux Delta API" [username="user@password.com", password="12345", refresh="300"] { | ||
Thing electroluxpurea9 myElectroluxPureA9 "Electrolux Pure A9" [ deviceId="123456789" ] | ||
} | ||
```` | ||
|
||
## Items-file | ||
|
||
```` | ||
// CO2 | ||
Number ElectroluxAirCO2 "Electrolux Air CO2 [%d ppm]" {channel="electroluxair:electroluxpurea9:myAPI:MyElectroluxPureA9:co2"} | ||
// Temperature | ||
Number:Temperature ElectroluxAirTemperature "Electrolux Air Temperature" {channel="electroluxair:electroluxpurea9:myAPI:myElectroluxPureA9:temperature"} | ||
// Door status | ||
Contact ElectroluxAirDoor "Electrolux Air Door Status" {channel="electroluxair:electroluxpurea9:myAPI:myElectroluxPureA9:doorOpen"} | ||
// Work mode | ||
String ElectroluxAirWorkModeSetting "ElectroluxAir Work Mode Setting" {channel="electroluxair:electroluxpurea9:myAPI:myElectroluxPureA9:workMode"} | ||
// Fan speed | ||
Number ElectroluxAirFanSpeed "Electrolux Air Fan Speed Setting" {channel="electroluxair:electroluxpurea9:myAPI:myElectroluxPureA9:fanSpeed"} | ||
```` | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://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>3.3.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.electroluxair</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: ElectroluxAir Binding</name> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.electroluxair/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.electroluxair-${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-electroluxair" description="ElectroluxAir Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.electroluxair/${project.version}</bundle> | ||
</feature> | ||
</features> |
66 changes: 66 additions & 0 deletions
66
...c/main/java/org/openhab/binding/electroluxair/internal/ElectroluxAirBindingConstants.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,66 @@ | ||
/** | ||
* Copyright (c) 2010-2022 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.electroluxair.internal; | ||
|
||
import java.util.Set; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link ElectroluxAirBindingConstants} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxAirBindingConstants { | ||
|
||
public static final String BINDING_ID = "electroluxair"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_ELECTROLUX_PURE_A9 = new ThingTypeUID(BINDING_ID, "electroluxpurea9"); | ||
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "api"); | ||
|
||
// List of all Channel ids | ||
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 = "filterLife"; | ||
public static final String CHANNEL_DOOR_OPEN = "doorOpen"; | ||
public static final String CHANNEL_FAN_SPEED = "fanSpeed"; | ||
public static final String CHANNEL_WORK_MODE = "workMode"; | ||
public static final String CHANNEL_IONIZER = "ionizer"; | ||
|
||
// 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 | ||
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_PURE_A9); | ||
} |
28 changes: 28 additions & 0 deletions
28
...ain/java/org/openhab/binding/electroluxair/internal/ElectroluxAirBridgeConfiguration.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,28 @@ | ||
/** | ||
* Copyright (c) 2010-2022 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.electroluxair.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* The {@link ElectroluxAirBridgeConfiguration} class contains fields mapping bridge configuration parameters. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxAirBridgeConfiguration { | ||
public @Nullable String username; | ||
public @Nullable String password; | ||
public int refresh; | ||
} |
31 changes: 31 additions & 0 deletions
31
.../src/main/java/org/openhab/binding/electroluxair/internal/ElectroluxAirConfiguration.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-2022 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.electroluxair.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* The {@link ElectroluxAirConfiguration} class contains fields mapping thing configuration parameters. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxAirConfiguration { | ||
public static final String DEVICE_ID_LABEL = "deviceId"; | ||
|
||
private String deviceId = ""; | ||
|
||
public String getDeviceId() { | ||
return deviceId; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...xair/src/main/java/org/openhab/binding/electroluxair/internal/ElectroluxAirException.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-2022 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.electroluxair.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* {@link ElectroluxAirException} is used when there is exception communicating with Electrolux Delta API. | ||
* | ||
* @author Jan Gustafsson - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ElectroluxAirException extends Exception { | ||
|
||
private static final long serialVersionUID = 2543564118231301159L; | ||
|
||
public ElectroluxAirException(Exception source) { | ||
super(source); | ||
} | ||
|
||
public ElectroluxAirException(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.