Skip to content

Commit

Permalink
[bticinosmarther] Initial contribution (openhab#7533)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Possieri <[email protected]>
  • Loading branch information
MrRonfo authored and markus7017 committed Sep 18, 2020
1 parent 8400422 commit 55adbb0
Show file tree
Hide file tree
Showing 65 changed files with 7,873 additions and 1 deletion.
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
/bundles/org.openhab.binding.boschindego/ @jofleck
/bundles/org.openhab.binding.bosesoundtouch/ @marvkis @tratho
/bundles/org.openhab.binding.bsblan/ @hypetsch
/bundles/org.openhab.binding.bticinosmarther/ @MrRonfo
/bundles/org.openhab.binding.buienradar/ @gedejong
/bundles/org.openhab.binding.chromecast/ @kaikreuzer
/bundles/org.openhab.binding.cm11a/ @BobRak
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@
<artifactId>org.openhab.binding.bsblan</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.bticinosmarther</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.buienradar</artifactId>
Expand Down
32 changes: 32 additions & 0 deletions bundles/org.openhab.binding.bticinosmarther/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions bundles/org.openhab.binding.bticinosmarther/.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.bticinosmarther</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>
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.bticinosmarther/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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

Some code of this bundle originates from or was inspired by:
* Tim Waterhouse (Daikin binding)
* Hilbrand Bouwkamp (Spotify binding)
322 changes: 322 additions & 0 deletions bundles/org.openhab.binding.bticinosmarther/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.bticinosmarther/pom.xml
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 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>2.5.7-SNAPSHOT</version>
</parent>

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

<name>openHAB Add-ons :: Bundles :: BTicino Smarther Binding</name>

</project>
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.bticinosmarther-${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-bticinosmarther" description="BTicino Smarther Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.bticinosmarther/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/**
* Copyright (c) 2010-2020 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.bticinosmarther.internal;

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

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.smarthome.core.thing.ThingTypeUID;

/**
* The {@code SmartherBindingConstants} class defines the common constants used across the whole binding.
*
* @author Fabio Possieri - Initial contribution
*/
@NonNullByDefault
public class SmartherBindingConstants {

private static final String BINDING_ID = "bticinosmarther";

// Date and time formats used by the binding
public static final String DTF_DATE = "dd/MM/yyyy";
public static final String DTF_DATETIME = "yyyy-MM-dd'T'HH:mm:ss";
public static final String DTF_DATETIME_EXT = "yyyy-MM-dd'T'HH:mm:ssXXX";
public static final String DTF_TODAY = "'Today at' HH:mm";
public static final String DTF_TOMORROW = "'Tomorrow at' HH:mm";
public static final String DTF_DAY_HHMM = "dd/MM/yyyy 'at' HH:mm";

// Generic constants
public static final String HTTPS_SCHEMA = "https";
public static final String NAME_SEPARATOR = ", ";
public static final String UNAVAILABLE = "N/A";
public static final String DEFAULT_PROGRAM = "Default";

// List of BTicino/Legrand API gateway related urls, information
public static final String SMARTHER_ACCOUNT_URL = "https://partners-login.eliotbylegrand.com";
public static final String SMARTHER_AUTHORIZE_URL = SMARTHER_ACCOUNT_URL + "/authorize";
public static final String SMARTHER_API_TOKEN_URL = SMARTHER_ACCOUNT_URL + "/token";
public static final String SMARTHER_API_SCOPES = Stream.of("comfort.read", "comfort.write")
.collect(Collectors.joining(" "));
public static final String SMARTHER_API_URL = "https://api.developer.legrand.com/smarther/v2.0";

// Servlets and resources aliases
public static final String AUTH_SERVLET_ALIAS = "/" + BINDING_ID + "/connectsmarther";
public static final String NOTIFY_SERVLET_ALIAS = "/" + BINDING_ID + "/notifysmarther";
public static final String IMG_SERVLET_ALIAS = "/img";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge");
public static final ThingTypeUID THING_TYPE_MODULE = new ThingTypeUID(BINDING_ID, "module");

// List of all common properties
public static final String PROPERTY_STATUS_REFRESH_PERIOD = "statusRefreshPeriod";

// List of all bridge properties
public static final String PROPERTY_SUBSCRIPTION_KEY = "subscriptionKey";
public static final String PROPERTY_CLIENT_ID = "clientId";
public static final String PROPERTY_CLIENT_SECRET = "clientSecret";
public static final String PROPERTY_NOTIFICATION_URL = "notificationUrl";
public static final String PROPERTY_NOTIFICATIONS = "notifications";

// List of all module properties
public static final String PROPERTY_PLANT_ID = "plantId";
public static final String PROPERTY_MODULE_ID = "moduleId";
public static final String PROPERTY_MODULE_NAME = "moduleName";
public static final String PROPERTY_DEVICE_TYPE = "deviceType";

// List of all bridge Status Channel ids
public static final String CHANNEL_STATUS_API_CALLS_HANDLED = "status#apiCallsHandled";
public static final String CHANNEL_STATUS_NOTIFS_RECEIVED = "status#notifsReceived";
public static final String CHANNEL_STATUS_NOTIFS_REJECTED = "status#notifsRejected";
// List of all bridge Config Channel ids
public static final String CHANNEL_CONFIG_FETCH_LOCATIONS = "config#fetchLocations";

// List of all module Measures Channel ids
public static final String CHANNEL_MEASURES_TEMPERATURE = "measures#temperature";
public static final String CHANNEL_MEASURES_HUMIDITY = "measures#humidity";
// List of all module Status Channel ids
public static final String CHANNEL_STATUS_STATE = "status#state";
public static final String CHANNEL_STATUS_FUNCTION = "status#function";
public static final String CHANNEL_STATUS_MODE = "status#mode";
public static final String CHANNEL_STATUS_TEMPERATURE = "status#temperature";
public static final String CHANNEL_STATUS_PROGRAM = "status#program";
public static final String CHANNEL_STATUS_ENDTIME = "status#endTime";
public static final String CHANNEL_STATUS_TEMP_FORMAT = "status#temperatureFormat";
// List of all module Settings Channel ids
public static final String CHANNEL_SETTINGS_MODE = "settings#mode";
public static final String CHANNEL_SETTINGS_TEMPERATURE = "settings#temperature";
public static final String CHANNEL_SETTINGS_PROGRAM = "settings#program";
public static final String CHANNEL_SETTINGS_BOOSTTIME = "settings#boostTime";
public static final String CHANNEL_SETTINGS_ENDDATE = "settings#endDate";
public static final String CHANNEL_SETTINGS_ENDHOUR = "settings#endHour";
public static final String CHANNEL_SETTINGS_ENDMINUTE = "settings#endMinute";
public static final String CHANNEL_SETTINGS_POWER = "settings#power";
// List of all module Config Channel ids
public static final String CHANNEL_CONFIG_FETCH_PROGRAMS = "config#fetchPrograms";

// List of all adressable things
public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections
.unmodifiableSet(Stream.of(THING_TYPE_BRIDGE, THING_TYPE_MODULE).collect(Collectors.toSet()));

}
Loading

0 comments on commit 55adbb0

Please sign in to comment.