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.
[verisure] Verisure Binding initial contribution (openhab#4789)
Also-by: Jarle Hjortland <[email protected]> (github: jarlebh) Signed-off-by: Jan Gustafsson <[email protected]> (github: jannegpriv)
- Loading branch information
1 parent
66c3980
commit 4904738
Showing
44 changed files
with
8,506 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,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="test" value="true"/> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" 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> |
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,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.verisure</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> |
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,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 | ||
|
||
jsoup | ||
* License: MIT License | ||
* Project: https://jsoup.org/ | ||
* Source: https://github.com/jhy/jsoup |
Large diffs are not rendered by default.
Oops, something went wrong.
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,26 @@ | ||
<?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.7-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.verisure</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: Verisure Binding</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.jsoup</groupId> | ||
<artifactId>jsoup</artifactId> | ||
<version>1.8.3</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
10 changes: 10 additions & 0 deletions
10
bundles/org.openhab.binding.verisure/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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.verisure-${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-verisure" description="Verisure Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<feature>openhab-transport-serial</feature> | ||
<bundle dependency="true">mvn:org.jsoup/jsoup/1.8.3</bundle> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.verisure/${project.version}</bundle> | ||
</feature> | ||
</features> |
41 changes: 41 additions & 0 deletions
41
...ng.verisure/src/main/java/org/openhab/binding/verisure/internal/DeviceStatusListener.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,41 @@ | ||
/** | ||
* 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.verisure.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.binding.verisure.internal.dto.VerisureThingDTO; | ||
|
||
/** | ||
* The {@link DeviceStatusListener} is notified when a device status has changed | ||
* or a device has been removed or added. | ||
* | ||
* @author Jarle Hjortland - Initial contribution | ||
* @author Jan Gustafsson - Updated after code review comments | ||
* | ||
*/ | ||
@NonNullByDefault | ||
public interface DeviceStatusListener<T extends VerisureThingDTO> { | ||
|
||
/** | ||
* This method is called whenever the state of the given device has changed. | ||
* | ||
* @param thing | ||
* The thing that was changed. | ||
*/ | ||
void onDeviceStateChanged(T thing); | ||
|
||
/** | ||
* This method returns the thing's class | ||
*/ | ||
public Class<T> getVerisureThingClass(); | ||
} |
165 changes: 165 additions & 0 deletions
165
...erisure/src/main/java/org/openhab/binding/verisure/internal/VerisureBindingConstants.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,165 @@ | ||
/** | ||
* 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.verisure.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.smarthome.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link VerisureBinding} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author l3rum - Initial contribution | ||
* @author Jan Gustafsson - Furher development | ||
*/ | ||
@NonNullByDefault | ||
public class VerisureBindingConstants { | ||
|
||
public static final String BINDING_ID = "verisure"; | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_BRIDGE = new ThingTypeUID(BINDING_ID, "bridge"); | ||
public static final ThingTypeUID THING_TYPE_ALARM = new ThingTypeUID(BINDING_ID, "alarm"); | ||
public static final ThingTypeUID THING_TYPE_SMARTPLUG = new ThingTypeUID(BINDING_ID, "smartPlug"); | ||
public static final ThingTypeUID THING_TYPE_SMOKEDETECTOR = new ThingTypeUID(BINDING_ID, "smokeDetector"); | ||
public static final ThingTypeUID THING_TYPE_WATERDETECTOR = new ThingTypeUID(BINDING_ID, "waterDetector"); | ||
public static final ThingTypeUID THING_TYPE_SIREN = new ThingTypeUID(BINDING_ID, "siren"); | ||
public static final ThingTypeUID THING_TYPE_DOORWINDOW = new ThingTypeUID(BINDING_ID, "doorWindowSensor"); | ||
public static final ThingTypeUID THING_TYPE_USERPRESENCE = new ThingTypeUID(BINDING_ID, "userPresence"); | ||
public static final ThingTypeUID THING_TYPE_SMARTLOCK = new ThingTypeUID(BINDING_ID, "smartLock"); | ||
public static final ThingTypeUID THING_TYPE_BROADBAND_CONNECTION = new ThingTypeUID(BINDING_ID, | ||
"broadbandConnection"); | ||
public static final ThingTypeUID THING_TYPE_NIGHT_CONTROL = new ThingTypeUID(BINDING_ID, "nightControl"); | ||
public static final ThingTypeUID THING_TYPE_MICE_DETECTION = new ThingTypeUID(BINDING_ID, "miceDetection"); | ||
public static final ThingTypeUID THING_TYPE_EVENT_LOG = new ThingTypeUID(BINDING_ID, "eventLog"); | ||
public static final ThingTypeUID THING_TYPE_GATEWAY = new ThingTypeUID(BINDING_ID, "gateway"); | ||
|
||
// List of all Channel ids | ||
public static final String CHANNEL_NUMERIC_STATUS = "numericStatus"; | ||
public static final String CHANNEL_TEMPERATURE = "temperature"; | ||
public static final String CHANNEL_HUMIDITY = "humidity"; | ||
public static final String CHANNEL_HUMIDITY_ENABLED = "humidityEnabled"; | ||
public static final String CHANNEL_LOCATION = "location"; | ||
public static final String CHANNEL_STATUS = "status"; | ||
public static final String CHANNEL_CONNECTED = "connected"; | ||
public static final String CHANNEL_STATE = "state"; | ||
public static final String CHANNEL_LABEL = "label"; | ||
public static final String CHANNEL_USER_NAME = "userName"; | ||
public static final String CHANNEL_WEBACCOUNT = "webAccount"; | ||
public static final String CHANNEL_USER_LOCATION_STATUS = "userLocationStatus"; | ||
public static final String CHANNEL_USER_DEVICE_NAME = "userDeviceName"; | ||
public static final String CHANNEL_SMARTLOCK_VOLUME = "smartLockVolume"; | ||
public static final String CHANNEL_SMARTLOCK_VOICE_LEVEL = "smartLockVoiceLevel"; | ||
public static final String CHANNEL_SMARTLOCK_TRIGGER_CHANNEL = "smartLockTriggerChannel"; | ||
public static final String CHANNEL_AUTO_RELOCK = "autoRelock"; | ||
public static final String CHANNEL_SMARTPLUG_STATUS = "smartPlugStatus"; | ||
public static final String CHANNEL_SMARTPLUG_TRIGGER_CHANNEL = "smartPlugTriggerChannel"; | ||
public static final String CHANNEL_ALARM_STATUS = "alarmStatus"; | ||
public static final String CHANNEL_ALARM_TRIGGER_CHANNEL = "alarmTriggerChannel"; | ||
public static final String CHANNEL_SMARTLOCK_STATUS = "smartLockStatus"; | ||
public static final String CHANNEL_CHANGED_BY_USER = "changedByUser"; | ||
public static final String CHANNEL_CHANGED_VIA = "changedVia"; | ||
public static final String CHANNEL_TIMESTAMP = "timestamp"; | ||
public static final String CHANNEL_TEMPERATURE_TIMESTAMP = "temperatureTimestamp"; | ||
public static final String CHANNEL_HAZARDOUS = "hazardous"; | ||
public static final String CHANNEL_MOTOR_JAM = "motorJam"; | ||
public static final String CHANNEL_INSTALLATION_NAME = "installationName"; | ||
public static final String CHANNEL_INSTALLATION_ID = "installationId"; | ||
public static final String CHANNEL_COUNT_LATEST_DETECTION = "countLatestDetection"; | ||
public static final String CHANNEL_COUNT_LAST_24_HOURS = "countLast24Hours"; | ||
public static final String CHANNEL_DURATION_LATEST_DETECTION = "durationLatestDetection"; | ||
public static final String CHANNEL_DURATION_LAST_24_HOURS = "durationLast24Hours"; | ||
public static final String CHANNEL_LAST_EVENT_LOCATION = "lastEventLocation"; | ||
public static final String CHANNEL_LAST_EVENT_ID = "lastEventId"; | ||
public static final String CHANNEL_LAST_EVENT_DEVICE_ID = "lastEventDeviceId"; | ||
public static final String CHANNEL_LAST_EVENT_DEVICE_TYPE = "lastEventDeviceType"; | ||
public static final String CHANNEL_LAST_EVENT_TYPE = "lastEventType"; | ||
public static final String CHANNEL_LAST_EVENT_CATEGORY = "lastEventCategory"; | ||
public static final String CHANNEL_LAST_EVENT_TIME = "lastEventTime"; | ||
public static final String CHANNEL_LAST_EVENT_USER_NAME = "lastEventUserName"; | ||
public static final String CHANNEL_EVENT_LOG = "eventLog"; | ||
public static final String CHANNEL_STATUS_GSM_OVER_UDP = "statusGSMOverUDP"; | ||
public static final String CHANNEL_STATUS_GSM_OVER_SMS = "statusGSMOverSMS"; | ||
public static final String CHANNEL_STATUS_GPRS_OVER_UDP = "statusGPRSOverUDP"; | ||
public static final String CHANNEL_STATUS_ETH_OVER_UDP = "statusETHOverUDP"; | ||
public static final String CHANNEL_TEST_TIME_GSM_OVER_UDP = "testTimeGSMOverUDP"; | ||
public static final String CHANNEL_TEST_TIME_GSM_OVER_SMS = "testTimeGSMOverSMS"; | ||
public static final String CHANNEL_TEST_TIME_GPRS_OVER_UDP = "testTimeGPRSOverUDP"; | ||
public static final String CHANNEL_TEST_TIME_ETH_OVER_UDP = "testTimeETHOverUDP"; | ||
public static final String CHANNEL_GATEWAY_MODEL = "model"; | ||
public static final String CHANNEL_SMOKE_DETECTION_TRIGGER_CHANNEL = "smokeDetectionTriggerChannel"; | ||
public static final String CHANNEL_MICE_DETECTION_TRIGGER_CHANNEL = "miceDetectionTriggerChannel"; | ||
public static final String CHANNEL_WATER_DETECTION_TRIGGER_CHANNEL = "waterDetectionTriggerChannel"; | ||
public static final String CHANNEL_SIREN_TRIGGER_CHANNEL = "sirenTriggerChannel"; | ||
public static final String CHANNEL_NIGHT_CONTROL_TRIGGER_CHANNEL = "nightControlTriggerChannel"; | ||
public static final String CHANNEL_DOOR_WINDOW_TRIGGER_CHANNEL = "doorWindowTriggerChannel"; | ||
public static final String CHANNEL_GATEWAY_TRIGGER_CHANNEL = "gatewayTriggerChannel"; | ||
|
||
// Trigger channel events | ||
public static final String TRIGGER_EVENT_LOCK = "LOCK"; | ||
public static final String TRIGGER_EVENT_UNLOCK = "UNLOCK"; | ||
public static final String TRIGGER_EVENT_LOCK_FAILURE = "LOCK_FAILURE"; | ||
public static final String TRIGGER_EVENT_ARM = "ARM"; | ||
public static final String TRIGGER_EVENT_DISARM = "DISARM"; | ||
public static final String TRIGGER_EVENT_FIRE = "FIRE"; | ||
public static final String TRIGGER_EVENT_INSTRUSION = "INTRUSION"; | ||
public static final String TRIGGER_EVENT_WATER = "WATER"; | ||
public static final String TRIGGER_EVENT_MICE = "MICE"; | ||
public static final String TRIGGER_EVENT_BATTERY_LOW = "BATTERY_LOW"; | ||
public static final String TRIGGER_EVENT_BATTERY_RESTORED = "BATTERY_RESTORED"; | ||
public static final String TRIGGER_EVENT_COM_FAILURE = "COM_FAILURE"; | ||
public static final String TRIGGER_EVENT_COM_RESTORED = "COM_RESTORED"; | ||
public static final String TRIGGER_EVENT_COM_TEST = "COM_TEST"; | ||
public static final String TRIGGER_EVENT_SABOTAGE_ALARM = "SABOTAGE_ALARM"; | ||
public static final String TRIGGER_EVENT_SABOTAGE_RESTORED = "SABOTAGE_RESTORED"; | ||
public static final String TRIGGER_EVENT_DOORWINDOW_OPENED = "DOORWINDOW_OPENED"; | ||
public static final String TRIGGER_EVENT_DOORWINDOW_CLOSED = "DOORWINDOW_CLOSED"; | ||
public static final String TRIGGER_EVENT_LOCATION_HOME = "LOCATION_HOME"; | ||
public static final String TRIGGER_EVENT_LOCATION_AWAY = "LOCATION_AWAY"; | ||
|
||
// REST URI constants | ||
public static final String USERNAME = "username"; | ||
public static final String PASSWORD = "password"; | ||
public static final String BASEURL = "https://mypages.verisure.com"; | ||
public static final String LOGON_SUF = BASEURL + "/j_spring_security_check?locale=en_GB"; | ||
public static final String ALARM_COMMAND = BASEURL + "/remotecontrol/armstatechange.cmd"; | ||
public static final String SMARTLOCK_LOCK_COMMAND = BASEURL + "/remotecontrol/lockunlock.cmd"; | ||
public static final String SMARTLOCK_SET_COMMAND = BASEURL + "/overview/setdoorlock.cmd"; | ||
public static final String SMARTLOCK_AUTORELOCK_COMMAND = BASEURL + "/settings/setautorelock.cmd"; | ||
public static final String SMARTLOCK_VOLUME_COMMAND = BASEURL + "/settings/setvolume.cmd"; | ||
|
||
public static final String SMARTPLUG_COMMAND = BASEURL + "/settings/smartplug/onoffplug.cmd"; | ||
public static final String START_REDIRECT = "/uk/start.html"; | ||
public static final String START_SUF = BASEURL + START_REDIRECT; | ||
|
||
// GraphQL constants | ||
public static final String STATUS = BASEURL + "/uk/status"; | ||
public static final String SETTINGS = BASEURL + "/uk/settings.html?giid="; | ||
public static final String SET_INSTALLATION = BASEURL + "/setinstallation?giid="; | ||
public static final String BASEURL_API = "https://m-api02.verisure.com"; | ||
public static final String START_GRAPHQL = "/graphql"; | ||
public static final String AUTH_TOKEN = "/auth/token"; | ||
public static final String AUTH_LOGIN = "/auth/login"; | ||
|
||
public static final String ALARMSTATUS_PATH = "/remotecontrol"; | ||
public static final String SMARTLOCK_PATH = "/overview/doorlock/"; | ||
public static final String DOORWINDOW_PATH = "/settings/doorwindow"; | ||
public static final String USERTRACKING_PATH = "/overview/usertrackingcontacts"; | ||
public static final String CLIMATEDEVICE_PATH = "/overview/climatedevice"; | ||
public static final String SMARTPLUG_PATH = "/settings/smartplug"; | ||
public static final String ETHERNETSTATUS_PATH = "/overview/ethernetstatus"; | ||
public static final String VACATIONMODE_PATH = "/overview/vacationmode"; | ||
public static final String TEMPERATURE_CONTROL_PATH = "/overview/temperaturecontrol"; | ||
public static final String MOUSEDETECTION_PATH = "/overview/mousedetection"; | ||
public static final String CAMERA_PATH = "/overview/camera"; | ||
} |
30 changes: 30 additions & 0 deletions
30
...sure/src/main/java/org/openhab/binding/verisure/internal/VerisureBridgeConfiguration.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,30 @@ | ||
/** | ||
* 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.verisure.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* Configuration class for VerisureBridgeHandler bridge used to connect to the | ||
* Verisure MyPage. | ||
* | ||
* @author Jarle Hjortland - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class VerisureBridgeConfiguration { | ||
public @Nullable String username; | ||
public @Nullable String password; | ||
public int refresh; | ||
public @Nullable String pin; | ||
} |
Oops, something went wrong.