Skip to content

Commit

Permalink
Merge pull request #15 from Gozilla01/shutterPosition_shutterMotion
Browse files Browse the repository at this point in the history
shutterPosition e shutterMotion
  • Loading branch information
Gozilla01 authored Jul 29, 2019
2 parents e37e7fb + defc26e commit 3e0920b
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ public class OpenWebNetBindingConstants {
public static final String CHANNEL_SWITCH_02 = "switch_02";
public static final String CHANNEL_BRIGHTNESS = "brightness";
// automation
public static final String CHANNEL_SHUTTER = "shutter";
public static final String CHANNEL_SHUTTERPOSITION = "shutterPosition";
public static final String CHANNEL_SHUTTERMOTION = "shutterMotion";
// thermo
public static final String CHANNEL_TEMPERATURE = "temperature";
public static final String CHANNEL_TEMP_TARGET = "targetTemperature";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.smarthome.config.core.Configuration;
import org.eclipse.smarthome.core.library.types.DecimalType;
import org.eclipse.smarthome.core.library.types.PercentType;
import org.eclipse.smarthome.core.library.types.StopMoveType;
import org.eclipse.smarthome.core.library.types.UpDownType;
Expand Down Expand Up @@ -131,7 +132,8 @@ public void initialize() {
"@text/offline.wrong-configuration");
shutterRun = SHUTTER_RUN_UNDEFINED;
}
updateState(CHANNEL_SHUTTER, UnDefType.UNDEF);
updateState(CHANNEL_SHUTTERPOSITION, UnDefType.UNDEF);
updateState(CHANNEL_SHUTTERMOTION, UnDefType.UNDEF);
positionEst = POSITION_UNKNOWN;
}

Expand All @@ -146,7 +148,7 @@ protected void requestChannelState(ChannelUID channel) {
@Override
protected void handleChannelCommand(ChannelUID channel, Command command) {
switch (channel.getId()) {
case CHANNEL_SHUTTER:
case CHANNEL_SHUTTERPOSITION:
handleShutterCommand(command);
break;
default: {
Expand Down Expand Up @@ -283,6 +285,7 @@ private void updateAutomationState(Automation msg) {
logger.debug("==OWN:AutomationHandler== msg is command translation, ignoring...");
return;
}
updateState(CHANNEL_SHUTTERMOTION, new DecimalType(msg.getWhat().value()));
if (msg.isUp()) {
updateStateInt(STATE_MOVING_UP);
if (calibrating == CALIBRATION_ACTIVATED) {
Expand Down Expand Up @@ -389,10 +392,10 @@ private void updatePosition() {
}
if (newPos != POSITION_UNKNOWN) {
if (newPos != positionEst) {
updateState(CHANNEL_SHUTTER, new PercentType(newPos));
updateState(CHANNEL_SHUTTERPOSITION, new PercentType(newPos));
}
} else {
updateState(CHANNEL_SHUTTER, UnDefType.UNDEF);
updateState(CHANNEL_SHUTTERPOSITION, UnDefType.UNDEF);
}
positionEst = newPos;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<description>A OpenWebNet BUS/SCS automation device to control roller shutters, blinds, etc. BTicino models: xxx/yyyy/etc.</description>

<channels>
<channel id="shutter" typeId="shutter" />
<channel id="shutterPosition" typeId="shutterPosition" />
<channel id="shutterMotion" typeId="shutterMotion" />
</channels>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<description>A OpenWebNet ZigBee automation device to control roller shutters, blinds, etc. BTicino models: xxx/yyyy/etc.</description>

<channels>
<channel id="shutter" typeId="shutter" />
<channel id="shutterPosition" typeId="shutterPosition" />
<channel id="shutterMotion" typeId="shutterMotion" />
</channels>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


<!-- Shutter Channel -->
<channel-type id="shutter">
<channel-type id="shutterPosition">
<item-type>Rollershutter</item-type>
<label>Roller shutter</label>
<description>Control the roller shutter position</description>
Expand All @@ -48,7 +48,13 @@
<tag>Blinds</tag>
</tags>
</channel-type>

<channel-type id="shutterMotion">
<item-type>Number</item-type>
<label>Motion Roller shutter</label>
<description>Motion the roller shutter UP-DOWN-STOP</description>
<state readOnly="true" />
</channel-type>

<!-- Thermo channels -->
<channel-type id="temperature">
<item-type>Number:Temperature</item-type>
Expand Down

0 comments on commit 3e0920b

Please sign in to comment.