Skip to content

Commit

Permalink
[openwebnet] rename thermoregulation's (WHO=4) things (openhab#10865)
Browse files Browse the repository at this point in the history
* - bus_thermostat renamed to bus_thermo_zone
- bus_temp_sensor renamed to bus_themo_sensor
- linked OWN4j 0.5.3-SNAPSHOT (camelCase for enums)

Signed-off-by: Conte Andrea <[email protected]>

* updated ReadMe according to things renaming

Signed-off-by: Conte Andrea <[email protected]>

* Updated readme and thermo thing labels. Renamed thing descriptors to BusThermoZone and BusThermoSensor

Signed-off-by: Massimo Valla <[email protected]>

* using own4j release 0.5.3

Signed-off-by: Conte Andrea <[email protected]>

* removed json tags in README. Added KG4691 to tested thermostats

Signed-off-by: Massimo Valla <[email protected]>

Co-authored-by: Massimo Valla <[email protected]>
  • Loading branch information
2 people authored and thinkingstone committed Nov 7, 2021
1 parent 9322421 commit 0ae5460
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 100 deletions.
107 changes: 69 additions & 38 deletions bundles/org.openhab.binding.openwebnet/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bundles/org.openhab.binding.openwebnet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<dependency>
<groupId>io.github.openwebnet4j</groupId>
<artifactId>openwebnet4j</artifactId>
<version>0.5.2</version>
<version>0.5.3</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public class OpenWebNetBindingConstants {
public static final String THING_LABEL_BUS_AUTOMATION = "Automation";
public static final ThingTypeUID THING_TYPE_BUS_ENERGY_METER = new ThingTypeUID(BINDING_ID, "bus_energy_meter");
public static final String THING_LABEL_BUS_ENERGY_METER = "Energy Meter";
public static final ThingTypeUID THING_TYPE_BUS_TEMP_SENSOR = new ThingTypeUID(BINDING_ID, "bus_temp_sensor");
public static final String THING_LABEL_BUS_TEMP_SENSOR = "Temperature Sensor";
public static final ThingTypeUID THING_TYPE_BUS_THERMOSTAT = new ThingTypeUID(BINDING_ID, "bus_thermostat");
public static final String THING_LABEL_BUS_THERMOSTAT = "Thermostat (stand-alone)";
public static final ThingTypeUID THING_TYPE_BUS_THERMO_SENSOR = new ThingTypeUID(BINDING_ID, "bus_thermo_sensor");
public static final String THING_LABEL_BUS_THERMO_SENSOR = "Thermo Sensor";
public static final ThingTypeUID THING_TYPE_BUS_THERMO_ZONE = new ThingTypeUID(BINDING_ID, "bus_thermo_zone");
public static final String THING_LABEL_BUS_THERMO_ZONE = "Thermo Zone";

// ZIGBEE
public static final ThingTypeUID THING_TYPE_ZB_ON_OFF_SWITCH = new ThingTypeUID(BINDING_ID, "zb_on_off_switch");
Expand All @@ -83,8 +83,8 @@ public class OpenWebNetBindingConstants {
THING_TYPE_BUS_AUTOMATION);

// ## Thermoregulation
public static final Set<ThingTypeUID> THERMOREGULATION_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_THERMOSTAT,
THING_TYPE_BUS_TEMP_SENSOR);
public static final Set<ThingTypeUID> THERMOREGULATION_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_THERMO_ZONE,
THING_TYPE_BUS_THERMO_SENSOR);

