Skip to content

Commit

Permalink
[melcloud] Initial Contribution
Browse files Browse the repository at this point in the history
Also-by: Pauli Anttila <[email protected]>
Also-by: Wietse van Buitenen <[email protected]>
Signed-off-by: Luca Calcaterra <[email protected]>
Co-Authored-By: pali <[email protected]>
Co-Authored-By: Wietse van Buitenen <[email protected]>
  • Loading branch information
3 people committed Sep 13, 2019
1 parent bacd33d commit 3043d0b
Show file tree
Hide file tree
Showing 33 changed files with 5,472 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.mcp23017</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.melcloud</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
Expand Down
43 changes: 43 additions & 0 deletions bundles/org.openhab.binding.melcloud/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
27 changes: 27 additions & 0 deletions bundles/org.openhab.binding.melcloud/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.antlr*
.idea
.DS_Store
*.iml
npm-debug.log

.metadata/
bin/
target/
src-gen/
xtend-gen/

*/plugin.xml_gen
**/.settings/org.eclipse.*

bundles/**/src/main/history
features/**/src/main/history
features/**/src/main/feature

<<<<<<< HEAD
#.vscode
=======
.vscode
>>>>>>> b2ba5afe65f465d4bcac9a664cd559bb5564c399
.factorypath

dependencies.xml
23 changes: 23 additions & 0 deletions bundles/org.openhab.binding.melcloud/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.melcloud</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
20 changes: 20 additions & 0 deletions bundles/org.openhab.binding.melcloud/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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/openhab2-addons

== Third-party Content

Gson
* License: Apache 2.0 license
* Project: https://github.com/google/gson
* Source: https://github.com/google/gson
125 changes: 125 additions & 0 deletions bundles/org.openhab.binding.melcloud/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@

### N.B.: For developers who wants contribute not use this repo. Use Instead the openhab2-fork at https://github.com/lucacalcaterra/openhab2-addons
# MELCloud Binding

