[somfytahoma] Add support for noise and CO2 sensor (#15671)
Signed-off-by: Ondrej Pecta <opecta@gmail.com>
This commit is contained in:
parent
903bbd4082
commit
1d50a40476
|
@ -32,6 +32,8 @@ Any home automation system based on the OverKiz API is potentially supported.
|
|||
- rain sensors (OPEN/CLOSE contact)
|
||||
- temperature sensors (get temperature)
|
||||
- electricity sensors (get energy consumption)
|
||||
- carbon dioxide sensors (get CO2 concentration)
|
||||
- noise sensors (get noise)
|
||||
- door locks (LOCK/UNLOCK, OPEN/CLOSE commands)
|
||||
- heating systems (control temperature, set heating level)
|
||||
- valve heating systems (control temperature, derogation mode and temperature)
|
||||
|
@ -126,6 +128,8 @@ Please see the example below.
|
|||
| light sensor | luminance | light luminance value in luxes |
|
||||
| electricity sensor | energy_consumption | energy consumption value in watts |
|
||||
| humidity sensor | humidity | current relative humidity |
|
||||
| carbon dioxide sensor | co2_concentration | CO2 concentration in ppm |
|
||||
| noise sensor | noise | noise in decibel |
|
||||
| dock | battery_status | indicates running on battery (yes/no) |
|
||||
| dock | battery_level | remaining battery percentage |
|
||||
| dock | siren_status | used for controlling and getting siren state (on, off, cyclic) |
|
||||
|
|
|
@ -178,6 +178,12 @@ public class SomfyTahomaBindingConstants {
|
|||
// RainSensor
|
||||
public static final ThingTypeUID THING_TYPE_RAINSENSOR = new ThingTypeUID(BINDING_ID, "rainsensor");
|
||||
|
||||
// CarbonDioxideSensor
|
||||
public static final ThingTypeUID THING_TYPE_CARBON_DIOXIDE_SENSOR = new ThingTypeUID(BINDING_ID, "co2sensor");
|
||||
|
||||
// NoiseSensor
|
||||
public static final ThingTypeUID THING_TYPE_NOISE_SENSOR = new ThingTypeUID(BINDING_ID, "noisesensor");
|
||||
|
||||
// List of all Channel ids
|
||||
public static final String RSSI = "rssi";
|
||||
|
||||
|
@ -238,6 +244,12 @@ public class SomfyTahomaBindingConstants {
|
|||
// Temperature sensor
|
||||
public static final String TEMPERATURE = "temperature";
|
||||
|
||||
// Carbon dioxide sensor
|
||||
public static final String CO2_CONCENTRATION = "co2_concentration";
|
||||
|
||||
// Noise sensor
|
||||
public static final String NOISE = "noise";
|
||||
|
||||
// Alarm
|
||||
public static final String ALARM_COMMAND = "alarm_command";
|
||||
public static final String ALARM_STATE = "alarm_state";
|
||||
|
@ -494,12 +506,15 @@ public class SomfyTahomaBindingConstants {
|
|||
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";
|
||||
public static final String CLASS_CARBON_DIOXIDE_SENSOR = "CarbonDioxideSensor";
|
||||
public static final String CLASS_NOISE_SENSOR = "NoiseSensor";
|
||||
|
||||
// unsupported uiClasses
|
||||
public static final String THING_PROTOCOL_GATEWAY = "ProtocolGateway";
|
||||
public static final String THING_REMOTE_CONTROLLER = "RemoteController";
|
||||
public static final String THING_NETWORK_COMPONENT = "NetworkComponent";
|
||||
public static final String THING_GENERIC = "Generic";
|
||||
public static final String THING_CONFIGURATION_COMPONENT = "ConfigurationComponent";
|
||||
|
||||
// Event states
|
||||
public static final String FAILED_EVENT = "FAILED";
|
||||
|
@ -518,7 +533,8 @@ 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_RAINSENSOR, THING_TYPE_SHUTTER));
|
||||
THING_TYPE_HITACHI_DHW, THING_TYPE_HITACHI_ATWMC, THING_TYPE_RAINSENSOR, THING_TYPE_SHUTTER,
|
||||
THING_TYPE_CARBON_DIOXIDE_SENSOR, THING_TYPE_NOISE_SENSOR));
|
||||
|
||||
// somfy gateways
|
||||
public static Map<Integer, String> gatewayTypes = new HashMap<>() {
|
||||
|
@ -560,6 +576,7 @@ public class SomfyTahomaBindingConstants {
|
|||
put(72, "TAHOMA_RAIL_DIN");
|
||||
put(77, "ELIOT");
|
||||
put(88, "WISER");
|
||||
put(92, "NETATMO");
|
||||
put(99, "CONNECTIVITY KIT");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaAdjustableSla
|
|||
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.SomfyTahomaCarbonDioxideSensorHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaContactSensorHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaCurtainHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaDimmerLightHandler;
|
||||
|
@ -39,6 +40,7 @@ import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaInternalAlarm
|
|||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaLightSensorHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaMyfoxAlarmHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaMyfoxCameraHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaNoiseSensorHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaOccupancySensorHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaOnOffHandler;
|
||||
import org.openhab.binding.somfytahoma.internal.handler.SomfyTahomaOnOffHeatingSystemHandler;
|
||||
|
@ -202,6 +204,10 @@ public class SomfyTahomaHandlerFactory extends BaseThingHandlerFactory {
|
|||
return new SomfyTahomaHitachiATWMCHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_RAINSENSOR)) {
|
||||
return new SomfyTahomaRainSensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_CARBON_DIOXIDE_SENSOR)) {
|
||||
return new SomfyTahomaCarbonDioxideSensorHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_NOISE_SENSOR)) {
|
||||
return new SomfyTahomaNoiseSensorHandler(thing);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -287,6 +287,7 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService
|
|||
// widget: RelativeHumiditySensor
|
||||
deviceDiscovered(device, THING_TYPE_HUMIDITYSENSOR, place);
|
||||
}
|
||||
break;
|
||||
case CLASS_DOOR_LOCK:
|
||||
// widget: UnlockDoorLockWithUnknownPosition
|
||||
deviceDiscovered(device, THING_TYPE_DOOR_LOCK, place);
|
||||
|
@ -364,10 +365,21 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService
|
|||
} else {
|
||||
logUnsupportedDevice(device);
|
||||
}
|
||||
break;
|
||||
case CLASS_CARBON_DIOXIDE_SENSOR:
|
||||
// widget: CO2Sensor
|
||||
deviceDiscovered(device, THING_TYPE_CARBON_DIOXIDE_SENSOR, place);
|
||||
break;
|
||||
case CLASS_NOISE_SENSOR:
|
||||
// widget: NoiseSensor
|
||||
deviceDiscovered(device, THING_TYPE_NOISE_SENSOR, place);
|
||||
break;
|
||||
case THING_PROTOCOL_GATEWAY:
|
||||
case THING_REMOTE_CONTROLLER:
|
||||
// widget: AlarmRemoteController
|
||||
case THING_NETWORK_COMPONENT:
|
||||
case THING_CONFIGURATION_COMPONENT:
|
||||
// widget: NetatmoHome
|
||||
case THING_GENERIC:
|
||||
// widget: unknown
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* 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.binding.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.CO2_CONCENTRATION;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaCarbonDioxideSensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the carbon dioxide sensor thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaCarbonDioxideSensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaCarbonDioxideSensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(CO2_CONCENTRATION, "core:CO2ConcentrationState");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* 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.binding.somfytahoma.internal.handler;
|
||||
|
||||
import static org.openhab.binding.somfytahoma.internal.SomfyTahomaBindingConstants.NOISE;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
import org.openhab.core.thing.Thing;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaNoiseSensorHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the noise sensor thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaNoiseSensorHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaNoiseSensorHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(NOISE, "core:NoiseState");
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@ thing-type.somfytahoma.awning.label = Somfy Awning
|
|||
thing-type.somfytahoma.bioclimaticpergola.label = Somfy Bioclimatic Pergola
|
||||
thing-type.somfytahoma.bridge.label = Bridge
|
||||
thing-type.somfytahoma.bridge.description = Bridge enabling communication with devices through a cloud portal
|
||||
thing-type.somfytahoma.co2sensor.label = Somfy CO2 Sensor
|
||||
thing-type.somfytahoma.contactsensor.label = Somfy Contact Sensor
|
||||
thing-type.somfytahoma.curtain.label = Somfy Curtain
|
||||
thing-type.somfytahoma.dimmerlight.label = Somfy Dimmer Light
|
||||
|
@ -35,6 +36,7 @@ thing-type.somfytahoma.light.label = Somfy Light Switch
|
|||
thing-type.somfytahoma.lightsensor.label = Somfy Light Sensor
|
||||
thing-type.somfytahoma.myfoxalarm.label = Somfy Myfox Alarm
|
||||
thing-type.somfytahoma.myfoxcamera.label = Somfy Myfox Camera
|
||||
thing-type.somfytahoma.noisesensor.label = Somfy Noise Sensor
|
||||
thing-type.somfytahoma.occupancysensor.label = Somfy Occupancy Sensor
|
||||
thing-type.somfytahoma.onoff.label = Somfy On/Off Switch
|
||||
thing-type.somfytahoma.onoffheatingsystem.label = Somfy Heating System with On/Off
|
||||
|
@ -161,6 +163,8 @@ channel-type.somfytahoma.control.label = Control
|
|||
channel-type.somfytahoma.control.description = Device control (UP, DOWN, MY/STOP, closure 0-100%)
|
||||
channel-type.somfytahoma.moving.label = Moving
|
||||
channel-type.somfytahoma.moving.description = Indicates if the device is currently operating a command
|
||||
channel-type.somfytahoma.co2_concentration.label = CO2 concentration
|
||||
channel-type.somfytahoma.co2_concentration.description = A CO2 sensor carbon dioxide concentration in ppm
|
||||
channel-type.somfytahoma.control_silent.label = Control (silent)
|
||||
channel-type.somfytahoma.control_silent.description = Device control (UP, DOWN, MY/STOP, closure 0-100%) (only for IO devices)
|
||||
channel-type.somfytahoma.current_heating_mode.label = Current Heating Mode
|
||||
|
@ -258,6 +262,8 @@ channel-type.somfytahoma.myfox_alarm_command.description = A channel used for se
|
|||
channel-type.somfytahoma.myfox_alarm_command.state.option.arm = ARM
|
||||
channel-type.somfytahoma.myfox_alarm_command.state.option.disarm = DISARM
|
||||
channel-type.somfytahoma.myfox_alarm_command.state.option.partial = ARM_PARTIAL
|
||||
channel-type.somfytahoma.noise.label = Noise
|
||||
channel-type.somfytahoma.noise.description = A noise sensor noise in decibel
|
||||
channel-type.somfytahoma.open.label = Open/Close
|
||||
channel-type.somfytahoma.open.description = A channel for controlling door OPEN/CLOSE state
|
||||
channel-type.somfytahoma.open_closed_valve.label = Valve Open/Closed state
|
||||
|
|
|
@ -44,6 +44,20 @@
|
|||
<state readOnly="true" pattern="%.1f %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="co2_concentration">
|
||||
<item-type>Number:DimensionLess</item-type>
|
||||
<label>CO2 concentration</label>
|
||||
<description>A CO2 sensor carbon dioxide concentration in ppm</description>
|
||||
<state readOnly="true" pattern="%d %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="noise">
|
||||
<item-type>Number:DimensionLess</item-type>
|
||||
<label>Noise</label>
|
||||
<description>A noise sensor noise in decibel</description>
|
||||
<state readOnly="true" pattern="%d %unit%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="alarm_command">
|
||||
<item-type>String</item-type>
|
||||
<label>Command</label>
|
||||
|
|
|
@ -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="co2sensor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy CO2 Sensor</label>
|
||||
<channels>
|
||||
<channel id="co2_concentration" typeId="co2_concentration"></channel>
|
||||
</channels>
|
||||
<representation-property>url</representation-property>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
|
@ -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="noisesensor">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Noise Sensor</label>
|
||||
<channels>
|
||||
<channel id="noise" typeId="noise"></channel>
|
||||
</channels>
|
||||
<representation-property>url</representation-property>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
Loading…
Reference in New Issue