added migrated 2.x add-ons
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This commit is contained in:
32
bundles/org.openhab.binding.onewiregpio/.classpath
Normal file
32
bundles/org.openhab.binding.onewiregpio/.classpath
Normal file
@@ -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-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="output" path="target/classes"/>
|
||||
</classpath>
|
||||
23
bundles/org.openhab.binding.onewiregpio/.project
Normal file
23
bundles/org.openhab.binding.onewiregpio/.project
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>org.openhab.binding.onewiregpio</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.onewiregpio/NOTICE
Normal file
13
bundles/org.openhab.binding.onewiregpio/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
|
||||
59
bundles/org.openhab.binding.onewiregpio/README.md
Normal file
59
bundles/org.openhab.binding.onewiregpio/README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# OneWire GPIO Binding
|
||||
|
||||
This binding reads temperature values from OneWire bus sensors connected to the GPIO bus on Raspberry Pi.
|
||||
|
||||
|
||||
## Supported Things
|
||||
|
||||
Temperature sensors.
|
||||
Tested successfully with DS18B20 sensor on Raspberry Pi 3.
|
||||
|
||||
|
||||
## Binding Configuration
|
||||
|
||||
The binding requires OneWire sensor to be properly connected to Raspberry Pi GPIO bus,
|
||||
"w1_gpio" and "wire" kernel modules should be loaded.
|
||||
Configuration is proper when /sys/bus/w1/devices folder is present, and contains sensor's data.
|
||||
|
||||
## Thing Configuration
|
||||
|
||||
The sensors are visible in the system as folders containing files with sensor data.
|
||||
By default all OneWire GPIO devices are stored in /sys/bus/w1/devices/DEVICE_ID_FOLDER,
|
||||
and the temperature value is available in the file "w1_slave". The Thing needs full path to the w1_slave file.
|
||||
Note the values in sysfs are in Celsius.
|
||||
|
||||
Optional parameter precision makes it easier to lower precision of the sensor value, i.e. precision 1 makes sensor value to show only one digit after the floating point, precision 2 - shows 2 digits. It makes precision reduction with round up, i.e. 20.534C with precision 1 will be 20.5C, 20.555 with same precision will be 20.6C. Allowed values are from 0 to 3. Default value of parameter is 3(max precision).
|
||||
|
||||
In the thing file, this looks e.g. like
|
||||
|
||||
```
|
||||
Thing onewiregpio:sensor:livingRoom "Living room" [gpio_bus_file="/sys/bus/w1/devices/28-0000061b587b/w1_slave",refresh_time=30,precision=1]
|
||||
```
|
||||
|
||||
## Channels
|
||||
|
||||
The devices supports currently one channel - "temperature" which allows to read temperature from OneWire temperature sensor.
|
||||
|
||||
|
||||
## Full Example
|
||||
|
||||
sample onewiregpio.things file content:
|
||||
|
||||
```
|
||||
Thing onewiregpio:sensor:livingroom "Living room" [gpio_bus_file="/sys/bus/w1/devices/28-0000061b587b/w1_slave",refresh_time=30]
|
||||
```
|
||||
|
||||
sample onewiregpio.items file content (implements QuantityType for unit conversion):
|
||||
|
||||
```
|
||||
Number:Temperature LivingRoomTemperature "Temperature: [%.2f %unit%]" <temperature> { channel="onewiregpio:sensor:livingroom:temperature" }
|
||||
```
|
||||
|
||||
sample demo.sitemap file content:
|
||||
|
||||
```
|
||||
sitemap demo label="Main Menu"
|
||||
{
|
||||
Text item=LivingRoomTemperature
|
||||
}
|
||||
```
|
||||
17
bundles/org.openhab.binding.onewiregpio/pom.xml
Normal file
17
bundles/org.openhab.binding.onewiregpio/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.onewiregpio</artifactId>
|
||||
|
||||
<name>openHAB Add-ons :: Bundles :: OneWireGPIO Binding</name>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<features name="org.openhab.binding.onewiregpio-${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-onewiregpio" description="OneWireGPIO Binding" version="${project.version}">
|
||||
<feature>openhab-runtime-base</feature>
|
||||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.onewiregpio/${project.version}</bundle>
|
||||
</feature>
|
||||
</features>
|
||||
@@ -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.onewiregpio.internal;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.ThingTypeUID;
|
||||
|
||||
/**
|
||||
* The {@link OneWireGPIOBindingConstants} class defines common constants, which are
|
||||
* used across the whole binding.
|
||||
*
|
||||
* @author Anatol Ogorek - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class OneWireGPIOBindingConstants {
|
||||
|
||||
public static final String BINDING_ID = "onewiregpio";
|
||||
|
||||
public static final ThingTypeUID THING_TYPE = new ThingTypeUID(BINDING_ID, "sensor");
|
||||
|
||||
public static final String TEMPERATURE = "temperature";
|
||||
|
||||
/**
|
||||
* The default auto refresh time in seconds.
|
||||
*/
|
||||
public static final Integer DEFAULT_REFRESH_TIME = Integer.valueOf(120);
|
||||
|
||||
public static final int MAX_PRECISION_VALUE = 3;
|
||||
|
||||
public static final String FILE_TEMP_MARKER = "t=";
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* 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.onewiregpio.internal;
|
||||
|
||||
import static org.openhab.binding.onewiregpio.internal.OneWireGPIOBindingConstants.THING_TYPE;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import org.openhab.binding.onewiregpio.internal.handler.OneWireGPIOHandler;
|
||||
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.Component;
|
||||
|
||||
/**
|
||||
* The {@link OneWireGPIOHandlerFactory} is responsible for creating things and thing
|
||||
* handlers.
|
||||
*
|
||||
* @author Anatol Ogorek - Initial contribution
|
||||
*/
|
||||
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.onewiregpio")
|
||||
public class OneWireGPIOHandlerFactory extends BaseThingHandlerFactory {
|
||||
|
||||
private static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Collections.singleton(THING_TYPE);
|
||||
|
||||
@Override
|
||||
public boolean supportsThingType(ThingTypeUID thingTypeUID) {
|
||||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ThingHandler createHandler(Thing thing) {
|
||||
ThingTypeUID thingTypeUID = thing.getThingTypeUID();
|
||||
|
||||
if (thingTypeUID.equals(THING_TYPE)) {
|
||||
return new OneWireGPIOHandler(thing);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* 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.onewiregpio.internal;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* The {@link OneWireGpioConfiguration} Configuration class for easier configuration read through the reflection method
|
||||
* in
|
||||
* the framework.
|
||||
*
|
||||
* @author Konstantin Polihronov - Initial contribution
|
||||
*/
|
||||
public class OneWireGpioConfiguration {
|
||||
public String gpio_bus_file;
|
||||
public Integer refresh_time;
|
||||
public BigDecimal precision;
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
* 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.onewiregpio.internal.handler;
|
||||
|
||||
import static org.openhab.binding.onewiregpio.internal.OneWireGPIOBindingConstants.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.openhab.binding.onewiregpio.internal.OneWireGPIOBindingConstants;
|
||||
import org.openhab.binding.onewiregpio.internal.OneWireGpioConfiguration;
|
||||
import org.openhab.core.library.types.QuantityType;
|
||||
import org.openhab.core.library.unit.SIUnits;
|
||||
import org.openhab.core.thing.Channel;
|
||||
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;
|
||||
|
||||
/**
|
||||
* The {@link OneWireGPIOHandler} is responsible for handling commands, which are
|
||||
* sent to one of the channels.
|
||||
*
|
||||
* @author Anatol Ogorek - Initial contribution
|
||||
* @author Konstantin Polihronov - Changed configuration handling and added new parameter - precision
|
||||
*/
|
||||
public class OneWireGPIOHandler extends BaseThingHandler {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(OneWireGPIOHandler.class);
|
||||
|
||||
private String gpioBusFile;
|
||||
private Integer refreshTime;
|
||||
private Integer precision;
|
||||
|
||||
private ScheduledFuture<?> sensorRefreshJob;
|
||||
|
||||
public OneWireGPIOHandler(Thing thing) {
|
||||
super(thing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
if (channelUID.getId().equals(TEMPERATURE)) {
|
||||
if (command instanceof RefreshType) {
|
||||
publishSensorValue(channelUID);
|
||||
} else {
|
||||
logger.debug("Command {} is not supported for channel: {}. Supported command: REFRESH", command,
|
||||
channelUID.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
OneWireGpioConfiguration configuration = getConfigAs(OneWireGpioConfiguration.class);
|
||||
gpioBusFile = configuration.gpio_bus_file;
|
||||
refreshTime = configuration.refresh_time;
|
||||
precision = configuration.precision.intValue();
|
||||
logger.debug("GPIO Busfile={}, RefreshTime={}, precision={}", gpioBusFile, refreshTime, precision);
|
||||
|
||||
if (checkConfiguration()) {
|
||||
startAutomaticRefresh();
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method checks if the provided configuration is valid.
|
||||
* When invalid parameter is found, default value is assigned.
|
||||
*/
|
||||
private boolean checkConfiguration() {
|
||||
if (StringUtils.isEmpty(gpioBusFile)) {
|
||||
logger.debug("GPIO_BUS_FILE not set. Please check configuration, and set proper path to w1_slave file.");
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
|
||||
"The path to the w1_slave sensor data file is missing.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (refreshTime <= 0) {
|
||||
logger.debug("Refresh time [{}] is not valid. Falling back to default value: {}.", refreshTime,
|
||||
DEFAULT_REFRESH_TIME);
|
||||
refreshTime = DEFAULT_REFRESH_TIME;
|
||||
}
|
||||
|
||||
if (precision < 0 || precision > MAX_PRECISION_VALUE) {
|
||||
logger.debug(
|
||||
"Precision value {} is outside allowed values [0 - {}]. Falling back to maximum precision value.",
|
||||
precision, MAX_PRECISION_VALUE);
|
||||
precision = MAX_PRECISION_VALUE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void startAutomaticRefresh() {
|
||||
Runnable refresher = () -> {
|
||||
List<Channel> channels = getThing().getChannels();
|
||||
for (Channel channel : channels) {
|
||||
if (isLinked(channel.getUID().getId())) {
|
||||
publishSensorValue(channel.getUID());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
sensorRefreshJob = scheduler.scheduleWithFixedDelay(refresher, 0, refreshTime.intValue(), TimeUnit.SECONDS);
|
||||
logger.debug("Start automatic refresh every {} seconds", refreshTime.intValue());
|
||||
}
|
||||
|
||||
private void publishSensorValue(ChannelUID channelUID) {
|
||||
String channelID = channelUID.getId();
|
||||
switch (channelID) {
|
||||
case TEMPERATURE:
|
||||
publishTemperatureSensorState(channelUID);
|
||||
break;
|
||||
default:
|
||||
logger.debug("Can not update channel with ID : {} - channel name might be wrong!", channelID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void publishTemperatureSensorState(ChannelUID channelUID) {
|
||||
BigDecimal temp = readSensorTemperature(gpioBusFile);
|
||||
if (temp != null) {
|
||||
updateState(channelUID, new QuantityType<>(temp, SIUnits.CELSIUS));
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal readSensorTemperature(String gpioFile) {
|
||||
try (Stream<String> stream = Files.lines(Paths.get(gpioFile))) {
|
||||
Optional<String> temperatureLine = stream
|
||||
.filter(s -> s.contains(OneWireGPIOBindingConstants.FILE_TEMP_MARKER)).findFirst();
|
||||
if (temperatureLine.isPresent()) {
|
||||
String line = temperatureLine.get();
|
||||
String tempString = line.substring(line.indexOf(OneWireGPIOBindingConstants.FILE_TEMP_MARKER)
|
||||
+ OneWireGPIOBindingConstants.FILE_TEMP_MARKER.length());
|
||||
Integer intTemp = Integer.parseInt(tempString);
|
||||
if (getThing().getStatus() != ThingStatus.ONLINE) {
|
||||
updateStatus(ThingStatus.ONLINE);
|
||||
}
|
||||
return calculateValue(intTemp);
|
||||
} else {
|
||||
logger.debug(
|
||||
"GPIO file didn't contain line with 't=' where temperature value should be available. Check if configuration points to the proper file");
|
||||
return null;
|
||||
}
|
||||
} catch (IOException | InvalidPathException e) {
|
||||
logger.debug("error reading GPIO bus file. File path is: {}. Check if path is proper.", gpioFile, e);
|
||||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "Error reading GPIO bus file.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private BigDecimal calculateValue(Integer intTemp) {
|
||||
BigDecimal result = BigDecimal.valueOf(intTemp).movePointLeft(3);
|
||||
if (precision != MAX_PRECISION_VALUE) {
|
||||
result = result.setScale(precision, RoundingMode.HALF_UP);
|
||||
}
|
||||
logger.debug("Thing = {}, temperature value = {}.", getThing().getUID(), result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (sensorRefreshJob != null) {
|
||||
sensorRefreshJob.cancel(true);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<binding:binding id="onewiregpio" 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>OneWireGPIO Binding</name>
|
||||
<description>Use GPIO in various devices like RaspberryPi to communicate the OneWire protocol</description>
|
||||
<author>Anatol Ogorek</author>
|
||||
</binding:binding>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<thing:thing-descriptions bindingId="onewiregpio"
|
||||
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="sensor">
|
||||
<label>Temperature Sensor</label>
|
||||
<description>OneWire GPIO Temperature sensor</description>
|
||||
|
||||
<channels>
|
||||
<channel id="temperature" typeId="temperature"/>
|
||||
</channels>
|
||||
<config-description>
|
||||
<parameter name="gpio_bus_file" type="text" required="true">
|
||||
<label>Device Path</label>
|
||||
<description>device id in format: /sys/bus/w1/devices/DEVICE_ID_TO_SET/w1_slave</description>
|
||||
</parameter>
|
||||
|
||||
<parameter name="refresh_time" type="integer">
|
||||
<label>Refresh Time Interval</label>
|
||||
<description>Refresh time interval in seconds.</description>
|
||||
<default>600</default>
|
||||
</parameter>
|
||||
|
||||
<parameter name="precision" type="integer" min="0" max="3">
|
||||
<label>Sensor Precision</label>
|
||||
<description>Sensor precision after floating point.</description>
|
||||
<required>false</required>
|
||||
<default>3</default>
|
||||
</parameter>
|
||||
|
||||
</config-description>
|
||||
</thing-type>
|
||||
|
||||
<channel-type id="temperature">
|
||||
<item-type>Number:Temperature</item-type>
|
||||
<label>Temperature</label>
|
||||
<description>Indicates the temperature read from one wire gpio sensor</description>
|
||||
<state readOnly="true" pattern="%.3f %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
</thing:thing-descriptions>
|
||||
Reference in New Issue
Block a user