[somfytahoma] added support for the Bioclimatic Pergola thing (#10498)
* [somfytahoma] added support for the Bioclimatic Pergola thing Signed-off-by: Ondrej Pecta <opecta@gmail.com> * Update bundles/org.openhab.binding.somfytahoma/README.md Signed-off-by: Fabian Wolter <github@fabian-wolter.de> Co-authored-by: Fabian Wolter <github@fabian-wolter.de>
This commit is contained in:
parent
4300c642c8
commit
3c4e650547
@ -69,9 +69,11 @@ Please see the example below.
|
|||||||
| roller shutter, screen, venetian blind, garage door, awning, pergola, curtain | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/MY/STOP + closure 0-100 |
|
| roller shutter, screen, venetian blind, garage door, awning, pergola, curtain | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/MY/STOP + closure 0-100 |
|
||||||
| window | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/STOP + closure 0-100 |
|
| window | control | device controller which reacts to commands UP/DOWN/ON/OFF/OPEN/CLOSE/STOP + closure 0-100 |
|
||||||
| silent roller shutter | silent_control | similar to control channel but in silent mode |
|
| silent roller shutter | silent_control | similar to control channel but in silent mode |
|
||||||
| venetian blind, adjustable slats roller shutter | orientation | percentual orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) |
|
| venetian blind, adjustable slats roller shutter, bioclimatic pergola | orientation | percentual orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) |
|
||||||
| venetian blind, adjustable slats roller shutter | closure_orientation | percentual closure and orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) |
|
| venetian blind, adjustable slats roller shutter | closure_orientation | percentual closure and orientation of the blind's slats, it can have value 0-100. For IO Homecontrol devices only (non RTS) |
|
||||||
| adjustable slats roller shutter | rocker | used for setting the rocker position of the roller shutter, the only position allowing the slats control |
|
| adjustable slats roller shutter | rocker | used for setting the rocker position of the roller shutter, the only position allowing the slats control |
|
||||||
|
| bioclimatic pergola | slats | slats state (open/closed) |
|
||||||
|
| bioclimatic pergola | pergola_command | used for controlling biclimatic pergola (closeSlats, openSlats, stop) |
|
||||||
| action group | execute_action | switch which reacts to ON command and triggers the predefined Tahoma action |
|
| action group | execute_action | switch which reacts to ON command and triggers the predefined Tahoma action |
|
||||||
| onoff, light | switch | reacts to standard ON/OFF commands |
|
| onoff, light | switch | reacts to standard ON/OFF commands |
|
||||||
| dimmer light | light_intensity | sets/gets intensity of the dimmer light or ON/OFF |
|
| dimmer light | light_intensity | sets/gets intensity of the dimmer light or ON/OFF |
|
||||||
|
|||||||
@ -124,6 +124,10 @@ public class SomfyTahomaBindingConstants {
|
|||||||
// Pergola
|
// Pergola
|
||||||
public static final ThingTypeUID THING_TYPE_PERGOLA = new ThingTypeUID(BINDING_ID, "pergola");
|
public static final ThingTypeUID THING_TYPE_PERGOLA = new ThingTypeUID(BINDING_ID, "pergola");
|
||||||
|
|
||||||
|
// Bioclimatic Pergola
|
||||||
|
public static final ThingTypeUID THING_TYPE_BIOCLIMATIC_PERGOLA = new ThingTypeUID(BINDING_ID,
|
||||||
|
"bioclimaticpergola");
|
||||||
|
|
||||||
// Window handle
|
// Window handle
|
||||||
public static final ThingTypeUID THING_TYPE_WINDOW_HANDLE = new ThingTypeUID(BINDING_ID, "windowhandle");
|
public static final ThingTypeUID THING_TYPE_WINDOW_HANDLE = new ThingTypeUID(BINDING_ID, "windowhandle");
|
||||||
|
|
||||||
@ -171,8 +175,14 @@ public class SomfyTahomaBindingConstants {
|
|||||||
// Silent roller shutter
|
// Silent roller shutter
|
||||||
public static final String CONTROL_SILENT = "control_silent";
|
public static final String CONTROL_SILENT = "control_silent";
|
||||||
|
|
||||||
// Blind
|
// Bioclimatic Pergola
|
||||||
|
public static final String SLATS = "slats";
|
||||||
|
public static final String PERGOLA_COMMAND = "pergola_command";
|
||||||
|
|
||||||
|
// Blind, Bioclimatic Pergola
|
||||||
public static final String ORIENTATION = "orientation";
|
public static final String ORIENTATION = "orientation";
|
||||||
|
|
||||||
|
// Blind
|
||||||
public static final String CLOSURE_AND_ORIENTATION = "closure_orientation";
|
public static final String CLOSURE_AND_ORIENTATION = "closure_orientation";
|
||||||
|
|
||||||
// Action group
|
// Action group
|
||||||
@ -306,6 +316,8 @@ public class SomfyTahomaBindingConstants {
|
|||||||
public static final String COMMAND_DOWN = "down";
|
public static final String COMMAND_DOWN = "down";
|
||||||
public static final String COMMAND_OPEN = "open";
|
public static final String COMMAND_OPEN = "open";
|
||||||
public static final String COMMAND_CLOSE = "close";
|
public static final String COMMAND_CLOSE = "close";
|
||||||
|
public static final String COMMAND_OPEN_SLATS = "openSlats";
|
||||||
|
public static final String COMMAND_CLOSE_SLATS = "closeSlats";
|
||||||
public static final String COMMAND_STOP = "stop";
|
public static final String COMMAND_STOP = "stop";
|
||||||
public static final String COMMAND_OFF = "off";
|
public static final String COMMAND_OFF = "off";
|
||||||
public static final String COMMAND_CHECK_TRIGGER = "checkEventTrigger";
|
public static final String COMMAND_CHECK_TRIGGER = "checkEventTrigger";
|
||||||
@ -385,7 +397,8 @@ public class SomfyTahomaBindingConstants {
|
|||||||
THING_TYPE_GATE, THING_TYPE_CURTAIN, THING_TYPE_ELECTRICITYSENSOR, THING_TYPE_DOCK, THING_TYPE_SIREN,
|
THING_TYPE_GATE, THING_TYPE_CURTAIN, THING_TYPE_ELECTRICITYSENSOR, THING_TYPE_DOCK, THING_TYPE_SIREN,
|
||||||
THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER, THING_TYPE_MYFOX_CAMERA, THING_TYPE_ROLLERSHUTTER_UNO,
|
THING_TYPE_ADJUSTABLE_SLATS_ROLLERSHUTTER, THING_TYPE_MYFOX_CAMERA, THING_TYPE_ROLLERSHUTTER_UNO,
|
||||||
THING_TYPE_WATERSENSOR, THING_TYPE_HUMIDITYSENSOR, THING_TYPE_MYFOX_ALARM, THING_TYPE_THERMOSTAT,
|
THING_TYPE_WATERSENSOR, THING_TYPE_HUMIDITYSENSOR, THING_TYPE_MYFOX_ALARM, THING_TYPE_THERMOSTAT,
|
||||||
THING_TYPE_DIMMER_LIGHT, THING_TYPE_EXTERIOR_HEATING_SYSTEM, THING_TYPE_VALVE_HEATING_SYSTEM));
|
THING_TYPE_DIMMER_LIGHT, THING_TYPE_EXTERIOR_HEATING_SYSTEM, THING_TYPE_VALVE_HEATING_SYSTEM,
|
||||||
|
THING_TYPE_BIOCLIMATIC_PERGOLA));
|
||||||
|
|
||||||
// somfy gateways
|
// somfy gateways
|
||||||
public static Map<Integer, String> gatewayTypes = new HashMap<Integer, String>() {
|
public static Map<Integer, String> gatewayTypes = new HashMap<Integer, String>() {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import org.eclipse.jdt.annotation.Nullable;
|
|||||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaActionGroupHandler;
|
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaActionGroupHandler;
|
||||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaAdjustableSlatsRollerShutterHandler;
|
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaAdjustableSlatsRollerShutterHandler;
|
||||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaAwningHandler;
|
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaAwningHandler;
|
||||||
|
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaBioclimaticPergolaHandler;
|
||||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaBridgeHandler;
|
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaBridgeHandler;
|
||||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaContactSensorHandler;
|
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaContactSensorHandler;
|
||||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaCurtainHandler;
|
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaCurtainHandler;
|
||||||
@ -159,6 +160,8 @@ public class SomfyTahomaHandlerFactory extends BaseThingHandlerFactory {
|
|||||||
return new SomfyTahomaDoorLockHandler(thing);
|
return new SomfyTahomaDoorLockHandler(thing);
|
||||||
} else if (thingTypeUID.equals(THING_TYPE_PERGOLA)) {
|
} else if (thingTypeUID.equals(THING_TYPE_PERGOLA)) {
|
||||||
return new SomfyTahomaPergolaHandler(thing);
|
return new SomfyTahomaPergolaHandler(thing);
|
||||||
|
} else if (thingTypeUID.equals(THING_TYPE_BIOCLIMATIC_PERGOLA)) {
|
||||||
|
return new SomfyTahomaBioclimaticPergolaHandler(thing);
|
||||||
} else if (thingTypeUID.equals(THING_TYPE_WINDOW_HANDLE)) {
|
} else if (thingTypeUID.equals(THING_TYPE_WINDOW_HANDLE)) {
|
||||||
return new SomfyTahomaWindowHandleHandler(thing);
|
return new SomfyTahomaWindowHandleHandler(thing);
|
||||||
} else if (thingTypeUID.equals(THING_TYPE_TEMPERATURESENSOR)) {
|
} else if (thingTypeUID.equals(THING_TYPE_TEMPERATURESENSOR)) {
|
||||||
|
|||||||
@ -275,7 +275,12 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService
|
|||||||
deviceDiscovered(device, THING_TYPE_DOOR_LOCK, place);
|
deviceDiscovered(device, THING_TYPE_DOOR_LOCK, place);
|
||||||
break;
|
break;
|
||||||
case CLASS_PERGOLA:
|
case CLASS_PERGOLA:
|
||||||
|
if ("BioclimaticPergola".equals(device.getWidget())) {
|
||||||
|
// widget: BioclimaticPergola
|
||||||
|
deviceDiscovered(device, THING_TYPE_BIOCLIMATIC_PERGOLA, place);
|
||||||
|
} else {
|
||||||
deviceDiscovered(device, THING_TYPE_PERGOLA, place);
|
deviceDiscovered(device, THING_TYPE_PERGOLA, place);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case CLASS_WINDOW_HANDLE:
|
case CLASS_WINDOW_HANDLE:
|
||||||
// widget: ThreeWayWindowHandle
|
// widget: ThreeWayWindowHandle
|
||||||
|
|||||||
@ -0,0 +1,77 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010-2021 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.somfytahoma.internal.handler;
|
||||||
|
|
||||||
|
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.*;
|
||||||
|
|
||||||
|
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||||
|
import org.openhab.core.thing.ChannelUID;
|
||||||
|
import org.openhab.core.thing.Thing;
|
||||||
|
import org.openhab.core.types.Command;
|
||||||
|
import org.openhab.core.types.RefreshType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link SomfyTahomaBioclimaticPergolaHandler} is responsible for handling commands,
|
||||||
|
* which are sent to one of the channels of the bioclimatic pergola thing.
|
||||||
|
*
|
||||||
|
* @author Ondrej Pecta - Initial contribution
|
||||||
|
*/
|
||||||
|
@NonNullByDefault
|
||||||
|
public class SomfyTahomaBioclimaticPergolaHandler extends SomfyTahomaBaseThingHandler {
|
||||||
|
|
||||||
|
public SomfyTahomaBioclimaticPergolaHandler(Thing thing) {
|
||||||
|
super(thing);
|
||||||
|
stateNames.put(SLATS, "core:SlatsOpenClosedState");
|
||||||
|
stateNames.put(ORIENTATION, "core:SlatsOrientationState");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||||
|
super.handleCommand(channelUID, command);
|
||||||
|
|
||||||
|
if (command instanceof RefreshType) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (channelUID.getId()) {
|
||||||
|
case PERGOLA_COMMAND:
|
||||||
|
String cmd = getTahomaCommand(command.toString().toUpperCase());
|
||||||
|
sendCommand(cmd);
|
||||||
|
break;
|
||||||
|
case ORIENTATION:
|
||||||
|
// Bioclimatic pergola can control only orientation and full closure, not partial closure
|
||||||
|
String param = "[" + toInteger(command) + "]";
|
||||||
|
sendCommand(COMMAND_SET_ORIENTATION, param);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTahomaCommand(String command) {
|
||||||
|
switch (command) {
|
||||||
|
case "OFF":
|
||||||
|
case "DOWN":
|
||||||
|
case "CLOSE":
|
||||||
|
case "CLOSESLATS":
|
||||||
|
return COMMAND_CLOSE_SLATS;
|
||||||
|
case "ON":
|
||||||
|
case "UP":
|
||||||
|
case "OPEN":
|
||||||
|
case "OPENSLATS":
|
||||||
|
return COMMAND_OPEN_SLATS;
|
||||||
|
default:
|
||||||
|
return COMMAND_STOP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<thing:thing-descriptions bindingId="somfytahoma"
|
||||||
|
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="bioclimaticpergola">
|
||||||
|
<supported-bridge-type-refs>
|
||||||
|
<bridge-type-ref id="bridge"/>
|
||||||
|
</supported-bridge-type-refs>
|
||||||
|
<label>Somfy Bioclimatic Pergola</label>
|
||||||
|
<channels>
|
||||||
|
<channel id="slats" typeId="slats"></channel>
|
||||||
|
<channel id="orientation" typeId="orientation"></channel>
|
||||||
|
<channel id="pergola_command" typeId="pergola_command"></channel>
|
||||||
|
</channels>
|
||||||
|
<representation-property>url</representation-property>
|
||||||
|
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||||
|
</thing-type>
|
||||||
|
|
||||||
|
</thing:thing-descriptions>
|
||||||
@ -396,4 +396,24 @@
|
|||||||
<description>The scenarios defined in the cloud portal</description>
|
<description>The scenarios defined in the cloud portal</description>
|
||||||
<autoUpdatePolicy>recommend</autoUpdatePolicy>
|
<autoUpdatePolicy>recommend</autoUpdatePolicy>
|
||||||
</channel-type>
|
</channel-type>
|
||||||
|
|
||||||
|
<channel-type id="slats">
|
||||||
|
<item-type>Contact</item-type>
|
||||||
|
<label>Slats</label>
|
||||||
|
<description>Slats having OPEN/CLOSED state</description>
|
||||||
|
<state readOnly="true"/>
|
||||||
|
</channel-type>
|
||||||
|
|
||||||
|
<channel-type id="pergola_command">
|
||||||
|
<item-type>String</item-type>
|
||||||
|
<label>Command</label>
|
||||||
|
<description>A channel used for sending commands to Somfy Bioclimatic Pergola device</description>
|
||||||
|
<state>
|
||||||
|
<options>
|
||||||
|
<option value="closeSlats">Close slats</option>
|
||||||
|
<option value="openSlats">Open slats</option>
|
||||||
|
<option value="stop">Stop</option>
|
||||||
|
</options>
|
||||||
|
</state>
|
||||||
|
</channel-type>
|
||||||
</thing:thing-descriptions>
|
</thing:thing-descriptions>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user