This is an openHAB binding for Mitsubishi MELCloud (https://www.melcloud.com/).
Installing this binding you can control your Mitsubishi devices from openHAB without accessing the MELCloud App and benefiting from all openHAB automations.

## Supported Things

Supported thing types

* melcloudaccount (bridge)
* acdevice

A bridge is required to connect to your MELCloud account.


## Discovery

Discovery is used _after_ a bridge has been created and configured with your login information.

1. Add the binding
2. Add a new thing of type melcloudaccount and configure with username and password
3. Go to Inbox and start discovery of A.C. devices using MELCloud Binding
4. A.C. devices should appear in your inbox

Binding support also manual thing configuration by thing files.

## Thing Configuration

In order to manually create a thing file and not use the discovery routine you will need to know device MELCloud device ID.
This is a bit difficult to get. The easiest way of getting this is enable debug level logging of the binding or discovery devices by the binding (discovered device can be removed afterwards).

MELCloud account configuration:

| Config | Mandatory | Description |
|----------|-----------|-----------------------------------------|
| username | x | Email address tied to MELCloud account. |
| password | x | Password to MELCloud account. |
| language | | Language ID, see table below. |

| LanguageId | Language |
|-------------|-------------------|
| 0 | English (default) |
| 1 | Bulgarian |
| 2 | Czech |
| 3 | Danish |
| 4 | German |
| 5 | Estonian |
| 6 | Spanish |
| 7 | French |
| 8 | Armenian |
| 9 | Latvian |
| 10 | Lithuanian |
| 11 | Hungarian |
| 12 | Dutch |
| 13 | Norwegian |
| 14 | Polish |
| 15 | Portuguese |
| 16 | Russian |
| 17 | Finnish |
| 18 | Swedish |
| 19 | Italian |
| 20 | Ukrainian |
| 21 | Turkish |
| 22 | Greek |
| 23 | Croatian |
| 24 | Romanian |
| 25 | Slovenian |


A.C. device configuration:

| Config | Mandatory | Description |
|-----------------|-----------|---------------------------------------------------------------------------------------|
| deviceID | x | MELCloud device ID. |
| buildingID | | MELCloud building ID. If not defined, binding tries to find matching id by device ID. |
| pollingInterval | | Refresh time interval in seconds for updates from MELCloud. Defaults to 60 seconds. |



## Channels

A.C. device channels

| Channel | Type | Description | Read Only |
|---------------------|----------|----------------------------------------------------------------------------|-----------|
| power | Switch | Power Status of Device. | False |
| operationMode | Number | Operation mode: 1 = Heat, 2 = Dry, 3 = Cool, 7 = Fan, 8 = Auto. | False |
| setTemperature | Number | Set Temperature: Min = 10, Max = 40. | False |
| fanSpeed | Number | Fan speed: 0 = Auto, 1 = 1, 2 = 2, 3 = 3, 4 = 4, 5 = 5. | False |
| vaneHorizontal | Number | Vane Horizontal: 0 = Auto, 1 = 1, 2 = 2, 3 = 3, 4 = 4, 5 = 5, 12 = Swing. | False |
| vaneVertical | Number | Vane Vertical: 0 = Auto, 1 = 1, 2 = 2, 3 = 3, 4 = 4, 5 = 5, 7 = Swing. | False |
| roomTemperature | Number | Room temperature. | True |
| lastCommunication | DateTime | Last Communication time when MELCloud communicated to the device. | True |
| nextCommunication | DateTime | Next communication time when MELCloud will communicate to the device. | True |
| offline | Switch | Is device in offline state. | True |
| hasPendingCommand | Switch | Device has a pending command(s). | True |


## Full Example for items configuration

**melcloud.things**

```
Bridge melcloud:melcloudaccount:myaccount "My MELCloud account" [ username="[email protected]", password="xxxxxx", language="0" ] {
Thing acdevice livingroom "Livingroom A.C. device" [ deviceID=123456, pollingInterval=60 ]
}
```

**melcloud.items**

```
Switch power { channel="melcloud:acdevice:myaccount:livingroom:power" }
Number operationMode { channel="melcloud:acdevice:myaccount:livingroom:operationMode" }
Number setTemperature { channel="melcloud:acdevice:myaccount:livingroom:setTemperature" }
Number fanSpeed { channel="melcloud:acdevice:myaccount:livingroom:fanSpeed" }
Number vaneHorizontal { channel="melcloud:acdevice:myaccount:livingroom:vaneHorizontal" }
Number vaneVertical { channel="melcloud:acdevice:myaccount:livingroom:vaneVertical" }
Number roomTemperature { channel="melcloud:acdevice:myaccount:livingroom:roomTemperature" }
DateTime lastCommunication { channel="melcloud:acdevice:myaccount:livingroom:lastCommunication" }
DateTime nextCommunication { channel="melcloud:acdevice:myaccount:livingroom:nextCommunication" }
Switch offline { channel="melcloud:acdevice:myaccount:livingroom:offline" }
Switch hasPendingCommand { channel="melcloud:acdevice:myaccount:livingroom:hasPendingCommand" }
```
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.melcloud/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.melcloud</artifactId>

<name>openHAB Add-ons :: Bundles :: MELCloud Binding</name>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2010-2019 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.melcloud.internal;

import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.eclipse.smarthome.core.thing.ThingTypeUID;

/**
* The {@link MelCloudBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author LucaCalcaterra - Initial contribution
*/
public class MelCloudBindingConstants {

private static final String BINDING_ID = "melcloud";

// List of Bridge Type UIDs
public static final ThingTypeUID THING_TYPE_MELCLOUD_ACCOUNT = new ThingTypeUID(BINDING_ID, "melcloudaccount");

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_ACDEVICE = new ThingTypeUID(BINDING_ID, "acdevice");

// List of all Channel ids
public static final String CHANNEL_POWER = "power";
public static final String CHANNEL_OPERATION_MODE = "operationMode";
public static final String CHANNEL_SET_TEMPERATURE = "setTemperature";
public static final String CHANNEL_FAN_SPEED = "fanSpeed";
public static final String CHANNEL_VANE_HORIZONTAL = "vaneHorizontal";
public static final String CHANNEL_VANE_VERTICAL = "vaneVertical";

// Read Only Channels
public static final String CHANNEL_ROOM_TEMPERATURE = "roomTemperature";
public static final String CHANNEL_LAST_COMMUNICATION = "lastCommunication";
public static final String CHANNEL_NEXT_COMMUNICATION = "nextCommunication";
public static final String CHANNEL_HAS_PENDING_COMMAND = "hasPendingCommand";
public static final String CHANNEL_OFFLINE = "offline";

public static final Set<ThingTypeUID> SUPPORTED_THING_TYPE_UIDS = Collections
.unmodifiableSet(Stream.of(THING_TYPE_MELCLOUD_ACCOUNT, THING_TYPE_ACDEVICE).collect(Collectors.toSet()));

public static final Set<ThingTypeUID> DISCOVERABLE_THING_TYPE_UIDS = Collections.singleton(THING_TYPE_ACDEVICE);
}
Loading

0 comments on commit 3043d0b

Please sign in to comment.