[somfytahoma] Added support for the thermostatic valve (#9122)
Signed-off-by: Ondrej Pecta <opecta@gmail.com>
This commit is contained in:
parent
a138748ff3
commit
219d370439
bundles/org.openhab.binding.somfytahoma
README.md
src/main
java/org/openhab/binding/somfytahoma/internal
SomfyTahomaBindingConstants.javaSomfyTahomaException.javaSomfyTahomaHandlerFactory.java
discovery
handler
resources/OH-INF/thing
@ -31,6 +31,7 @@ home automation systems.
|
||||
- electricity sensors (get energy consumption)
|
||||
- door locks (LOCK/UNLOCK, OPEN/CLOSE commands)
|
||||
- heating systems (control temperature, set heating level)
|
||||
- valve heating systems (control temperature, derogation mode and temperature)
|
||||
- exterior heating systems (set heating level)
|
||||
- alarms (both interior/external)
|
||||
- pods
|
||||
@ -62,63 +63,67 @@ Please see the example below.
|
||||
|
||||
## Channels
|
||||
|
||||
| Thing | Channel | Note |
|
||||
|-------------------------------------------------------------------------------|:---------------------:|-------------------------------------------------------------------------------------------------------------------------------|
|
||||
| bridge | N.A | bridge does not expose any channel |
|
||||
| gateway | status | status of your Tahoma gateway |
|
||||
| gate | gate_command | used for controlling your gate (open, close, stop, pedestrian) |
|
||||
| gate | gate_state | get state of your gate |
|
||||
| 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 |
|
||||
| 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 | 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 |
|
||||
| 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 |
|
||||
| dimmer light | light_intensity | sets/gets intensity of the dimmer light or ON/OFF |
|
||||
| smoke sensor, occupancy sensor, contact sensor & water sensor | contact | normal value is CLOSE, changes to OPEN when detection triggered |
|
||||
| smoke sensor, occupancy sensor, contact sensor & water sensor | sensor_defect | indicates the health of the sensor (dead, lowBatter, maintenanceRequired, noDefect) |
|
||||
| smoke sensor | radio_battery | maintenance radio part battery state (low, normal) |
|
||||
| smoke sensor | sensor_battery | maintenance sensor part battery state (absence, low, normal) |
|
||||
| smoke sensor | short_check | triggering the smoke sensor's short check |
|
||||
| smoke sensor | long_check | triggering the smoke sensor's long check |
|
||||
| light sensor | luminance | light luminance value in luxes |
|
||||
| electricity sensor | energy_consumption | energy consumption value in watts |
|
||||
| humidity sensor | humidity | current relative humidity |
|
||||
| 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) |
|
||||
| dock | short_beep | testing of dock's siren - short beep |
|
||||
| dock | long_beep | testing of dock's siren - long beep |
|
||||
| siren | battery | battery level full/low/normal/verylow |
|
||||
| siren | onoff | controlling siren status ON/OFF |
|
||||
| siren | memorized_volume | setting memorized volume (normal/highest) |
|
||||
| pod | cyclic_button | pod cyclic button state |
|
||||
| pod | battery_status | pod battery status state |
|
||||
| pod | lighting_led_pod_mode | lighting LED pod mod state |
|
||||
| interior alarm | alarm_command | used for sending commands to Somfy alarm device |
|
||||
| interior alarm | intrusion_control | used for alarm external intrusion controlling |
|
||||
| interior alarm, myfox alarm | alarm_state | state of the Somfy alarm |
|
||||
| interior alarm | target_alarm_state | target state of the Somfy alarm |
|
||||
| interior alarm, myfox alarm | intrusion_state | intrusion state of the Somfy alarm |
|
||||
| external alarm | active_zones_state | state of external alarm active zones |
|
||||
| door lock | lock | switch representing unlocked/locked state |
|
||||
| door lock | open | switch representing open/close state |
|
||||
| on/off heating system | target_heating_level | target heating level (off, eco, comfort, frostprotection) |
|
||||
| heating system | current_temperature | current temperature of the heating system |
|
||||
| heating system | current_state | current state of the heating system |
|
||||
| heating system, thermostat | target_temperature | target temperature of the heating system |
|
||||
| heating system, thermostat | battery_level | battery level of the heating system |
|
||||
| exterior heating system | heating_level | heating level of the exterior heating system or ON/OFF |
|
||||
| thermostat | heating_mode | standard heating mode of the thermostat (away, freeze, manual, ...) |
|
||||
| thermostat | derogation_heating_mode | derogation heating mode of the thermostat (away, freeze, manual, ...) |
|
||||
| thermostat | derogation_activation | derogation activation state (inactive, active) |
|
||||
| temperature sensor | temperature | temperature reported by the sensor |
|
||||
| myfox camera, myfox alarm | cloud_status | cloud connection status |
|
||||
| myfox camera | shutter | controlling of the camera shutter |
|
||||
| myfox alarm | myfox_alarm_command | used for sending commands to Somfy Myfox alarm device |
|
||||
|
||||
| Thing | Channel | Note |
|
||||
|-------------------------------------------------------------------------------|------------------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||
| bridge | N.A | bridge does not expose any channel |
|
||||
| gateway | status | status of your Tahoma gateway |
|
||||
| gate | gate_command | used for controlling your gate (open, close, stop, pedestrian) |
|
||||
| gate | gate_state | get state of your gate (open, closed, pedestrian) |
|
||||
| gate | gate_position | get position (0-100%) of your gate (where supported) |
|
||||
| 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 |
|
||||
| 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 | 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 |
|
||||
| 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 |
|
||||
| dimmer light | light_intensity | sets/gets intensity of the dimmer light or ON/OFF |
|
||||
| smoke sensor, occupancy sensor, contact sensor & water sensor | contact | normal value is CLOSE, changes to OPEN when detection triggered |
|
||||
| smoke sensor, occupancy sensor, contact sensor & water sensor | sensor_defect | indicates the health of the sensor (dead, lowBatter, maintenanceRequired, noDefect) |
|
||||
| smoke sensor | radio_battery | maintenance radio part battery state (low, normal) |
|
||||
| smoke sensor | sensor_battery | maintenance sensor part battery state (absence, low, normal) |
|
||||
| smoke sensor | short_check | triggering the smoke sensor's short check |
|
||||
| smoke sensor | long_check | triggering the smoke sensor's long check |
|
||||
| light sensor | luminance | light luminance value in luxes |
|
||||
| electricity sensor | energy_consumption | energy consumption value in watts |
|
||||
| humidity sensor | humidity | current relative humidity |
|
||||
| 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) |
|
||||
| dock | short_beep | testing of dock's siren - short beep |
|
||||
| dock | long_beep | testing of dock's siren - long beep |
|
||||
| siren | battery | battery level full/low/normal/verylow |
|
||||
| siren | onoff | controlling siren status ON/OFF |
|
||||
| siren | memorized_volume | setting memorized volume (normal/highest) |
|
||||
| pod | cyclic_button | pod cyclic button state |
|
||||
| pod | battery_status | pod battery status state |
|
||||
| pod | lighting_led_pod_mode | lighting LED pod mod state |
|
||||
| interior alarm | alarm_command | used for sending commands to Somfy alarm device |
|
||||
| interior alarm | intrusion_control | used for alarm external intrusion controlling |
|
||||
| interior alarm, myfox alarm | alarm_state | state of the Somfy alarm |
|
||||
| interior alarm | target_alarm_state | target state of the Somfy alarm |
|
||||
| interior alarm, myfox alarm | intrusion_state | intrusion state of the Somfy alarm |
|
||||
| external alarm | active_zones_state | state of external alarm active zones |
|
||||
| door lock | lock | switch representing unlocked/locked state |
|
||||
| door lock | open | switch representing open/close state |
|
||||
| on/off heating system | target_heating_level | target heating level (off, eco, comfort, frostprotection) |
|
||||
| heating system | current_temperature | current temperature of the heating system |
|
||||
| heating system | current_state | current state of the heating system |
|
||||
| heating system, valve heating system, thermostat | target_temperature | target temperature of the heating system |
|
||||
| heating system, valve heating system, thermostat | battery_level | battery level of the heating system |
|
||||
| valve heating system, thermostat | derogation_heating_mode | derogation heating mode of the thermostat (away, freeze, manual, ...) |
|
||||
| valve heating system, thermostat | derogated_target_temperature | target temperature of the heating system |
|
||||
| valve heating system | current_heating_mode | current heating mode of the thermostatic valve |
|
||||
| valve heating system | open_closed_valve | current open/closed state of the thermostatic valve |
|
||||
| valve heating system | operating mode | operating mode of the thermostatic valve |
|
||||
| thermostat | heating_mode | standard heating mode of the thermostat (away, freeze, manual, ...) |
|
||||
| thermostat | derogation_activation | derogation activation state (inactive, active) |
|
||||
| exterior heating system | heating_level | heating level of the exterior heating system or ON/OFF |
|
||||
| temperature sensor | temperature | temperature reported by the sensor |
|
||||
| myfox camera, myfox alarm | cloud_status | cloud connection status |
|
||||
| myfox camera | shutter | controlling of the camera shutter |
|
||||
| myfox alarm | myfox_alarm_command | used for sending commands to Somfy Myfox alarm device |
|
||||
|
||||
### Remarks
|
||||
|
||||
|
@ -106,7 +106,9 @@ public class SomfyTahomaBindingConstants {
|
||||
public static final ThingTypeUID THING_TYPE_POD = new ThingTypeUID(BINDING_ID, "pod");
|
||||
|
||||
// Heating system
|
||||
public static final ThingTypeUID THING_TYPE_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID, "heatingsystem");
|
||||
public static final ThingTypeUID THING_TYPE_VALVE_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID,
|
||||
"valveheatingsystem");
|
||||
public static final ThingTypeUID THING_TYPE_ZWAVE_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID, "heatingsystem");
|
||||
public static final ThingTypeUID THING_TYPE_ONOFF_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID,
|
||||
"onoffheatingsystem");
|
||||
public static final ThingTypeUID THING_TYPE_EXTERIOR_HEATING_SYSTEM = new ThingTypeUID(BINDING_ID,
|
||||
@ -220,15 +222,24 @@ public class SomfyTahomaBindingConstants {
|
||||
|
||||
// Thermostat
|
||||
public static final String HEATING_MODE = "heating_mode";
|
||||
public static final String DEROGATION_HEATING_MODE = "derogation_heating_mode";
|
||||
public static final String DEROGATION_ACTIVATION = "derogation_activation";
|
||||
|
||||
// Thermostat & Valve Heating system
|
||||
public static final String DEROGATED_TARGET_TEMPERATURE = "derogated_target_temperature";
|
||||
public static final String DEROGATION_HEATING_MODE = "derogation_heating_mode";
|
||||
|
||||
// Valve heating system
|
||||
public static final String CURRENT_HEATING_MODE = "current_heating_mode";
|
||||
public static final String OPEN_CLOSED_VALVE = "open_closed_valve";
|
||||
public static final String OPERATING_MODE = "operating_mode";
|
||||
|
||||
// Window handle
|
||||
public static final String HANDLE_STATE = "handle_state";
|
||||
|
||||
// Gate
|
||||
public static final String GATE_STATE = "gate_state";
|
||||
public static final String GATE_COMMAND = "gate_command";
|
||||
public static final String GATE_POSITION = "gate_position";
|
||||
|
||||
// ElectricitySensor
|
||||
public static final String ENERGY_CONSUMPTION = "energy_consumption";
|
||||
@ -285,6 +296,7 @@ public class SomfyTahomaBindingConstants {
|
||||
public static final String COMMAND_SET_HEATINGLEVEL = "setHeatingLevel";
|
||||
public static final String COMMAND_SET_PEDESTRIANPOSITION = "setPedestrianPosition";
|
||||
public static final String COMMAND_SET_ROCKERPOSITION = "setRockerPosition";
|
||||
public static final String COMMAND_SET_DEROGATION = "setDerogation";
|
||||
public static final String COMMAND_UP = "up";
|
||||
public static final String COMMAND_DOWN = "down";
|
||||
public static final String COMMAND_OPEN = "open";
|
||||
@ -309,10 +321,12 @@ public class SomfyTahomaBindingConstants {
|
||||
public static final String BATTERY_LEVEL_STATE = "core:BatteryLevelState";
|
||||
public static final String SIREN_STATUS_STATE = "internal:SirenStatusState";
|
||||
public static final String TARGET_TEMPERATURE_STATE = "core:TargetTemperatureState";
|
||||
public static final String TARGET_ROOM_TEMPERATURE_STATE = "core:TargetRoomTemperatureState";
|
||||
public static final String SMOKE_STATE = "core:SmokeState";
|
||||
public static final String SENSOR_DEFECT_STATE = "core:SensorDefectState";
|
||||
public static final String RADIO_PART_BATTERY_STATE = "io:MaintenanceRadioPartBatteryState";
|
||||
public static final String SENSOR_PART_BATTERY_STATE = "io:MaintenanceSensorPartBatteryState";
|
||||
public static final String ZWAVE_SET_POINT_TYPE_STATE = "zwave:SetPointTypeState";
|
||||
|
||||
// supported uiClasses
|
||||
public static final String CLASS_ROLLER_SHUTTER = "RollerShutter";
|
||||
@ -361,12 +375,12 @@ public class SomfyTahomaBindingConstants {
|
||||
THING_TYPE_EXTERIORSCREEN, THING_TYPE_EXTERIORVENETIANBLIND, THING_TYPE_GARAGEDOOR, THING_TYPE_AWNING,
|
||||
THING_TYPE_ACTIONGROUP, THING_TYPE_ONOFF, THING_TYPE_LIGHT, THING_TYPE_LIGHTSENSOR, THING_TYPE_SMOKESENSOR,
|
||||
THING_TYPE_CONTACTSENSOR, THING_TYPE_OCCUPANCYSENSOR, THING_TYPE_WINDOW, THING_TYPE_INTERNAL_ALARM,
|
||||
THING_TYPE_EXTERNAL_ALARM, THING_TYPE_POD, THING_TYPE_HEATING_SYSTEM, THING_TYPE_ONOFF_HEATING_SYSTEM,
|
||||
THING_TYPE_EXTERNAL_ALARM, THING_TYPE_POD, THING_TYPE_ZWAVE_HEATING_SYSTEM, THING_TYPE_ONOFF_HEATING_SYSTEM,
|
||||
THING_TYPE_DOOR_LOCK, THING_TYPE_PERGOLA, THING_TYPE_WINDOW_HANDLE, THING_TYPE_TEMPERATURESENSOR,
|
||||
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_WATERSENSOR, THING_TYPE_HUMIDITYSENSOR, THING_TYPE_MYFOX_ALARM, THING_TYPE_THERMOSTAT,
|
||||
THING_TYPE_DIMMER_LIGHT, THING_TYPE_EXTERIOR_HEATING_SYSTEM));
|
||||
THING_TYPE_DIMMER_LIGHT, THING_TYPE_EXTERIOR_HEATING_SYSTEM, THING_TYPE_VALVE_HEATING_SYSTEM));
|
||||
|
||||
// somfy gateways
|
||||
public static Map<Integer, String> gatewayTypes = new HashMap<Integer, String>() {
|
||||
|
@ -1,39 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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;
|
||||
|
||||
import org.eclipse.jdt.annotation.NonNullByDefault;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaException} represents an exception in the response of
|
||||
* the TahomaLink cloud service.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public SomfyTahomaException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public SomfyTahomaException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public SomfyTahomaException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
@ -108,8 +108,10 @@ public class SomfyTahomaHandlerFactory extends BaseThingHandlerFactory {
|
||||
return new SomfyTahomaExternalAlarmHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_POD)) {
|
||||
return new SomfyTahomaPodHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_HEATING_SYSTEM)) {
|
||||
return new SomfyTahomaHeatingSystemHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_VALVE_HEATING_SYSTEM)) {
|
||||
return new SomfyTahomaValveHeatingSystemHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ZWAVE_HEATING_SYSTEM)) {
|
||||
return new SomfyTahomaZwaveHeatingSystemHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_ONOFF_HEATING_SYSTEM)) {
|
||||
return new SomfyTahomaOnOffHeatingSystemHandler(thing);
|
||||
} else if (thingTypeUID.equals(THING_TYPE_EXTERIOR_HEATING_SYSTEM)) {
|
||||
|
@ -237,10 +237,14 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService
|
||||
case CLASS_HEATING_SYSTEM:
|
||||
if ("SomfyThermostat".equals(device.getWidget())) {
|
||||
deviceDiscovered(device, THING_TYPE_THERMOSTAT);
|
||||
} else if ("ValveHeatingTemperatureInterface".equals(device.getWidget())) {
|
||||
deviceDiscovered(device, THING_TYPE_VALVE_HEATING_SYSTEM);
|
||||
} else if (isOnOffHeatingSystem(device)) {
|
||||
deviceDiscovered(device, THING_TYPE_ONOFF_HEATING_SYSTEM);
|
||||
} else if (isZwaveHeatingSystem(device)) {
|
||||
deviceDiscovered(device, THING_TYPE_ZWAVE_HEATING_SYSTEM);
|
||||
} else {
|
||||
deviceDiscovered(device, THING_TYPE_HEATING_SYSTEM);
|
||||
logUnsupportedDevice(device);
|
||||
}
|
||||
break;
|
||||
case CLASS_EXTERIOR_HEATING_SYSTEM:
|
||||
@ -354,6 +358,10 @@ public class SomfyTahomaItemDiscoveryService extends AbstractDiscoveryService
|
||||
return hasCommmand(device, COMMAND_SET_HEATINGLEVEL);
|
||||
}
|
||||
|
||||
private boolean isZwaveHeatingSystem(SomfyTahomaDevice device) {
|
||||
return hasState(device, ZWAVE_SET_POINT_TYPE_STATE);
|
||||
}
|
||||
|
||||
private boolean hasCommmand(SomfyTahomaDevice device, String command) {
|
||||
return device.getDefinition().getCommands().stream().anyMatch(cmd -> command.equals(cmd.getCommandName()));
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public abstract class SomfyTahomaBaseThingHandler extends BaseThingHandler {
|
||||
return stateNames;
|
||||
}
|
||||
|
||||
private String url = "";
|
||||
protected String url = "";
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
@ -124,7 +124,7 @@ public abstract class SomfyTahomaBaseThingHandler extends BaseThingHandler {
|
||||
protected void sendCommand(String cmd, String param) {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
handler.sendCommand(url, cmd, param);
|
||||
handler.sendCommand(url, cmd, param, EXEC_URL + "apply");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,23 +556,23 @@ public class SomfyTahomaBridgeHandler extends BaseBridgeHandler {
|
||||
.timeout(TAHOMA_TIMEOUT, TimeUnit.SECONDS).agent(TAHOMA_AGENT);
|
||||
}
|
||||
|
||||
public void sendCommand(String io, String command, String params) {
|
||||
public void sendCommand(String io, String command, String params, String url) {
|
||||
if (ThingStatus.OFFLINE == thing.getStatus() && !reLogin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Boolean result = sendCommandInternal(io, command, params);
|
||||
Boolean result = sendCommandInternal(io, command, params, url);
|
||||
if (!result) {
|
||||
sendCommandInternal(io, command, params);
|
||||
sendCommandInternal(io, command, params, url);
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean sendCommandInternal(String io, String command, String params) {
|
||||
private Boolean sendCommandInternal(String io, String command, String params, String url) {
|
||||
String value = params.equals("[]") ? command : params.replace("\"", "");
|
||||
String urlParameters = "{\"label\":\"" + getThingLabelByURL(io) + " - " + value
|
||||
+ " - OH2\",\"actions\":[{\"deviceURL\":\"" + io + "\",\"commands\":[{\"name\":\"" + command
|
||||
+ "\",\"parameters\":" + params + "}]}]}";
|
||||
SomfyTahomaApplyResponse response = invokeCallToURL(EXEC_URL + "apply", urlParameters, HttpMethod.POST,
|
||||
SomfyTahomaApplyResponse response = invokeCallToURL(url, urlParameters, HttpMethod.POST,
|
||||
SomfyTahomaApplyResponse.class);
|
||||
if (response != null) {
|
||||
if (!response.getExecId().isEmpty()) {
|
||||
@ -699,6 +699,7 @@ public class SomfyTahomaBridgeHandler extends BaseBridgeHandler {
|
||||
break;
|
||||
case DELETE:
|
||||
response = sendDeleteToTahomaWithCookie(url);
|
||||
default:
|
||||
}
|
||||
return classOfT != null ? gson.fromJson(response, classOfT) : null;
|
||||
} catch (JsonSyntaxException e) {
|
||||
|
@ -32,6 +32,7 @@ public class SomfyTahomaGateHandler extends SomfyTahomaBaseThingHandler {
|
||||
public SomfyTahomaGateHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(GATE_STATE, "core:OpenClosedPedestrianState");
|
||||
stateNames.put(GATE_POSITION, "core:ClosureState");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -42,6 +43,8 @@ public class SomfyTahomaGateHandler extends SomfyTahomaBaseThingHandler {
|
||||
} else {
|
||||
if (GATE_COMMAND.equals(channelUID.getId())) {
|
||||
sendCommand(getGateCommand(command.toString().toLowerCase()));
|
||||
} else if (GATE_POSITION.equals(channelUID.getId())) {
|
||||
sendCommand(COMMAND_SET_CLOSURE, "[" + toInteger(command) + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,10 @@ 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 SomfyTahomaPodHandler} is responsible for handling commands,
|
||||
@ -32,4 +35,25 @@ public class SomfyTahomaPodHandler extends SomfyTahomaBaseThingHandler {
|
||||
stateNames.put(BATTERY_STATUS, BATTERY_STATUS_STATE);
|
||||
stateNames.put(LIGHTING_LED_POD_MODE, "internal:LightingLedPodModeState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (!LIGHTING_LED_POD_MODE.equals(channelUID.getId())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
sendPodCommand("setLightingLedPodMode", "[" + command + "]");
|
||||
}
|
||||
}
|
||||
|
||||
private void sendPodCommand(String cmd, String param) {
|
||||
SomfyTahomaBridgeHandler handler = getBridgeHandler();
|
||||
if (handler != null) {
|
||||
handler.sendCommand(url, cmd, param, EXEC_URL + "apply/internal");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,5 +33,6 @@ public class SomfyTahomaThermostatHandler extends SomfyTahomaBaseThingHandler {
|
||||
stateNames.put(HEATING_MODE, "somfythermostat:HeatingModeState");
|
||||
stateNames.put(DEROGATION_HEATING_MODE, "somfythermostat:DerogationHeatingModeState");
|
||||
stateNames.put(DEROGATION_ACTIVATION, "core:DerogationActivationState");
|
||||
stateNames.put(DEROGATED_TARGET_TEMPERATURE, "core:DerogatedTargetTemperatureState");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* Copyright (c) 2010-2020 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.library.types.QuantityType;
|
||||
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 SomfyTahomaValveHeatingSystemHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the valve heating system thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaValveHeatingSystemHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaValveHeatingSystemHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(TARGET_TEMPERATURE, TARGET_ROOM_TEMPERATURE_STATE);
|
||||
stateNames.put(BATTERY_LEVEL, BATTERY_LEVEL_STATE);
|
||||
stateNames.put(DEROGATION_HEATING_MODE, "io:DerogationHeatingModeState");
|
||||
stateNames.put(DEROGATED_TARGET_TEMPERATURE, "core:DerogatedTargetTemperatureState");
|
||||
stateNames.put(CURRENT_HEATING_MODE, "io:CurrentHeatingModeState");
|
||||
stateNames.put(OPEN_CLOSED_VALVE, "core:OpenClosedValveState");
|
||||
stateNames.put(OPERATING_MODE, "core:OperatingModeState");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleCommand(ChannelUID channelUID, Command command) {
|
||||
super.handleCommand(channelUID, command);
|
||||
if (command instanceof RefreshType) {
|
||||
return;
|
||||
} else {
|
||||
if (DEROGATED_TARGET_TEMPERATURE.equals(channelUID.getId()) && command instanceof QuantityType) {
|
||||
QuantityType type = (QuantityType) command;
|
||||
String param = "[" + type.doubleValue() + ", \"next_mode\"]";
|
||||
sendCommand(COMMAND_SET_DEROGATION, param);
|
||||
} else if (DEROGATION_HEATING_MODE.equals(channelUID.getId())) {
|
||||
switch (command.toString()) {
|
||||
case "auto":
|
||||
sendCommand("exitDerogation");
|
||||
break;
|
||||
case "away":
|
||||
case "comfort":
|
||||
case "eco":
|
||||
case "frostprotection":
|
||||
String param = "[\"" + command.toString() + "\", \"next_mode\"]";
|
||||
sendCommand(COMMAND_SET_DEROGATION, param);
|
||||
break;
|
||||
default:
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -21,20 +21,20 @@ import org.openhab.core.types.Command;
|
||||
import org.openhab.core.types.RefreshType;
|
||||
|
||||
/**
|
||||
* The {@link SomfyTahomaHeatingSystemHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the heating system thing.
|
||||
* The {@link SomfyTahomaZwaveHeatingSystemHandler} is responsible for handling commands,
|
||||
* which are sent to one of the channels of the z-wave heating system thing.
|
||||
*
|
||||
* @author Ondrej Pecta - Initial contribution
|
||||
*/
|
||||
@NonNullByDefault
|
||||
public class SomfyTahomaHeatingSystemHandler extends SomfyTahomaBaseThingHandler {
|
||||
public class SomfyTahomaZwaveHeatingSystemHandler extends SomfyTahomaBaseThingHandler {
|
||||
|
||||
public SomfyTahomaHeatingSystemHandler(Thing thing) {
|
||||
public SomfyTahomaZwaveHeatingSystemHandler(Thing thing) {
|
||||
super(thing);
|
||||
stateNames.put(TARGET_TEMPERATURE, TARGET_TEMPERATURE_STATE);
|
||||
stateNames.put(CURRENT_TEMPERATURE, "zwave:SetPointHeatingValueState");
|
||||
stateNames.put(BATTERY_LEVEL, BATTERY_LEVEL_STATE);
|
||||
stateNames.put(CURRENT_STATE, "zwave:SetPointTypeState");
|
||||
stateNames.put(CURRENT_STATE, ZWAVE_SET_POINT_TYPE_STATE);
|
||||
}
|
||||
|
||||
@Override
|
@ -190,6 +190,13 @@
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="gate_position">
|
||||
<item-type>Dimmer</item-type>
|
||||
<label>Position</label>
|
||||
<description>Position of the gate</description>
|
||||
<state max="100" min="0" step="1" pattern="%d %%" readOnly="false"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="open">
|
||||
<item-type>Switch</item-type>
|
||||
<label>Open/Close</label>
|
||||
@ -301,8 +308,17 @@
|
||||
<channel-type id="derogation_heating_mode">
|
||||
<item-type>String</item-type>
|
||||
<label>Derogation Heating Mode</label>
|
||||
<description>Derogation heating mode of the Somfy thermostat</description>
|
||||
<state readOnly="true"/>
|
||||
<description>Derogation heating mode of the Somfy thermostat/valve</description>
|
||||
<command>
|
||||
<options>
|
||||
<option value="auto">Program</option>
|
||||
<option value="away">Away</option>
|
||||
<option value="comfort">Home</option>
|
||||
<option value="frost protection">Frost protection</option>
|
||||
<option value="manual">Manual</option>
|
||||
<option value="eco">Night</option>
|
||||
</options>
|
||||
</command>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="derogation_activation">
|
||||
@ -352,4 +368,25 @@
|
||||
<description>The level of the heating</description>
|
||||
<state max="100" min="0" step="1" pattern="%d %%"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="current_heating_mode">
|
||||
<item-type>String</item-type>
|
||||
<label>Current Heating Mode</label>
|
||||
<description>Current heating mode of the Somfy thermostatic valve</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="open_closed_valve">
|
||||
<item-type>Contact</item-type>
|
||||
<label>Valve Open/Closed state</label>
|
||||
<description>Current open/closed state of the Somfy thermostatic valve</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
|
||||
<channel-type id="operating_mode">
|
||||
<item-type>String</item-type>
|
||||
<label>Operating mode</label>
|
||||
<description>Operating mode of the Somfy thermostatic valve</description>
|
||||
<state readOnly="true"/>
|
||||
</channel-type>
|
||||
</thing:thing-descriptions>
|
||||
|
@ -12,6 +12,7 @@
|
||||
<channels>
|
||||
<channel id="gate_state" typeId="gate_state"></channel>
|
||||
<channel id="gate_command" typeId="gate_command"></channel>
|
||||
<channel id="gate_position" typeId="gate_position"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
@ -8,7 +8,7 @@
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Heating System</label>
|
||||
<label>Z-Wave Heating System</label>
|
||||
<channels>
|
||||
<channel id="current_temperature" typeId="current_temperature"></channel>
|
||||
<channel id="current_state" typeId="current_state"></channel>
|
||||
|
@ -10,11 +10,12 @@
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Thermostat</label>
|
||||
<channels>
|
||||
<channel id="target_temperature" typeId="target_temperature"></channel>
|
||||
<channel id="target_temperature" typeId="temperature"></channel>
|
||||
<channel id="battery_level" typeId="system.battery-level"></channel>
|
||||
<channel id="heating_mode" typeId="heating_mode"></channel>
|
||||
<channel id="derogation_heating_mode" typeId="derogation_heating_mode"></channel>
|
||||
<channel id="derogation_activation" typeId="derogation_activation"></channel>
|
||||
<channel id="derogated_target_temperature" typeId="target_temperature"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
24
bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/thing/valveheatingsystem.xml
Normal file
24
bundles/org.openhab.binding.somfytahoma/src/main/resources/OH-INF/thing/valveheatingsystem.xml
Normal file
@ -0,0 +1,24 @@
|
||||
<?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="valveheatingsystem">
|
||||
<supported-bridge-type-refs>
|
||||
<bridge-type-ref id="bridge"/>
|
||||
</supported-bridge-type-refs>
|
||||
<label>Somfy Thermostatic Valve</label>
|
||||
<channels>
|
||||
<channel id="target_temperature" typeId="temperature"></channel>
|
||||
<channel id="battery_level" typeId="system.battery-level"></channel>
|
||||
<channel id="derogation_heating_mode" typeId="derogation_heating_mode"></channel>
|
||||
<channel id="derogated_target_temperature" typeId="target_temperature"></channel>
|
||||
<channel id="current_heating_mode" typeId="current_heating_mode"></channel>
|
||||
<channel id="open_closed_valve" typeId="open_closed_valve"></channel>
|
||||
<channel id="operating_mode" typeId="operating_mode"></channel>
|
||||
</channels>
|
||||
<config-description-ref uri="thing-type:somfytahoma:device"/>
|
||||
</thing-type>
|
||||
|
||||
</thing:thing-descriptions>
|
Loading…
x
Reference in New Issue
Block a user