[somfytahoma] added support for the Rain sensor thing (#12368)

Signed-off-by: Ondrej Pecta <opecta@gmail.com>
This commit is contained in:
Ondrej Pecta
2022-02-25 09:11:08 +01:00
committed by GitHub
parent 791ad37ba6
commit 0737ee6bef
7 changed files with 73 additions and 3 deletions

View File

@@ -172,6 +172,9 @@ public class SomfyTahomaBindingConstants {
// HitachiAirToWaterMainComponent
public static final ThingTypeUID THING_TYPE_HITACHI_ATWMC = new ThingTypeUID(BINDING_ID, "hitachiatwmc");
// RainSensor
public static final ThingTypeUID THING_TYPE_RAINSENSOR = new ThingTypeUID(BINDING_ID, "rainsensor");
// List of all Channel ids
public static final String RSSI = "rssi";
@@ -211,8 +214,10 @@ public class SomfyTahomaBindingConstants {
public static final String LOCK = "lock";
public static final String OPEN = "open";
// Smoke sensor, Occupancy sensor, Contact sensor, Water sensor
// Smoke sensor, Occupancy sensor, Contact sensor, Water sensor, Rain sensor
public static final String CONTACT = "contact";
// Smoke sensor, Occupancy sensor, Contact sensor, Water sensor
public static final String SENSOR_DEFECT = "sensor_defect";
// Humidity sensor
@@ -469,6 +474,7 @@ public class SomfyTahomaBindingConstants {
public static final String CLASS_CAMERA = "Camera";
public static final String CLASS_WATER_HEATING_SYSTEM = "WaterHeatingSystem";
public static final String CLASS_HITACHI_HEATING_SYSTEM = "HitachiHeatingSystem";
public static final String CLASS_RAIN_SENSOR = "RainSensor";
// unsupported uiClasses
public static final String THING_PROTOCOL_GATEWAY = "ProtocolGateway";
@@ -493,7 +499,7 @@ public class SomfyTahomaBindingConstants {
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_BIOCLIMATIC_PERGOLA, THING_TYPE_WATERHEATINGSYSTEM, THING_TYPE_HITACHI_ATWHZ,
THING_TYPE_HITACHI_DHW, THING_TYPE_HITACHI_ATWMC));
THING_TYPE_HITACHI_DHW, THING_TYPE_HITACHI_ATWMC, THING_TYPE_RAINSENSOR));
// somfy gateways
public static Map<Integer, String> gatewayTypes = new HashMap<Integer, String>() {

View File

@@ -44,6 +44,7 @@ import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaOnOffHandler;
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaOnOffHeatingSystemHandler;
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaPergolaHandler;
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaPodHandler;
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaRainSensorHandler;
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaRollerShutterHandler;
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaSilentRollerShutterHandler;
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaSirenHandler;
@@ -196,6 +197,8 @@ public class SomfyTahomaHandlerFactory extends BaseThingHandlerFactory {
return new SomfyTahomaHitachiDHWHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_HITACHI_ATWMC)) {
return new SomfyTahomaHitachiATWMCHandler(thing);
} else if (thingTypeUID.equals(THING_TYPE_RAINSENSOR)) {
return new SomfyTahomaRainSensorHandler(thing);
} else {
return null;
}

View File

@@ -340,6 +340,13 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService
logUnsupportedDevice(device);
}
break;
case CLASS_RAIN_SENSOR:
if ("RainSensor".equals(device.getWidget())) {
// widget: RainSensor
deviceDiscovered(device, THING_TYPE_RAINSENSOR, place);
} else {
logUnsupportedDevice(device);
}
case THING_PROTOCOL_GATEWAY:
case THING_REMOTE_CONTROLLER:
// widget: AlarmRemoteController

View File

@@ -0,0 +1,33 @@
/**
* Copyright (c) 2010-2022 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.Thing;
/**
* The {@link SomfyTahomaRainSensorHandler} is responsible for handling commands,
* which are sent to one of the channels of the rain sensor thing.
*
* @author Ondrej Pecta - Initial contribution
*/
@NonNullByDefault
public class SomfyTahomaRainSensorHandler extends SomfyTahomaBaseThingHandler {
public SomfyTahomaRainSensorHandler(Thing thing) {
super(thing);
stateNames.put(CONTACT, "core:RainState");
}
}

View File

@@ -40,6 +40,7 @@ thing-type.somfytahoma.onoff.label = Somfy On/Off Switch
thing-type.somfytahoma.onoffheatingsystem.label = Somfy Heating System with On/Off
thing-type.somfytahoma.pergola.label = Somfy Pergola
thing-type.somfytahoma.pod.label = Somfy Pod
thing-type.somfytahoma.rainsensor.label = Somfy Rain Sensor
thing-type.somfytahoma.rollershutter.label = Somfy Roller Shutter
thing-type.somfytahoma.rollershutter_silent.label = Somfy Silent Roller Shutter
thing-type.somfytahoma.rollershutter_uno.label = Somfy Roller Shutter Uno

View File

@@ -0,0 +1,19 @@
<?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="rainsensor">
<supported-bridge-type-refs>
<bridge-type-ref id="bridge"/>
</supported-bridge-type-refs>
<label>Somfy Rain Sensor</label>
<channels>
<channel id="contact" typeId="contact"></channel>
</channels>
<representation-property>url</representation-property>
<config-description-ref uri="thing-type:somfytahoma:device"/>
</thing-type>
</thing:thing-descriptions>