Skip to content

Commit

Permalink
[rollershutterposition] Initial contribution (openhab#13259)
Browse files Browse the repository at this point in the history
* Initial contribution

Signed-off-by: Jeff James <[email protected]>
Signed-off-by: miloit <[email protected]>
  • Loading branch information
jsjames authored and miloit committed Mar 10, 2023
1 parent 7660db0 commit 5f9b86c
Show file tree
Hide file tree
Showing 13 changed files with 507 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@
/bundles/org.openhab.transform.jsonpath/ @clinique
/bundles/org.openhab.transform.map/ @openhab/add-ons-maintainers
/bundles/org.openhab.transform.regex/ @openhab/add-ons-maintainers
/bundles/org.openhab.transform.rollershutterposition/ @jsjames
/bundles/org.openhab.transform.scale/ @clinique
/bundles/org.openhab.transform.xpath/ @openhab/add-ons-maintainers
/bundles/org.openhab.transform.xslt/ @openhab/add-ons-maintainers
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 @@ -1986,6 +1986,11 @@
<artifactId>org.openhab.transform.regex</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.transform.rollershutterposition</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.transform.scale</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.transform.rollershutterposition/NOTICE
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions bundles/org.openhab.transform.rollershutterposition/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Rollershutter Position Emulation Profile Service

The Rollershutter Position emulates absolute position setting for Rollershutter devices which only support basic UP/DOWN/STOP commands.
This allows a Rollershutter to be set to an absolution position from 0..100 even if the controller does not support this feature (i.e. Somfy controllers).

The logic code used for this profile service was adapted from Tarag Gautier's JavaScript implementation VASRollershutter.js.
By implementing as a profile, it eliminates the need for setting up a jsr233 js environment and simplifies the configuration.

## Configuration

To use this profile, simply include the profile on the Rollershutter item which is assigned to the Rollershutter channel.
The parameters <uptime> and <downtime> are the time it takes for the Rollershutter to fully extend or close in seconds.
The precision parameter can be used to specify the minimum movement that can be made.
This is useful when latencies in the system limit prevent very small movements and will reduce the accuracy of the position estimation.

```java
Rollershutter <itemName> { channel="<channelUID>"[profile="rollershutter:position", uptime=<uptime>, downtime=<downtime>, precision=<minimun percent movement>]]}
```

17 changes: 17 additions & 0 deletions bundles/org.openhab.transform.rollershutterposition/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 https://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>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.transform.rollershutterposition</artifactId>

<name>openHAB Add-ons :: Bundles :: Transformation Service :: Roller Shutter Position</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.transform.rollershutterposition-${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-transformation-rollershutterposition" description="Roller Shutter Position Emulation" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="75">mvn:org.openhab.addons.bundles/org.openhab.transform.rollershutterposition/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2010-2023 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.transform.rollershutterposition.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.profiles.ProfileTypeUID;
import org.openhab.core.transform.TransformationService;

/**
* The {@link RollerShutterPositionConstants} class to define transform constants
* used across the whole binding.
*
* @author Jeff James - Initial contribution
*/
@NonNullByDefault
public class RollerShutterPositionConstants {

// Profile Type UID
public static final ProfileTypeUID PROFILE_TYPE_UID = new ProfileTypeUID(
TransformationService.TRANSFORM_PROFILE_SCOPE, "ROLLERSHUTTERPOSITION");

// Parameters
public static final String UPTIME_PARAM = "uptime";
public static final String DOWNTIME_PARAM = "downtime";
public static final String PRECISION_PARAM = "precision";

public static final int POSITION_UPDATE_PERIOD_MILLISECONDS = 800;
public static final int DEFAULT_PRECISION = 5;
}
Loading

0 comments on commit 5f9b86c

Please sign in to comment.