Skip to content

Commit

Permalink
[openwebnet] Thermo: new channels and README updates (openhab#16652)
Browse files Browse the repository at this point in the history
* [openwebnet] added new channels: targetTemperature, heating and cooling to bus_thermo_zone
Fixes openhab#12019
* [openwebnet] cleaner code in updateModeAndFunction() to handle *4*1*w## messages
* [openwebnet] Updated README. Added new device images

---------

Signed-off-by: Massimo Valla <[email protected]>
  • Loading branch information
mvalla authored and matchews committed Oct 18, 2024
1 parent e6b2817 commit a7d0ad1
Show file tree
Hide file tree
Showing 10 changed files with 171 additions and 72 deletions.
89 changes: 47 additions & 42 deletions bundles/org.openhab.binding.openwebnet/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,20 @@ public class OpenWebNetBindingConstants {
public static final String CHANNEL_TEMPERATURE = "temperature";
public static final String CHANNEL_FUNCTION = "function";
public static final String CHANNEL_TEMP_SETPOINT = "setpointTemperature";
public static final String CHANNEL_TEMP_TARGET = "targetTemperature";
public static final String CHANNEL_MODE = "mode";
public static final String CHANNEL_FAN_SPEED = "speedFanCoil";
public static final String CHANNEL_CONDITIONING_VALVES = "conditioningValves";
public static final String CHANNEL_HEATING_VALVES = "heatingValves";
public static final String CHANNEL_HEATING = "heating";
public static final String CHANNEL_COOLING = "cooling";
public static final String CHANNEL_ACTUATORS = "actuators";
public static final String CHANNEL_LOCAL_OFFSET = "localOffset";
public static final String CHANNEL_CU_REMOTE_CONTROL = "remoteControl";
public static final String CHANNEL_CU_BATTERY_STATUS = "batteryStatus";
public static final String CHANNEL_CU_WEEKLY_PROGRAM_NUMBER = "weeklyProgram";
public static final String CHANNEL_CU_SCENARIO_PROGRAM_NUMBER = "scenarioProgram";
public static final String CHANNEL_CU_VACATION_DAYS = "vacationDays";

public static final String CHANNEL_CU_FAILURE_DISCOVERED = "failureDiscovered";
public static final String CHANNEL_CU_AT_LEAST_ONE_PROBE_OFF = "atLeastOneProbeOff";
public static final String CHANNEL_CU_AT_LEAST_ONE_PROBE_PROTECTION = "atLeastOneProbeProtection";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {

private double currentSetPointTemp = 20.0d;

private Thermoregulation.@Nullable Function currentFunction = Function.HEATING;
private Thermoregulation.@Nullable OperationMode currentMode = OperationMode.PROTECTION;
private Thermoregulation.@Nullable Function currentFunction = null;
private Thermoregulation.@Nullable OperationMode currentMode = null;
private int currentWeeklyPrgNum = 1;
private int currentScenarioPrgNum = 1;
private int currentVacationDays = 1;
Expand Down Expand Up @@ -483,6 +483,7 @@ protected void handleMessage(BaseOpenMessage msg) {
updateSetpoint(tmsg);
break;
case COMPLETE_PROBE_STATUS:
updateTargetTemperature(tmsg);
break;
case PROBE_TEMPERATURE:
case TEMPERATURE:
Expand Down Expand Up @@ -514,31 +515,33 @@ private void updateModeAndFunction(Thermoregulation tmsg) {
return;
}
Thermoregulation.WhatThermo what = tmsg.new WhatThermo(tmsg.getWhat().value());
if (what.getMode() == null) {
logger.warn("updateModeAndFunction() Could not parse Mode from: {}", tmsg.getFrameValue());
return;
}

if (what.getFunction() == null) {
logger.warn("updateModeAndFunction() Could not parse Function from: {}", tmsg.getFrameValue());
return;
}

// update Function if it's not GENERIC
Thermoregulation.Function function = what.getFunction();
if (function != Function.GENERIC) {
updateState(CHANNEL_FUNCTION, new StringType(function.toString()));
currentFunction = function;
if (currentFunction != function) {
updateState(CHANNEL_FUNCTION, new StringType(function.toString()));
currentFunction = function;
}
}
if (what.getType() == WhatThermoType.HEATING || what.getType() == WhatThermoType.CONDITIONING
|| what.getType() == WhatThermoType.GENERIC) {
// *4*1*z## and *4*0*z## do not tell us which mode is the zone now, so let's
// skip
return;
}

// then update Mode
// update Mode
Thermoregulation.OperationMode operationMode = null;
if (what.getType() != WhatThermoType.HEATING && what.getType() != WhatThermoType.CONDITIONING) {
// *4*1*z## and *4*0*z## do not tell us which mode is the zone now
operationMode = what.getMode();
}

// set ProgramNumber/vacationDays channels when necessary
operationMode = what.getMode();

if (operationMode != null) {
// set ProgramNumber/vacationDays channels when necessary
switch (operationMode) {
case VACATION:
updateVacationDays(tmsg);
Expand All @@ -556,11 +559,13 @@ private void updateModeAndFunction(Thermoregulation tmsg) {
getThing().getUID(), tmsg.getFrameValue());
return;
} else {
updateState(CHANNEL_MODE, new StringType(operationMode.name()));
currentMode = operationMode;
if (currentMode != operationMode) {
updateState(CHANNEL_MODE, new StringType(operationMode.name()));
currentMode = operationMode;
}
}
} else {
logger.debug("updateModeAndFunction() Unrecognized mode from message: {}", tmsg.getFrameValue());
logger.warn("updateModeAndFunction() Unrecognized mode from message: {}", tmsg.getFrameValue());
}
}

Expand Down Expand Up @@ -604,6 +609,16 @@ private void updateTemperature(Thermoregulation tmsg) {
}
}

private void updateTargetTemperature(Thermoregulation tmsg) {
try {
double temp = Thermoregulation.parseTemperature(tmsg);
updateState(CHANNEL_TEMP_TARGET, getAsQuantityTypeOrNull(temp, SIUnits.CELSIUS));
} catch (FrameException e) {
logger.warn("updateTargetTemperature() FrameException on frame {}: {}", tmsg, e.getMessage());
updateState(CHANNEL_TEMP_TARGET, UnDefType.UNDEF);
}
}

private void updateSetpoint(Thermoregulation tmsg) {
try {
double newTemp = -1;
Expand Down Expand Up @@ -654,17 +669,49 @@ private void updateValveStatus(Thermoregulation tmsg) {
Thermoregulation.ValveOrActuatorStatus cv = Thermoregulation.parseValveStatus(tmsg,
Thermoregulation.WhatThermoType.CONDITIONING);
updateState(CHANNEL_CONDITIONING_VALVES, new StringType(cv.toString()));
updateHeatingCooling(false, cv);

Thermoregulation.ValveOrActuatorStatus hv = Thermoregulation.parseValveStatus(tmsg,
Thermoregulation.WhatThermoType.HEATING);
updateState(CHANNEL_HEATING_VALVES, new StringType(hv.toString()));
updateHeatingCooling(true, hv);

} catch (FrameException e) {
logger.warn("updateValveStatus() FrameException on frame {}: {}", tmsg, e.getMessage());
updateState(CHANNEL_CONDITIONING_VALVES, UnDefType.UNDEF);
updateState(CHANNEL_HEATING_VALVES, UnDefType.UNDEF);
}
}

private void updateHeatingCooling(boolean heating, Thermoregulation.ValveOrActuatorStatus v) {
boolean state = false;
switch (v) {
case STOP:
case CLOSED:
case OFF:
case OFF_FAN_COIL:
case OFF_SPEED_1:
case OFF_SPEED_2:
case OFF_SPEED_3:
state = false;
break;
case ON:
case ON_FAN_COIL:
case ON_SPEED_1:
case ON_SPEED_2:
case ON_SPEED_3:
case OPENED:
state = true;
break;
}

if (heating) {
updateState(CHANNEL_HEATING, OnOffType.from(state));
} else {
updateState(CHANNEL_COOLING, OnOffType.from(state));
}
}

private void updateActuatorStatus(Thermoregulation tmsg) {
try {
Thermoregulation.ValveOrActuatorStatus hv = Thermoregulation.parseActuatorStatus(tmsg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ channel-type.openwebnet.atLeastOneProbeManual.description = At least one probe i
channel-type.openwebnet.atLeastOneProbeOff.label = At least one probe OFF
channel-type.openwebnet.atLeastOneProbeOff.description = At least one probe in OFF mode indicator from Central Unit (read only)
channel-type.openwebnet.atLeastOneProbeProtection.label = At least one probe in PROTECTION
channel-type.openwebnet.atLeastOneProbeProtection.description = At least one probe in PROTECTION mode (Antifreeze / Heat Protection) indicator from Central Unit (read only)
channel-type.openwebnet.atLeastOneProbeProtection.description = At least one probe in PROTECTION mode (Anti-freeze / Heat Protection) indicator from Central Unit (read only)
channel-type.openwebnet.aux.label = Auxiliary
channel-type.openwebnet.aux.description = Controls an Auxiliary command (read/write)
channel-type.openwebnet.aux.state.option.OFF = Off
Expand Down Expand Up @@ -185,6 +185,8 @@ channel-type.openwebnet.conditioningValves.state.option.ON_SPEED_3 = On speed 3
channel-type.openwebnet.conditioningValves.state.option.OFF_SPEED_1 = Off speed 1
channel-type.openwebnet.conditioningValves.state.option.OFF_SPEED_2 = Off speed 2
channel-type.openwebnet.conditioningValves.state.option.OFF_SPEED_3 = Off speed 3
channel-type.openwebnet.cooling.label = Cooling Active
channel-type.openwebnet.cooling.description = Cooling is active in the zone (read only)
channel-type.openwebnet.dryContactIR.label = Sensor
channel-type.openwebnet.dryContactIR.description = Dry Contact Interface or IR Interface sensor movement (read only)
channel-type.openwebnet.energyThisMonth.label = Energy This Month
Expand All @@ -202,6 +204,8 @@ channel-type.openwebnet.functionCentralUnit.label = Thermo Function
channel-type.openwebnet.functionCentralUnit.description = Thermo function of the Central Unit (read only)
channel-type.openwebnet.functionCentralUnit.state.option.HEATING = Winter
channel-type.openwebnet.functionCentralUnit.state.option.COOLING = Summer
channel-type.openwebnet.heating.label = Heating Active
channel-type.openwebnet.heating.description = Heating is active in the zone (read only)
channel-type.openwebnet.heatingValves.label = Heating Valves
channel-type.openwebnet.heatingValves.description = Heating Valves status (read only)
channel-type.openwebnet.heatingValves.state.option.OFF = Off
Expand All @@ -219,7 +223,7 @@ channel-type.openwebnet.heatingValves.state.option.OFF_SPEED_3 = Off speed 3
channel-type.openwebnet.localOffset.label = Local Offset
channel-type.openwebnet.localOffset.description = Local knob status (read only)
channel-type.openwebnet.localOffset.state.option.OFF = Off
channel-type.openwebnet.localOffset.state.option.PROTECTION = Antifreeze / Heat Protection
channel-type.openwebnet.localOffset.state.option.PROTECTION = Anti-freeze / Heat Protection
channel-type.openwebnet.localOffset.state.option.PLUS_3 = +3
channel-type.openwebnet.localOffset.state.option.PLUS_2 = +2
channel-type.openwebnet.localOffset.state.option.PLUS_1 = +1
Expand All @@ -231,14 +235,14 @@ channel-type.openwebnet.mode.label = Mode
channel-type.openwebnet.mode.description = The zone operation mode (read/write)
channel-type.openwebnet.mode.state.option.AUTO = Automatic
channel-type.openwebnet.mode.state.option.MANUAL = Manual
channel-type.openwebnet.mode.state.option.PROTECTION = Antifreeze / Heat Protection
channel-type.openwebnet.mode.state.option.PROTECTION = Anti-freeze / Heat Protection
channel-type.openwebnet.mode.state.option.OFF = Off
channel-type.openwebnet.modeCentralUnit.label = Central Unit Mode
channel-type.openwebnet.modeCentralUnit.description = The Central Unit operation mode (read/write)
channel-type.openwebnet.modeCentralUnit.state.option.WEEKLY = Weekly
channel-type.openwebnet.modeCentralUnit.state.option.SCENARIO = Scenarios
channel-type.openwebnet.modeCentralUnit.state.option.MANUAL = Manual
channel-type.openwebnet.modeCentralUnit.state.option.PROTECTION = Antifreeze / Heat Protection
channel-type.openwebnet.modeCentralUnit.state.option.PROTECTION = Anti-freeze / Heat Protection
channel-type.openwebnet.modeCentralUnit.state.option.OFF = Off
channel-type.openwebnet.modeCentralUnit.state.option.HOLIDAY = Holiday
channel-type.openwebnet.modeCentralUnit.state.option.VACATION = Vacation
Expand Down Expand Up @@ -281,10 +285,12 @@ channel-type.openwebnet.speedFanCoil.state.option.SPEED_2 = Fan speed 2
channel-type.openwebnet.speedFanCoil.state.option.SPEED_3 = Fan speed 3
channel-type.openwebnet.switch.label = Switch
channel-type.openwebnet.switch.description = Switch the power ON and OFF
channel-type.openwebnet.targetTemperature.label = Target Temperature
channel-type.openwebnet.targetTemperature.description = Target temperature (read only)
channel-type.openwebnet.temperature.label = Temperature
channel-type.openwebnet.temperature.description = Current temperature (read only)
channel-type.openwebnet.vacationDays.label = Vacation Days
channel-type.openwebnet.vacationDays.description = Number of days the Central Unit will be set to Antifreeze / Heat Protection target temperature before returning to mode WEEKLY (read/write)
channel-type.openwebnet.vacationDays.description = Number of days the Central Unit will be set to Anti-freeze / Heat Protection target temperature before returning to mode WEEKLY (read/write)
channel-type.openwebnet.weeklyProgramCentralUnit.label = Weekly Program Number
channel-type.openwebnet.weeklyProgramCentralUnit.description = Set weekly program number for the Central Unit, valid only with Central Unit mode = "WEEKLY" (read/write)
channel-type.openwebnet.weeklyProgramCentralUnit.state.option.1 = Weekly Program 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@
<channels>
<!-- read only -->
<channel id="temperature" typeId="temperature"/>
<channel id="conditioningValves" typeId="conditioningValves"/>
<channel id="targetTemperature" typeId="targetTemperature"/>
<channel id="heatingValves" typeId="heatingValves"/>
<channel id="conditioningValves" typeId="conditioningValves"/>
<channel id="heating" typeId="heating"/>
<channel id="cooling" typeId="cooling"/>
<channel id="actuators" typeId="actuators"/>
<channel id="localOffset" typeId="localOffset"/>
<!-- read/write -->
Expand All @@ -31,6 +34,7 @@
<property name="vendor">BTicino/Legrand</property>
<property name="model">Zone thermostat BTI-LN4691 (stand-alone), 3550 (99 zones Central Unit)</property>
<property name="ownDeviceType">410/420</property>
<property name="thingTypeVersion">1</property>
</properties>

<representation-property>ownId</representation-property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@
<state pattern="%.1f %unit%" step="0.5"/>
</channel-type>

<channel-type id="targetTemperature" advanced="true">
<item-type>Number:Temperature</item-type>
<label>Target Temperature</label>
<description>Target temperature (read only)</description>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>

<channel-type id="mode">
<item-type>String</item-type>
<label>Mode</label>
Expand All @@ -121,7 +128,7 @@
<options>
<option value="AUTO">Automatic</option>
<option value="MANUAL">Manual</option>
<option value="PROTECTION">Antifreeze / Heat Protection</option>
<option value="PROTECTION">Anti-freeze / Heat Protection</option>
<option value="OFF">Off</option>
</options>
</state>
Expand Down Expand Up @@ -186,6 +193,20 @@
</state>
</channel-type>

<channel-type id="heating" advanced="true">
<item-type>Switch</item-type>
<label>Heating Active</label>
<description>Heating is active in the zone (read only)</description>
<state readOnly="true"/>
</channel-type>

<channel-type id="cooling" advanced="true">
<item-type>Switch</item-type>
<label>Cooling Active</label>
<description>Cooling is active in the zone (read only)</description>
<state readOnly="true"/>
</channel-type>

<channel-type id="actuators" advanced="true">
<item-type>String</item-type>
<label>Actuators Status</label>
Expand Down Expand Up @@ -215,7 +236,7 @@
<state readOnly="true">
<options>
<option value="OFF">Off</option>
<option value="PROTECTION">Antifreeze / Heat Protection</option>
<option value="PROTECTION">Anti-freeze / Heat Protection</option>
<option value="PLUS_3">+3</option>
<option value="PLUS_2">+2</option>
<option value="PLUS_1">+1</option>
Expand All @@ -236,7 +257,7 @@
<option value="WEEKLY">Weekly</option>
<option value="SCENARIO">Scenarios</option>
<option value="MANUAL">Manual</option>
<option value="PROTECTION">Antifreeze / Heat Protection</option>
<option value="PROTECTION">Anti-freeze / Heat Protection</option>
<option value="OFF">Off</option>
<option value="HOLIDAY">Holiday</option>
<option value="VACATION">Vacation</option>
Expand Down Expand Up @@ -287,7 +308,7 @@
<channel-type id="vacationDays">
<item-type>Number</item-type>
<label>Vacation Days</label>
<description>Number of days the Central Unit will be set to Antifreeze / Heat Protection target temperature before
<description>Number of days the Central Unit will be set to Anti-freeze / Heat Protection target temperature before
returning to mode WEEKLY (read/write)</description>
</channel-type>

Expand Down Expand Up @@ -332,7 +353,7 @@
<channel-type id="atLeastOneProbeProtection" advanced="true">
<item-type>Switch</item-type>
<label>At least one probe in PROTECTION</label>
<description>At least one probe in PROTECTION mode (Antifreeze / Heat Protection) indicator from Central Unit (read
<description>At least one probe in PROTECTION mode (Anti-freeze / Heat Protection) indicator from Central Unit (read
only)</description>
<state readOnly="true"></state>
</channel-type>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,18 @@
</instruction-set>
</thing-type>

<thing-type uid="openwebnet:bus_thermo_zone">
<instruction-set targetVersion="1">
<add-channel id="targetTemperature">
<type>openwebnet:targetTemperature</type>
</add-channel>
<add-channel id="heating">
<type>openwebnet:heating</type>
</add-channel>
<add-channel id="cooling">
<type>openwebnet:cooling</type>
</add-channel>
</instruction-set>
</thing-type>

</update:update-descriptions>

0 comments on commit a7d0ad1

Please sign in to comment.