Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal shutterState for Rullershutter #75

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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 @@ -38,7 +38,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 @@ -47,6 +47,12 @@
<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">
Expand Down
10 changes: 6 additions & 4 deletions addons/binding/org.openhab.binding.openwebnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ Devices support some of the following channels:
|--------------------------|---------------|-------------------------------------------------------------------------|:----------:|
| `switch` | Switch | To switch the device `ON` and `OFF` | R/W |
| `brightness` | Dimmer | To adjust the brightness value (Percent, `ON`, `OFF`) | R/W |
| `shutter` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W |
| `shutterPosition` | Rollershutter | To activate roller shutters (`UP`, `DOWN`, `STOP`, Percent - [see Shutter position](#shutter-position)) | R/W |
| `shutterMotion` | Number | The motion currently roller shutters (`0`= stop, `1`= up, `2`= down) | R |
| `temperature` | Number | The zone currently sensed temperature (°C) | R |
| `targetTemperature` | Number | The zone target temperature (°C). It considers `setPoint` but also `activeMode` and `localMode` | R |
| `thermoFunction` | String | The zone set thermo function: `HEAT`, `COOL` or `GENERIC` (heating + cooling) | R |
Expand All @@ -226,7 +227,7 @@ Devices support some of the following channels:

### Notes on channels

#### `shutter` position
#### `shutterPosition` position

For Percent commands and position feedback to work correctly, the `shutterRun` Thing config parameter must be configured equal to the time (in ms) to go from full UP to full DOWN.
It's possible to enter a value manually or set `shutterRun=AUTO` (default) to calibrate shutterRun parameter automatically the first time a Percent command is sent to the shutter: a *UP >> DOWN >> Position%* cycle will be performed automatically.
Expand Down Expand Up @@ -264,7 +265,7 @@ To be visible to assistants like Google Assistant/Amazon Alexa/Apple HomeKit (Si
Items created automatically with PaperUI (Simple Mode item linking: `Configuration > System > Item Linking > Simple mode > SAVE`) will get automatically the correct tag from the binding: in particular items associated with these channels will have the following tags:

- `switch` / `brightness` channels will have the `Lighting` tag
- `shutter` channel will have the `Blinds` and `Switchable` tag
- `shutterPosition` channel will have the `Blinds` and `Switchable` tag
- `temperature` channel will have the `CurrentTemperature` tag
- `setpointTemperature` channel will have the `TargetTemperature` tag
- `heatingCoolingMode` channel will have the `homekit:HeatingCoolingMode` tag
Expand Down Expand Up @@ -326,7 +327,8 @@ Switch iLR_switch "Switch" <light> (gLiv
Dimmer iLR_dimmer "Brightness [%.0f %%]" <DimmableLight> (gLivingRoom) [ "Lighting" ] { channel="openwebnet:bus_dimmer:mybridge:LR_dimmer:brightness" }
Dimmer iLR_dalidimmer "Brightness [%.0f %%]" <DimmableLight> (gLivingRoom) [ "Lighting" ] { channel="openwebnet:bus_dimmer:mybridge:LR_dalidimmer:brightness" }
/* For Dimmers, use category DimmableLight to have Off/On switch in addition to the Percent slider in PaperUI */
Rollershutter iLR_shutter "Shutter [%.0f %%]" <rollershutter> (gShutters, gLivingRoom) [ "Blinds" ] { channel="openwebnet:bus_automation:mybridge:LR_shutter:shutter" }
Rollershutter iLR_shutter "Shutter [%.0f %%]" <rollershutter> (gShutters, gLivingRoom) [ "Blinds" ] { channel="openwebnet:bus_automation:mybridge:LR_shutter:shutterPosition" }
Number iLR_shuttermotion "Shutter motion" (gShutters, gLivingRoom) { channel="openwebnet:bus_automation:mybridge:LR_shutter:shutterMotion" }
Number iEXT_tempsensor "Temperature [%.1f °C]" <temperature> [ "CurrentTemperature" ] { channel="openwebnet:bus_temp_sensor:mybridge:EXT_tempsensor:temperature" }
Number iCENTRAL_en_power "Power [%.0f W]" <energy> { channel="openwebnet:bus_energy_central_unit:mybridge:CENTRAL_energy:power" }
String iLR_scenario_btn4 "Scenario Button 4" <network> { channel="openwebnet:bus_cen_scenario_control:mybridge:LR_CEN_scenario:button_4" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,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 @@ -104,7 +105,7 @@ public void initialize() {
deviceWhere = deviceWhere + BaseOpenMessage.UNIT_01;
}
/*
* Channel ch = thing.getChannel(CHANNEL_SHUTTER);
* Channel ch = thing.getChannel(CHANNEL_SHUTTERPOSITION);
* if (ch != null) {
* deviceChannel = ch.getUID();
* } else {
Expand Down Expand Up @@ -143,7 +144,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 @@ -158,7 +160,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 @@ -294,6 +296,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 @@ -401,10 +404,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