added migrated 2.x add-ons
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
49
bundles/org.openhab.binding.mystrom/.classpath
Normal file
49
bundles/org.openhab.binding.mystrom/.classpath
Normal file
@@ -0,0 +1,49 @@
|
||||
<?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-11">
|
||||
<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"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" 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="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
23
bundles/org.openhab.binding.mystrom/.project
Normal file
23
bundles/org.openhab.binding.mystrom/.project
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.openhab.binding.mystrom</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>
|
||||
13
bundles/org.openhab.binding.mystrom/NOTICE
Normal file
13
bundles/org.openhab.binding.mystrom/NOTICE
Normal file
@@ -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
|
||||
60
bundles/org.openhab.binding.mystrom/README.md
Normal file
60
bundles/org.openhab.binding.mystrom/README.md
Normal file
@@ -0,0 +1,60 @@
|
||||
# myStrom Binding
|
||||
|
||||
This extension adds support for the myStrom devices. Currently only the smart plug is implemented.
|
||||
|
||||
## Supported Things
|
||||
|
||||
This bundle adds the following thing types:
|
||||
|
||||
| Thing | ThingTypeID | Description |
|
||||
| ------------------ | ----------- | -------------------------------------------------- |
|
||||
| myStrom Smart Plug | mystromplug | A myStrom smart plug |
|
||||
|
||||
## Discovery
|
||||
|
||||
This extension does not support autodiscovery. The things need to be added manually.
|
||||
|
||||
|
||||
## Thing Configuration
|
||||
|
||||
The following parameters are valid for all thing types:
|
||||
|
||||
| Parameter | Type | Required | Default if omitted | Description |
|
||||
| --------- | ------- | -------- | ------------------ | -------------------------------------------------------------------------- |
|
||||
| hostname | string | yes | localhost | The IP address or hostname of the myStrom smart plug |
|
||||
| refresh | integer | no | 10 | Poll interval in seconds. Increase this if you encounter connection errors |
|
||||
|
||||
## Channels
|
||||
|
||||
| Channel ID | Item Type | Read only | Description |
|
||||
| ---------------- | -------------------- | --------- | ------------------------------------------------------------- |
|
||||
| switch | Switch | false | Turn the smart plug on or off |
|
||||
| power | Number:Power | true | The currently delivered power |
|
||||
| temperature | Number:Temperature | true | The temperature at the plug |
|
||||
|
||||
## Full Example
|
||||
|
||||
### Thing Configuration
|
||||
|
||||
```
|
||||
Thing mystrom:mystromplug:d6217a31 "Plug" [hostname="hostname|ip"]
|
||||
```
|
||||
|
||||
### Item Configuration
|
||||
|
||||
```
|
||||
Switch PlugSwitch "Plug" {channel="mystrom:mystromplug:d6217a31:switch"}
|
||||
Number:Temperature PlugTemperature "Temperature: [%.1f °C]" {channel="mystrom:mystromplug:d6217a31:temperature"}
|
||||
Number:Power PlugPower "Power: [%.1f W]" {channel="mystrom:mystromplug:d6217a31:power"}
|
||||
|
||||
```
|
||||
|
||||
### Sitemap Configuration
|
||||
|
||||
```
|
||||
Frame label="myStrom Plug" {
|
||||
Switch item=PlugSwitch
|
||||
Text item=PlugTemperature
|
||||
Text item=PlugPower
|
||||
}
|
||||
```
|
||||
17
bundles/org.openhab.binding.mystrom/pom.xml
Normal file
17
bundles/org.openhab.binding.mystrom/pom.xml
Normal file
@@ -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>3.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>org.openhab.binding.mystrom</artifactId>
|
||||
|
||||
<name>openHAB Add-ons :: Bundles :: mystrom Binding</name>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<features name="org.openhab.binding.mystrom-${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-mystrom" description="mystrom Binding" version="${project.version}">
|
||||
<feature>openhab-runtime-base</feature>
|
||||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.mystrom/${project.version}</bundle>
|
||||
</feature>
|
||||
</features>
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* 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.mystrom.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
|
||||
/**
|
||||
* The {@link MyStromBindingConstants} class defines common constants, which are
|
||||
* used across the whole binding.
|
||||
*
|
||||
* @author Paul Frank - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MyStromBindingConstants {
|
||||
|
||||
public static final int DEFAULT_REFRESH_RATE_SECONDS = 10;
|
||||
|
||||
private static final String BINDING_ID = "mystrom";
|
||||
|
||||
// List of all Thing Type UIDs
|
||||
public static final ThingTypeUID THING_TYPE_PLUG = new ThingTypeUID(BINDING_ID, "mystromplug");
|
||||
|
||||
// List of all Channel ids
|
||||
public static final String CHANNEL_SWITCH = "switch";
|
||||
public static final String CHANNEL_POWER = "power";
|
||||
public static final String CHANNEL_TEMPERATURE = "temperature";
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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.mystrom.internal;
|
||||
|
||||
import static org.openhab.binding.mystrom.internal.MyStromBindingConstants.DEFAULT_REFRESH_RATE_SECONDS;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link MyStromConfiguration} class contains fields mapping thing configuration parameters.
|
||||
*
|
||||
* @author Paul Frank - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MyStromConfiguration {
|
||||
|
||||
/**
|
||||
* Hostname of the myStrom device.
|
||||
*/
|
||||
public String hostname = "localhost";
|
||||
/**
|
||||
* Number of seconds in between refreshes from the myStrom device.
|
||||
*/
|
||||
public int refresh = DEFAULT_REFRESH_RATE_SECONDS;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* 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.mystrom.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* Thrown when the stiebel eltron handler sees an error.
|
||||
*
|
||||
* @author Paul Frank - Initial contribution
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@NonNullByDefault
|
||||
public class MyStromException extends Exception {
|
||||
|
||||
public MyStromException() {
|
||||
}
|
||||
|
||||
public MyStromException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* 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.mystrom.internal;
|
||||
|
||||
import static org.openhab.binding.mystrom.internal.MyStromBindingConstants.CHANNEL_POWER;
|
||||
import static org.openhab.binding.mystrom.internal.MyStromBindingConstants.CHANNEL_SWITCH;
|
||||
import static org.openhab.binding.mystrom.internal.MyStromBindingConstants.CHANNEL_TEMPERATURE;
|
||||
import static org.openhab.core.library.unit.SIUnits.CELSIUS;
|
||||
import static org.openhab.core.library.unit.SmartHomeUnits.WATT;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.client.api.ContentResponse;
|
||||
import org.eclipse.jetty.http.HttpMethod;
|
||||
import org.openhab.core.cache.ExpiringCache;
|
||||
import org.openhab.core.library.types.OnOffType;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.thing.ChannelUID;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingStatus;
|
||||
import org.openhab.core.thing.ThingStatusDetail;
|
||||
import org.openhab.core.thing.binding.BaseThingHandler;
|
||||
import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
/**
|
||||
* The {@link MyStromHandler} is responsible for handling commands, which are
|
||||
* sent to one of the channels.
|
||||
*
|
||||
* @author Paul Frank - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class MyStromHandler extends BaseThingHandler {
|
||||
|
||||
private static class MyStromReport {
|
||||
|
||||
public float power;
|
||||
public boolean relay;
|
||||
public float temperature;
|
||||
}
|
||||
|
||||
private static final int HTTP_OK_CODE = 200;
|
||||
private static final String COMMUNICATION_ERROR = "Error while communicating to the myStrom plug: ";
|
||||
private static final String HTTP_REQUEST_URL_PREFIX = "http://";
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(MyStromHandler.class);
|
||||
|
||||
private HttpClient httpClient;
|
||||
private String hostname = "";
|
||||
|
||||
private @Nullable ScheduledFuture<?> pollingJob;
|
||||
private ExpiringCache<MyStromReport> cache = new ExpiringCache<>(Duration.ofSeconds(3), this::getReport);
|
||||
private final Gson gson = new Gson();
|
||||
|
||||
public MyStromHandler(Thing thing, HttpClient httpClient) {
|
||||
super(thing);
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
try {
|
||||
if (command instanceof RefreshType) {
|
||||
pollDevice();
|
||||
} else {
|
||||
if (command instanceof OnOffType && CHANNEL_SWITCH.equals(channelUID.getId())) {
|
||||
sendHttpGet("relay?state=" + (command == OnOffType.ON ? "1" : "0"));
|
||||
scheduler.schedule(this::pollDevice, 500, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
} catch (MyStromException e) {
|
||||
logger.warn("Error while handling command {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private @Nullable MyStromReport getReport() {
|
||||
try {
|
||||
String returnContent = sendHttpGet("report");
|
||||
MyStromReport report = gson.fromJson(returnContent, MyStromReport.class);
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
return report;
|
||||
} catch (MyStromException e) {
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void pollDevice() {
|
||||
MyStromReport report = cache.getValue();
|
||||
if (report != null) {
|
||||
updateState(CHANNEL_SWITCH, report.relay ? OnOffType.ON : OnOffType.OFF);
|
||||
updateState(CHANNEL_POWER, QuantityType.valueOf(report.power, WATT));
|
||||
updateState(CHANNEL_TEMPERATURE, QuantityType.valueOf(report.temperature, CELSIUS));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
MyStromConfiguration config = getConfigAs(MyStromConfiguration.class);
|
||||
this.hostname = HTTP_REQUEST_URL_PREFIX + config.hostname;
|
||||
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
pollingJob = scheduler.scheduleWithFixedDelay(this::pollDevice, 0, config.refresh, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (pollingJob != null) {
|
||||
pollingJob.cancel(true);
|
||||
pollingJob = null;
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a URL and a set parameters, send a HTTP GET request to the URL location
|
||||
* created by the URL and parameters.
|
||||
*
|
||||
* @param url The URL to send a GET request to.
|
||||
* @return String contents of the response for the GET request.
|
||||
* @throws Exception
|
||||
*/
|
||||
public String sendHttpGet(String action) throws MyStromException {
|
||||
String url = hostname + "/" + action;
|
||||
ContentResponse response = null;
|
||||
try {
|
||||
response = httpClient.newRequest(url).timeout(10, TimeUnit.SECONDS).method(HttpMethod.GET).send();
|
||||
} catch (InterruptedException | TimeoutException | ExecutionException e) {
|
||||
throw new MyStromException(COMMUNICATION_ERROR + e.getMessage());
|
||||
}
|
||||
|
||||
if (response.getStatus() != HTTP_OK_CODE) {
|
||||
throw new MyStromException(
|
||||
"Error sending HTTP GET request to " + url + ". Got response code: " + response.getStatus());
|
||||
}
|
||||
return response.getContentAsString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* 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.mystrom.internal;
|
||||
|
||||
import static org.openhab.binding.mystrom.internal.MyStromBindingConstants.THING_TYPE_PLUG;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.eclipse.jdt.annotation.Nullable;
|
||||
import org.openhab.core.io.net.http.HttpClientFactory;
|
||||
import org.openhab.core.thing.Thing;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
import org.openhab.core.thing.binding.BaseThingHandlerFactory;
|
||||
import org.openhab.core.thing.binding.ThingHandler;
|
||||
import org.openhab.core.thing.binding.ThingHandlerFactory;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
|
||||
/**
|
||||
* The {@link MyStromHandlerFactory} is responsible for creating things and thing
|
||||
* handlers.
|
||||
*
|
||||
* @author Paul Frank - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(configurationPid = "binding.mystrom", service = ThingHandlerFactory.class)
|
||||
public class MyStromHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE_PLUG);
|
||||
|
||||
private HttpClientFactory httpClientFactory;
|
||||
|
||||
@Activate
|
||||
public MyStromHandlerFactory(@Reference HttpClientFactory httpClientFactory) {
|
||||
this.httpClientFactory = httpClientFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ThingHandler createHandler(Thing thing) {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
if (THING_TYPE_PLUG.equals(thingTypeUID)) {
|
||||
return new MyStromHandler(thing, httpClientFactory.getCommonHttpClient());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<binding:binding id="mystrom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:binding="https://openhab.org/schemas/binding/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd">
|
||||
|
||||
<name>myStrom Binding</name>
|
||||
<description>This is the binding for myStrom devices.</description>
|
||||
<author>Paul Frank</author>
|
||||
|
||||
</binding:binding>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="mystrom"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
|
||||
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
|
||||
|
||||
<thing-type id="mystromplug">
|
||||
<label>myStrom Smart Plug</label>
|
||||
<description>Controls the myStrom smart plug</description>
|
||||
|
||||
<channels>
|
||||
<channel id="switch" typeId="system.power"/>
|
||||
<channel id="power" typeId="power-channel"/>
|
||||
<channel id="temperature" typeId="temperature-channel"/>
|
||||
</channels>
|
||||
|
||||
<config-description>
|
||||
<parameter name="hostname" type="text">
|
||||
<label>Hostname</label>
|
||||
<description>The host name or IP address of the myStrom plug.</description>
|
||||
<context>network-address</context>
|
||||
<default>localhost</default>
|
||||
</parameter>
|
||||
<parameter name="refresh" type="integer" unit="s" min="1">
|
||||
<label>Refresh Interval</label>
|
||||
<description>Specifies the refresh interval in seconds.</description>
|
||||
<default>10</default>
|
||||
</parameter>
|
||||
</config-description>
|
||||
|
||||
</thing-type>
|
||||
|
||||
<channel-type id="power-channel">
|
||||
<item-type>Number:Power</item-type>
|
||||
<label>Power Consumption</label>
|
||||
<description>The current power delivered by the plug</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="temperature-channel">
|
||||
<item-type>Number:Temperature</item-type>
|
||||
<label>Temperature</label>
|
||||
<description>The current temperature at the plug</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
Reference in New Issue
Block a user