Skip to content

Commit 342b7b8

Browse files
authored
[openwebnet] Thermo: new channels and README updates (openhab#16652)
* [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]>
1 parent e97c080 commit 342b7b8

File tree

10 files changed

+171
-72
lines changed

10 files changed

+171
-72
lines changed

bundles/org.openhab.binding.openwebnet/README.md

+47-42
Large diffs are not rendered by default.
Loading
Loading
Binary file not shown.

bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/OpenWebNetBindingConstants.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,20 @@ public class OpenWebNetBindingConstants {
141141
public static final String CHANNEL_TEMPERATURE = "temperature";
142142
public static final String CHANNEL_FUNCTION = "function";
143143
public static final String CHANNEL_TEMP_SETPOINT = "setpointTemperature";
144+
public static final String CHANNEL_TEMP_TARGET = "targetTemperature";
144145
public static final String CHANNEL_MODE = "mode";
145146
public static final String CHANNEL_FAN_SPEED = "speedFanCoil";
146147
public static final String CHANNEL_CONDITIONING_VALVES = "conditioningValves";
147148
public static final String CHANNEL_HEATING_VALVES = "heatingValves";
149+
public static final String CHANNEL_HEATING = "heating";
150+
public static final String CHANNEL_COOLING = "cooling";
148151
public static final String CHANNEL_ACTUATORS = "actuators";
149152
public static final String CHANNEL_LOCAL_OFFSET = "localOffset";
150153
public static final String CHANNEL_CU_REMOTE_CONTROL = "remoteControl";
151154
public static final String CHANNEL_CU_BATTERY_STATUS = "batteryStatus";
152155
public static final String CHANNEL_CU_WEEKLY_PROGRAM_NUMBER = "weeklyProgram";
153156
public static final String CHANNEL_CU_SCENARIO_PROGRAM_NUMBER = "scenarioProgram";
154157
public static final String CHANNEL_CU_VACATION_DAYS = "vacationDays";
155-
156158
public static final String CHANNEL_CU_FAILURE_DISCOVERED = "failureDiscovered";
157159
public static final String CHANNEL_CU_AT_LEAST_ONE_PROBE_OFF = "atLeastOneProbeOff";
158160
public static final String CHANNEL_CU_AT_LEAST_ONE_PROBE_PROTECTION = "atLeastOneProbeProtection";

bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/handler/OpenWebNetThermoregulationHandler.java

+65-18
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public class OpenWebNetThermoregulationHandler extends OpenWebNetThingHandler {
7070

7171
private double currentSetPointTemp = 20.0d;
7272

73-
private Thermoregulation.@Nullable Function currentFunction = Function.HEATING;
74-
private Thermoregulation.@Nullable OperationMode currentMode = OperationMode.PROTECTION;
73+
private Thermoregulation.@Nullable Function currentFunction = null;
74+
private Thermoregulation.@Nullable OperationMode currentMode = null;
7575
private int currentWeeklyPrgNum = 1;
7676
private int currentScenarioPrgNum = 1;
7777
private int currentVacationDays = 1;
@@ -483,6 +483,7 @@ protected void handleMessage(BaseOpenMessage msg) {
483483
updateSetpoint(tmsg);
484484
break;
485485
case COMPLETE_PROBE_STATUS:
486+
updateTargetTemperature(tmsg);
486487
break;
487488
case PROBE_TEMPERATURE:
488489
case TEMPERATURE:
@@ -514,31 +515,33 @@ private void updateModeAndFunction(Thermoregulation tmsg) {
514515
return;
515516
}
516517
Thermoregulation.WhatThermo what = tmsg.new WhatThermo(tmsg.getWhat().value());
517-
if (what.getMode() == null) {
518-
logger.warn("updateModeAndFunction() Could not parse Mode from: {}", tmsg.getFrameValue());
519-
return;
520-
}
518+
521519
if (what.getFunction() == null) {
522520
logger.warn("updateModeAndFunction() Could not parse Function from: {}", tmsg.getFrameValue());
523521
return;
524522
}
525-
526523
// update Function if it's not GENERIC
527524
Thermoregulation.Function function = what.getFunction();
528525
if (function != Function.GENERIC) {
529-
updateState(CHANNEL_FUNCTION, new StringType(function.toString()));
530-
currentFunction = function;
526+
if (currentFunction != function) {
527+
updateState(CHANNEL_FUNCTION, new StringType(function.toString()));
528+
currentFunction = function;
529+
}
530+
}
531+
if (what.getType() == WhatThermoType.HEATING || what.getType() == WhatThermoType.CONDITIONING
532+
|| what.getType() == WhatThermoType.GENERIC) {
533+
// *4*1*z## and *4*0*z## do not tell us which mode is the zone now, so let's
534+
// skip
535+
return;
531536
}
532537

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

540-
// set ProgramNumber/vacationDays channels when necessary
541+
operationMode = what.getMode();
542+
541543
if (operationMode != null) {
544+
// set ProgramNumber/vacationDays channels when necessary
542545
switch (operationMode) {
543546
case VACATION:
544547
updateVacationDays(tmsg);
@@ -556,11 +559,13 @@ private void updateModeAndFunction(Thermoregulation tmsg) {
556559
getThing().getUID(), tmsg.getFrameValue());
557560
return;
558561
} else {
559-
updateState(CHANNEL_MODE, new StringType(operationMode.name()));
560-
currentMode = operationMode;
562+
if (currentMode != operationMode) {
563+
updateState(CHANNEL_MODE, new StringType(operationMode.name()));
564+
currentMode = operationMode;
565+
}
561566
}
562567
} else {
563-
logger.debug("updateModeAndFunction() Unrecognized mode from message: {}", tmsg.getFrameValue());
568+
logger.warn("updateModeAndFunction() Unrecognized mode from message: {}", tmsg.getFrameValue());
564569
}
565570
}
566571

@@ -604,6 +609,16 @@ private void updateTemperature(Thermoregulation tmsg) {
604609
}
605610
}
606611

612+
private void updateTargetTemperature(Thermoregulation tmsg) {
613+
try {
614+
double temp = Thermoregulation.parseTemperature(tmsg);
615+
updateState(CHANNEL_TEMP_TARGET, getAsQuantityTypeOrNull(temp, SIUnits.CELSIUS));
616+
} catch (FrameException e) {
617+
logger.warn("updateTargetTemperature() FrameException on frame {}: {}", tmsg, e.getMessage());
618+
updateState(CHANNEL_TEMP_TARGET, UnDefType.UNDEF);
619+
}
620+
}
621+
607622
private void updateSetpoint(Thermoregulation tmsg) {
608623
try {
609624
double newTemp = -1;
@@ -654,17 +669,49 @@ private void updateValveStatus(Thermoregulation tmsg) {
654669
Thermoregulation.ValveOrActuatorStatus cv = Thermoregulation.parseValveStatus(tmsg,
655670
Thermoregulation.WhatThermoType.CONDITIONING);
656671
updateState(CHANNEL_CONDITIONING_VALVES, new StringType(cv.toString()));
672+
updateHeatingCooling(false, cv);
657673

658674
Thermoregulation.ValveOrActuatorStatus hv = Thermoregulation.parseValveStatus(tmsg,
659675
Thermoregulation.WhatThermoType.HEATING);
660676
updateState(CHANNEL_HEATING_VALVES, new StringType(hv.toString()));
677+
updateHeatingCooling(true, hv);
678+
661679
} catch (FrameException e) {
662680
logger.warn("updateValveStatus() FrameException on frame {}: {}", tmsg, e.getMessage());
663681
updateState(CHANNEL_CONDITIONING_VALVES, UnDefType.UNDEF);
664682
updateState(CHANNEL_HEATING_VALVES, UnDefType.UNDEF);
665683
}
666684
}
667685

686+
private void updateHeatingCooling(boolean heating, Thermoregulation.ValveOrActuatorStatus v) {
687+
boolean state = false;
688+
switch (v) {
689+
case STOP:
690+
case CLOSED:
691+
case OFF:
692+
case OFF_FAN_COIL:
693+
case OFF_SPEED_1:
694+
case OFF_SPEED_2:
695+
case OFF_SPEED_3:
696+
state = false;
697+
break;
698+
case ON:
699+
case ON_FAN_COIL:
700+
case ON_SPEED_1:
701+
case ON_SPEED_2:
702+
case ON_SPEED_3:
703+
case OPENED:
704+
state = true;
705+
break;
706+
}
707+
708+
if (heating) {
709+
updateState(CHANNEL_HEATING, OnOffType.from(state));
710+
} else {
711+
updateState(CHANNEL_COOLING, OnOffType.from(state));
712+
}
713+
}
714+
668715
private void updateActuatorStatus(Thermoregulation tmsg) {
669716
try {
670717
Thermoregulation.ValveOrActuatorStatus hv = Thermoregulation.parseActuatorStatus(tmsg);

bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/i18n/openwebnet.properties

+11-5
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ channel-type.openwebnet.atLeastOneProbeManual.description = At least one probe i
147147
channel-type.openwebnet.atLeastOneProbeOff.label = At least one probe OFF
148148
channel-type.openwebnet.atLeastOneProbeOff.description = At least one probe in OFF mode indicator from Central Unit (read only)
149149
channel-type.openwebnet.atLeastOneProbeProtection.label = At least one probe in PROTECTION
150-
channel-type.openwebnet.atLeastOneProbeProtection.description = At least one probe in PROTECTION mode (Antifreeze / Heat Protection) indicator from Central Unit (read only)
150+
channel-type.openwebnet.atLeastOneProbeProtection.description = At least one probe in PROTECTION mode (Anti-freeze / Heat Protection) indicator from Central Unit (read only)
151151
channel-type.openwebnet.aux.label = Auxiliary
152152
channel-type.openwebnet.aux.description = Controls an Auxiliary command (read/write)
153153
channel-type.openwebnet.aux.state.option.OFF = Off
@@ -185,6 +185,8 @@ channel-type.openwebnet.conditioningValves.state.option.ON_SPEED_3 = On speed 3
185185
channel-type.openwebnet.conditioningValves.state.option.OFF_SPEED_1 = Off speed 1
186186
channel-type.openwebnet.conditioningValves.state.option.OFF_SPEED_2 = Off speed 2
187187
channel-type.openwebnet.conditioningValves.state.option.OFF_SPEED_3 = Off speed 3
188+
channel-type.openwebnet.cooling.label = Cooling Active
189+
channel-type.openwebnet.cooling.description = Cooling is active in the zone (read only)
188190
channel-type.openwebnet.dryContactIR.label = Sensor
189191
channel-type.openwebnet.dryContactIR.description = Dry Contact Interface or IR Interface sensor movement (read only)
190192
channel-type.openwebnet.energyThisMonth.label = Energy This Month
@@ -202,6 +204,8 @@ channel-type.openwebnet.functionCentralUnit.label = Thermo Function
202204
channel-type.openwebnet.functionCentralUnit.description = Thermo function of the Central Unit (read only)
203205
channel-type.openwebnet.functionCentralUnit.state.option.HEATING = Winter
204206
channel-type.openwebnet.functionCentralUnit.state.option.COOLING = Summer
207+
channel-type.openwebnet.heating.label = Heating Active
208+
channel-type.openwebnet.heating.description = Heating is active in the zone (read only)
205209
channel-type.openwebnet.heatingValves.label = Heating Valves
206210
channel-type.openwebnet.heatingValves.description = Heating Valves status (read only)
207211
channel-type.openwebnet.heatingValves.state.option.OFF = Off
@@ -219,7 +223,7 @@ channel-type.openwebnet.heatingValves.state.option.OFF_SPEED_3 = Off speed 3
219223
channel-type.openwebnet.localOffset.label = Local Offset
220224
channel-type.openwebnet.localOffset.description = Local knob status (read only)
221225
channel-type.openwebnet.localOffset.state.option.OFF = Off
222-
channel-type.openwebnet.localOffset.state.option.PROTECTION = Antifreeze / Heat Protection
226+
channel-type.openwebnet.localOffset.state.option.PROTECTION = Anti-freeze / Heat Protection
223227
channel-type.openwebnet.localOffset.state.option.PLUS_3 = +3
224228
channel-type.openwebnet.localOffset.state.option.PLUS_2 = +2
225229
channel-type.openwebnet.localOffset.state.option.PLUS_1 = +1
@@ -231,14 +235,14 @@ channel-type.openwebnet.mode.label = Mode
231235
channel-type.openwebnet.mode.description = The zone operation mode (read/write)
232236
channel-type.openwebnet.mode.state.option.AUTO = Automatic
233237
channel-type.openwebnet.mode.state.option.MANUAL = Manual
234-
channel-type.openwebnet.mode.state.option.PROTECTION = Antifreeze / Heat Protection
238+
channel-type.openwebnet.mode.state.option.PROTECTION = Anti-freeze / Heat Protection
235239
channel-type.openwebnet.mode.state.option.OFF = Off
236240
channel-type.openwebnet.modeCentralUnit.label = Central Unit Mode
237241
channel-type.openwebnet.modeCentralUnit.description = The Central Unit operation mode (read/write)
238242
channel-type.openwebnet.modeCentralUnit.state.option.WEEKLY = Weekly
239243
channel-type.openwebnet.modeCentralUnit.state.option.SCENARIO = Scenarios
240244
channel-type.openwebnet.modeCentralUnit.state.option.MANUAL = Manual
241-
channel-type.openwebnet.modeCentralUnit.state.option.PROTECTION = Antifreeze / Heat Protection
245+
channel-type.openwebnet.modeCentralUnit.state.option.PROTECTION = Anti-freeze / Heat Protection
242246
channel-type.openwebnet.modeCentralUnit.state.option.OFF = Off
243247
channel-type.openwebnet.modeCentralUnit.state.option.HOLIDAY = Holiday
244248
channel-type.openwebnet.modeCentralUnit.state.option.VACATION = Vacation
@@ -281,10 +285,12 @@ channel-type.openwebnet.speedFanCoil.state.option.SPEED_2 = Fan speed 2
281285
channel-type.openwebnet.speedFanCoil.state.option.SPEED_3 = Fan speed 3
282286
channel-type.openwebnet.switch.label = Switch
283287
channel-type.openwebnet.switch.description = Switch the power ON and OFF
288+
channel-type.openwebnet.targetTemperature.label = Target Temperature
289+
channel-type.openwebnet.targetTemperature.description = Target temperature (read only)
284290
channel-type.openwebnet.temperature.label = Temperature
285291
channel-type.openwebnet.temperature.description = Current temperature (read only)
286292
channel-type.openwebnet.vacationDays.label = Vacation Days
287-
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)
293+
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)
288294
channel-type.openwebnet.weeklyProgramCentralUnit.label = Weekly Program Number
289295
channel-type.openwebnet.weeklyProgramCentralUnit.description = Set weekly program number for the Central Unit, valid only with Central Unit mode = "WEEKLY" (read/write)
290296
channel-type.openwebnet.weeklyProgramCentralUnit.state.option.1 = Weekly Program 1

bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/BusThermoZone.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
<channels>
1717
<!-- read only -->
1818
<channel id="temperature" typeId="temperature"/>
19-
<channel id="conditioningValves" typeId="conditioningValves"/>
19+
<channel id="targetTemperature" typeId="targetTemperature"/>
2020
<channel id="heatingValves" typeId="heatingValves"/>
21+
<channel id="conditioningValves" typeId="conditioningValves"/>
22+
<channel id="heating" typeId="heating"/>
23+
<channel id="cooling" typeId="cooling"/>
2124
<channel id="actuators" typeId="actuators"/>
2225
<channel id="localOffset" typeId="localOffset"/>
2326
<!-- read/write -->
@@ -31,6 +34,7 @@
3134
<property name="vendor">BTicino/Legrand</property>
3235
<property name="model">Zone thermostat BTI-LN4691 (stand-alone), 3550 (99 zones Central Unit)</property>
3336
<property name="ownDeviceType">410/420</property>
37+
<property name="thingTypeVersion">1</property>
3438
</properties>
3539

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

bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/thing/channels.xml

+26-5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@
113113
<state pattern="%.1f %unit%" step="0.5"/>
114114
</channel-type>
115115

116+
<channel-type id="targetTemperature" advanced="true">
117+
<item-type>Number:Temperature</item-type>
118+
<label>Target Temperature</label>
119+
<description>Target temperature (read only)</description>
120+
<state readOnly="true" pattern="%.1f %unit%"/>
121+
</channel-type>
122+
116123
<channel-type id="mode">
117124
<item-type>String</item-type>
118125
<label>Mode</label>
@@ -121,7 +128,7 @@
121128
<options>
122129
<option value="AUTO">Automatic</option>
123130
<option value="MANUAL">Manual</option>
124-
<option value="PROTECTION">Antifreeze / Heat Protection</option>
131+
<option value="PROTECTION">Anti-freeze / Heat Protection</option>
125132
<option value="OFF">Off</option>
126133
</options>
127134
</state>
@@ -186,6 +193,20 @@
186193
</state>
187194
</channel-type>
188195

196+
<channel-type id="heating" advanced="true">
197+
<item-type>Switch</item-type>
198+
<label>Heating Active</label>
199+
<description>Heating is active in the zone (read only)</description>
200+
<state readOnly="true"/>
201+
</channel-type>
202+
203+
<channel-type id="cooling" advanced="true">
204+
<item-type>Switch</item-type>
205+
<label>Cooling Active</label>
206+
<description>Cooling is active in the zone (read only)</description>
207+
<state readOnly="true"/>
208+
</channel-type>
209+
189210
<channel-type id="actuators" advanced="true">
190211
<item-type>String</item-type>
191212
<label>Actuators Status</label>
@@ -215,7 +236,7 @@
215236
<state readOnly="true">
216237
<options>
217238
<option value="OFF">Off</option>
218-
<option value="PROTECTION">Antifreeze / Heat Protection</option>
239+
<option value="PROTECTION">Anti-freeze / Heat Protection</option>
219240
<option value="PLUS_3">+3</option>
220241
<option value="PLUS_2">+2</option>
221242
<option value="PLUS_1">+1</option>
@@ -236,7 +257,7 @@
236257
<option value="WEEKLY">Weekly</option>
237258
<option value="SCENARIO">Scenarios</option>
238259
<option value="MANUAL">Manual</option>
239-
<option value="PROTECTION">Antifreeze / Heat Protection</option>
260+
<option value="PROTECTION">Anti-freeze / Heat Protection</option>
240261
<option value="OFF">Off</option>
241262
<option value="HOLIDAY">Holiday</option>
242263
<option value="VACATION">Vacation</option>
@@ -287,7 +308,7 @@
287308
<channel-type id="vacationDays">
288309
<item-type>Number</item-type>
289310
<label>Vacation Days</label>
290-
<description>Number of days the Central Unit will be set to Antifreeze / Heat Protection target temperature before
311+
<description>Number of days the Central Unit will be set to Anti-freeze / Heat Protection target temperature before
291312
returning to mode WEEKLY (read/write)</description>
292313
</channel-type>
293314

@@ -332,7 +353,7 @@
332353
<channel-type id="atLeastOneProbeProtection" advanced="true">
333354
<item-type>Switch</item-type>
334355
<label>At least one probe in PROTECTION</label>
335-
<description>At least one probe in PROTECTION mode (Antifreeze / Heat Protection) indicator from Central Unit (read
356+
<description>At least one probe in PROTECTION mode (Anti-freeze / Heat Protection) indicator from Central Unit (read
336357
only)</description>
337358
<state readOnly="true"></state>
338359
</channel-type>

bundles/org.openhab.binding.openwebnet/src/main/resources/OH-INF/update/update.xml

+14
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,18 @@
2929
</instruction-set>
3030
</thing-type>
3131

32+
<thing-type uid="openwebnet:bus_thermo_zone">
33+
<instruction-set targetVersion="1">
34+
<add-channel id="targetTemperature">
35+
<type>openwebnet:targetTemperature</type>
36+
</add-channel>
37+
<add-channel id="heating">
38+
<type>openwebnet:heating</type>
39+
</add-channel>
40+
<add-channel id="cooling">
41+
<type>openwebnet:cooling</type>
42+
</add-channel>
43+
</instruction-set>
44+
</thing-type>
45+
3246
</update:update-descriptions>

0 commit comments

Comments
 (0)