// ## Energy Management
public static final Set<ThingTypeUID> ENERGY_MANAGEMENT_SUPPORTED_THING_TYPES = Set.of(THING_TYPE_BUS_ENERGY_METER);
Expand Down Expand Up @@ -119,9 +119,9 @@ public class OpenWebNetBindingConstants {
public static final String CHANNEL_TEMP_SETPOINT = "setpointTemperature";
public static final String CHANNEL_MODE = "mode";
public static final String CHANNEL_FAN_SPEED = "speedFanCoil";
public static final String CHANNEL_CONDITIONING_VALVE = "conditioningValve";
public static final String CHANNEL_HEATING_VALVE = "heatingValve";
public static final String CHANNEL_ACTUATOR = "actuator";
public static final String CHANNEL_CONDITIONING_VALVES = "conditioningValves";
public static final String CHANNEL_HEATING_VALVES = "heatingValves";
public static final String CHANNEL_ACTUATORS = "actuators";

// energy management
public static final String CHANNEL_POWER = "power";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*/
package org.openhab.binding.openwebnet.handler;

import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.*;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.PROPERTY_FIRMWARE_VERSION;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.PROPERTY_SERIAL_NO;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.THING_TYPE_ZB_GATEWAY;

import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -312,12 +314,12 @@ private void discoverByActivation(BaseOpenMessage baseMsg) {
BaseOpenMessage bmsg = baseMsg;
if (baseMsg instanceof Lighting) {
What what = baseMsg.getWhat();
if (Lighting.WHAT.OFF.equals(what)) { // skipping OFF msg: cannot distinguish dimmer/switch
if (Lighting.WhatLighting.OFF.equals(what)) { // skipping OFF msg: cannot distinguish dimmer/switch
logger.debug("discoverByActivation: skipping OFF msg: cannot distinguish dimmer/switch");
return;
}
if (Lighting.WHAT.ON.equals(what)) { // if not already done just now, request light status to
// distinguish dimmer from switch
if (Lighting.WhatLighting.ON.equals(what)) { // if not already done just now, request light status to
// distinguish dimmer from switch
if (discoveringDevices.containsKey(ownIdFromMessage(baseMsg))) {
logger.debug(
"discoverByActivation: we just requested status for this device and it's ON -> it's a switch");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.openwebnet4j.communication.OWNException;
import org.openwebnet4j.message.BaseOpenMessage;
import org.openwebnet4j.message.EnergyManagement;
import org.openwebnet4j.message.EnergyManagement.DIM;
import org.openwebnet4j.message.FrameException;
import org.openwebnet4j.message.Where;
import org.openwebnet4j.message.WhereEnergyManagement;
Expand Down Expand Up @@ -182,7 +181,7 @@ protected void handleMessage(BaseOpenMessage msg) {
return;
} else {
// fix: check for correct DIM (ActivePower / 113)
if (msg.getDim().equals(DIM.ACTIVE_POWER)) {
if (msg.getDim().equals(EnergyManagement.DimEnergyMgmt.ACTIVE_POWER)) {
updateActivePower(msg);
} else {
logger.debug("handleMessage() Ignoring message {} because it's not related to active power value.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@
*/
package org.openhab.binding.openwebnet.handler;

import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.*;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.CHANNEL_BRIGHTNESS;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.CHANNEL_SWITCH;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.CHANNEL_SWITCH_01;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.CHANNEL_SWITCH_02;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.THING_TYPE_BUS_DIMMER;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.THING_TYPE_ZB_DIMMER;
import static org.openhab.binding.openwebnet.OpenWebNetBindingConstants.THING_TYPE_ZB_ON_OFF_SWITCH_2UNITS;

import java.util.Set;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -304,7 +310,7 @@ private synchronized void updateBrightness(Lighting msg) {
if (msg.getWhat() != null) {
updateBrightnessState(msg);
} else { // dimension notification
if (msg.getDim() == Lighting.DIM.DIMMER_LEVEL_100) {
if (msg.getDim() == Lighting.DimLighting.DIMMER_LEVEL_100) {
int newBrightness;
try {
newBrightness = msg.parseDimmerLevel100();
Expand Down Expand Up @@ -336,8 +342,8 @@ private synchronized void updateBrightness(Lighting msg) {
private void updateBrightnessState(Lighting msg) {
What w = msg.getWhat();
if (w != null) {
if (Lighting.WHAT.ON.equals(w)) {
w = Lighting.WHAT.DIMMER_LEVEL_2; // levels start at 2
if (Lighting.WhatLighting.ON.equals(w)) {
w = Lighting.WhatLighting.DIMMER_LEVEL_2; // levels start at 2
}
int newBrightnessWhat = w.value();
int brightnessWhat = UNKNOWN_STATE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
import org.slf4j.LoggerFactory;

/**
* The {@link OpenWebNetThermoregulationHandler} is responsible for handling commands/messages for a Thermoregulation
* OpenWebNet device. It extends the abstract {@link OpenWebNetThingHandler}.
* The {@link OpenWebNetThermoregulationHandler} is responsible for handling commands/messages for Thermoregulation
* Things. It extends the abstract {@link OpenWebNetThingHandler}.
*
* @author Massimo Valla - Initial contribution
* @author Andrea Conte - Thermoregulation
Expand All @@ -55,7 +55,7 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {

public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES = OpenWebNetBindingConstants.THERMOREGULATION_SUPPORTED_THING_TYPES;

private boolean isTempSensor = false; // is the device a sensor or thermostat?
private boolean isTempSensor = false; // is the thing a sensor ?

private double currentSetPointTemp = 11.5d; // 11.5 is the default setTemp used in MyHomeUP mobile app

Expand Down Expand Up @@ -293,25 +293,25 @@ private void updateValveStatus(Thermoregulation tmsg) {
try {
Thermoregulation.ValveOrActuatorStatus cv = Thermoregulation.parseValveStatus(tmsg,
Thermoregulation.WhatThermo.CONDITIONING);
updateState(CHANNEL_CONDITIONING_VALVE, new StringType(cv.toString()));
updateState(CHANNEL_CONDITIONING_VALVES, new StringType(cv.toString()));

Thermoregulation.ValveOrActuatorStatus hv = Thermoregulation.parseValveStatus(tmsg,
Thermoregulation.WhatThermo.HEATING);
updateState(CHANNEL_HEATING_VALVE, new StringType(hv.toString()));
updateState(CHANNEL_HEATING_VALVES, new StringType(hv.toString()));
} catch (FrameException e) {
logger.warn("updateValveStatus() FrameException on frame {}: {}", tmsg, e.getMessage());
updateState(CHANNEL_CONDITIONING_VALVE, UnDefType.UNDEF);
updateState(CHANNEL_HEATING_VALVE, UnDefType.UNDEF);
updateState(CHANNEL_CONDITIONING_VALVES, UnDefType.UNDEF);
updateState(CHANNEL_HEATING_VALVES, UnDefType.UNDEF);
}
}

private void updateActuatorStatus(Thermoregulation tmsg) {
try {
Thermoregulation.ValveOrActuatorStatus hv = Thermoregulation.parseActuatorStatus(tmsg);
updateState(CHANNEL_ACTUATOR, new StringType(hv.toString()));
updateState(CHANNEL_ACTUATORS, new StringType(hv.toString()));
} catch (FrameException e) {
logger.warn("updateActuatorStatus() FrameException on frame {}: {}", tmsg, e.getMessage());
updateState(CHANNEL_ACTUATOR, UnDefType.UNDEF);
updateState(CHANNEL_ACTUATORS, UnDefType.UNDEF);
}
}

Expand All @@ -322,12 +322,12 @@ protected void refreshDevice(boolean refreshAll) {
try {
send(Thermoregulation.requestTemperature(w));
if (!this.isTempSensor) {
// for bus_thermostat request also other single channels updates
// for bus_thermo_zone request also other single channels updates
send(Thermoregulation.requestSetPointTemperature(w));
send(Thermoregulation.requestFanCoilSpeed(w));
send(Thermoregulation.requestMode(w));
send(Thermoregulation.requestValveStatus(w));
send(Thermoregulation.requestActuatorStatus(w));
send(Thermoregulation.requestValvesStatus(w));
send(Thermoregulation.requestActuatorsStatus(w));
}
} catch (OWNException e) {
logger.warn("refreshDevice() where='{}' returned OWNException {}", w, e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ public void newDiscoveryResult(Where where, OpenDeviceType deviceType, @Nullable
deviceWho = Who.AUTOMATION;
break;
}
case SCS_TEMP_SENSOR: {
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_TEMP_SENSOR;
thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_TEMP_SENSOR;
case SCS_THERMO_SENSOR: {
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_SENSOR;
thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_THERMO_SENSOR;
deviceWho = Who.THERMOREGULATION;
break;
}
case SCS_THERMOSTAT: {
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_THERMOSTAT;
thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_THERMOSTAT;
case SCS_THERMO_ZONE: {
thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_ZONE;
thingLabel = OpenWebNetBindingConstants.THING_LABEL_BUS_THERMO_ZONE;
deviceWho = Who.THERMOREGULATION;
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
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 for BUS Temperature Sensor -->
<thing-type id="bus_temp_sensor">
<!-- Thing for BUS Thermo Sensor -->
<thing-type id="bus_thermo_sensor">
<supported-bridge-type-refs>
<bridge-type-ref id="bus_gateway"/>
</supported-bridge-type-refs>
<label>Temperature Sensor</label>
<description>A OpenWebNet BUS/SCS temperature sensor. BTicino models: L/N/NT4577 etc.</description>
<label>Thermo Sensor</label>
<description>A OpenWebNet BUS/SCS thermo sensor (probe) for measuring temperature in a zone. BTicino models:
L/N/NT4577 etc.</description>

<channels>
<channel id="temperature" typeId="temperature"/>
Expand All @@ -27,7 +28,7 @@
<config-description>
<parameter name="where" type="text" required="true">
<label>OpenWebNet Device Address</label>
<description>Example: Zone 2 --> where=2. For external sensors: sensor 5 --> where=500</description>
<description>Example: sensor 3 of zone 2 --> where=302. Sensor 5 of external zone 00 --> where=500</description>
</parameter>
</config-description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
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 for BUS Thermostat (BTicino xxx/xxx/...) -->
<thing-type id="bus_thermostat">
<!-- Thing for BUS Thermo Zone -->
<thing-type id="bus_thermo_zone">
<supported-bridge-type-refs>
<bridge-type-ref id="bus_gateway"/>
</supported-bridge-type-refs>

<label>Thermostat (stand-alone)</label>
<description>A OpenWebNet BUS/SCS zone stand-alone thermostat. BTicino models: LN4691.</description>
<label>Thermo Zone</label>
<description>A OpenWebNet BUS/SCS configured thermo zone (managed via Central Unit or stand alone).</description>

<channels>
<!-- read only -->
<channel id="temperature" typeId="temperature"/>
<channel id="conditioningValve" typeId="conditioningValve"/>
<channel id="heatingValve" typeId="heatingValve"/>
<channel id="actuator" typeId="actuator"/>
<channel id="conditioningValves" typeId="conditioningValves"/>
<channel id="heatingValves" typeId="heatingValves"/>
<channel id="actuators" typeId="actuators"/>
<!-- read/write -->
<channel id="setpointTemperature" typeId="setpointTemperature"/>
<channel id="function" typeId="function"/>
Expand All @@ -28,16 +28,22 @@

<properties>
<property name="vendor">BTicino/Legrand</property>
<property name="model">BTI-LN4691</property>
<property name="ownDeviceType">410/420/430</property>
<property name="model">Zone thermostat BTI-LN4691 (stand-alone), 3550 (99 zones Central Unit)</property>
<property name="ownDeviceType">410/420</property>
</properties>

<representation-property>ownId</representation-property>

<config-description>
<parameter name="where" type="text" required="true">
<label>OpenWebNet Device Address</label>
<description>Example: Zone 2 --> where=2.</description>
<description>Example: zone 2 --> where=2.</description>
</parameter>

<parameter name="standAlone" type="boolean">
<label>Stand-alone</label>
<description>Distinguishes between a zone managed by a Central Unit (false) or stand-alone (true, default)</description>
<default>true</default>
</parameter>
</config-description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@
</state>
</channel-type>

<channel-type id="conditioningValve" advanced="true">
<channel-type id="conditioningValves" advanced="true">
<item-type>String</item-type>
<label>Conditioning Valve</label>
<description>Conditioning Valve status (read only)</description>
<label>Conditioning Valves</label>
<description>Conditioning Valves status (read only)</description>
<state readOnly="true">
<options>
<option value="OFF">OFF</option>
Expand All @@ -122,10 +122,10 @@
</state>
</channel-type>

<channel-type id="heatingValve" advanced="true">
<channel-type id="heatingValves" advanced="true">
<item-type>String</item-type>
<label>Heating Valve</label>
<description>Heating Valve status (read only)</description>
<label>Heating Valves</label>
<description>Heating Valves status (read only)</description>
<state readOnly="true">
<options>
<option value="OFF">OFF</option>
Expand All @@ -144,10 +144,10 @@
</state>
</channel-type>

<channel-type id="actuator" advanced="true">
<channel-type id="actuators" advanced="true">
<item-type>String</item-type>
<label>Actuator Status</label>
<description>Actuator status (read only)</description>
<label>Actuators Status</label>
<description>Actuators status (read only)</description>
<state readOnly="true">
<options>
<option value="OFF">OFF</option>
Expand Down

0 comments on commit 0ae5460

Please sign in to comment.