[ecotouch] Fix description of nviSollKuehlen and coolEnableTemp being writable (#11716)

* Fix description of nviSollKuehlen being writable
* Fix description of coolEnableTemp being writable
* [ecotouch] make channels writable
* [ecotouch] silence compiler warnings
* change example to English

Signed-off-by: Sebastian Held <sebastian.held@gmx.de>
Co-authored-by: Jan Mattner <JanMattner@users.noreply.github.com>
This commit is contained in:
Sebastian Held 2021-12-24 10:36:04 +01:00 committed by GitHub
parent cc47ef7f3e
commit d67c34e2bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 21 deletions

View File

@ -64,7 +64,7 @@ Advanced channels:
| Channel ID | Type | Read-Only | Description |
|----------------------------------|----------------------|-----------|-------------------------------------------------------------------------|
| compressor_power | Number:Dimensionless | yes | Percent Power Compressor |
| coolEnableTemp | Number:Temperature | yes | Temperature Cooling Enable |
| coolEnableTemp | Number:Temperature | no | Temperature Cooling Enable |
| date_day | Number:Dimensionless | yes | Day |
| date_month | Number:Dimensionless | yes | Month |
| date_year | Number:Dimensionless | yes | Year |
@ -85,7 +85,7 @@ Advanced channels:
| maxVLTemp | Number:Temperature | yes | maxVLTemp |
| nviHeizkreisNorm | Number:Temperature | no | nviHeizkreisNorm |
| nviNormAussen | Number:Temperature | no | nviNormAussen |
| nviSollKuehlen | Number:Temperature | yes | nviSollKuehlen |
| nviSollKuehlen | Number:Temperature | no | nviSollKuehlen |
| nviTHeizgrenze | Number:Temperature | no | nviTHeizgrenze |
| nviTHeizgrenzeSoll | Number:Temperature | no | nviTHeizgrenze Setpoint |
| operating_hours_circulation_pump | Number:Time | yes | Operating Hours Circulation Pump |
@ -179,6 +179,7 @@ Number:Power HeatPump_power_el { channel="ecotouch:geo:heatpump:pow
Number:Power HeatPump_power_th { channel="ecotouch:geo:heatpump:power_heating" }
Number HeatPump_COP_heating { channel="ecotouch:geo:heatpump:cop_heating" }
Number:Temperature HeatPump_adaptHeating { channel="ecotouch:geo:heatpump:adapt_heating" }
Switch HeatPump_state_sourcepump { channel="ecotouch:geo:heatpump:state_sourcepump" }
```
### ecotouch.sitemap
@ -198,3 +199,21 @@ sitemap ecotouch label="Waterkotte EcoTouch"
Setpoint item=HeatPump_adaptHeating minValue=-2.0 maxValue=2.0 step=0.5
}
```
A snippet to show the current state of the heatpump (you need to have the corresponding items in your .items-file):
```
Text label="State" icon="settings" {
Text item=HeatPump_state_sourcepump label="State Source Pump [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_heatingpump label="State Heating Pump [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_evd label="State EVD [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_compressor1 label="State Compressor 1 [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_extheater label="State External Heater [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_alarm label="State Alarm [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_cooling label="State Cooling [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_water label="State Water [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_pool label="State Pool [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_solar label="State Solar [%s]" valuecolor=[==ON="green", ==OFF="red"]
Text item=HeatPump_state_cooling4way label="State Cooling4Way [%s]" valuecolor=[==ON="green", ==OFF="red"]
}
```

View File

@ -20,7 +20,11 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -110,10 +114,11 @@ public class EcoTouchConnector {
throw new IOException("Too many users already logged in.");
}
if (cookies == null) {
if (cause == null)
if (cause == null) {
throw new IOException("Cannot login");
else
} else {
throw new IOException("Cannot login: " + cause);
}
}
}
@ -212,8 +217,9 @@ public class EcoTouchConnector {
String line;
while ((line = reader.readLine()) != null) {
String line2 = reader.readLine();
if (line2 == null)
if (line2 == null) {
break;
}
String doubleline = line + "\n" + line2;
Matcher m = responsePattern.matcher(doubleline);
if (m.find()) {
@ -237,8 +243,9 @@ public class EcoTouchConnector {
}
loginAttempt++;
} finally {
if (reader != null)
if (reader != null) {
reader.close();
}
}
}
@ -291,8 +298,9 @@ public class EcoTouchConnector {
}
loginAttempt++;
} finally {
if (reader != null)
if (reader != null) {
reader.close();
}
}
}

View File

@ -18,7 +18,11 @@ import static org.openhab.core.library.unit.Units.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
@ -107,6 +111,10 @@ public class EcoTouchHandler extends BaseThingHandler {
// send command to heat pump
try {
EcoTouchTags ecoTouchTag = EcoTouchTags.fromString(channelUID.getId());
if (ecoTouchTag == null) {
logger.warn("ID: {} unknown", channelUID.getId());
return;
}
if (ecoTouchTag == EcoTouchTags.TYPE_ADAPT_HEATING) {
// this type needs special treatment
QuantityType<?> value = (QuantityType<?>) command;
@ -189,8 +197,9 @@ public class EcoTouchHandler extends BaseThingHandler {
for (EcoTouchTags ecoTouchTag : EcoTouchTags.values()) {
String channel = ecoTouchTag.getCommand();
boolean linked = isLinked(channel);
if (linked)
if (linked) {
tags.add(ecoTouchTag.getTagName());
}
}
var localConnector = connector;
if (localConnector != null) {
@ -216,8 +225,9 @@ public class EcoTouchHandler extends BaseThingHandler {
};
var localConfig = config;
if (localConfig != null)
if (localConfig != null) {
refreshJob = scheduler.scheduleWithFixedDelay(runnable, 10, localConfig.refresh, TimeUnit.SECONDS);
}
}
}
@ -229,7 +239,8 @@ public class EcoTouchHandler extends BaseThingHandler {
localRefreshJob = null;
}
var localConnector = connector;
if (localConnector != null)
if (localConnector != null) {
localConnector.logout();
}
}
}

View File

@ -22,12 +22,16 @@ import java.util.List;
import javax.measure.Unit;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
/**
* Represents all valid commands which could be processed by this binding
*
* @author Sebastian Held <sebastian.held@gmx.de> - Initial contribution
* @since 1.5.0
*/
@NonNullByDefault
public enum EcoTouchTags {
// German: Außentemperatur
@ -1131,12 +1135,12 @@ public enum EcoTouchTags {
* Represents the heatpump command as it will be used in *.items
* configuration
*/
String command;
String command = "";
/**
* Represents the internal raw heatpump command as it will be used in
* querying the heat pump
*/
String tagName;
String tagName = "";
Unit<?> unit = ONE;
@ -1172,7 +1176,7 @@ public enum EcoTouchTags {
/**
* If \c type is Type.Enum, this defines the meaning of the values (0-based)
*/
String[] stringEnum = null;
String @Nullable [] stringEnum = null;
/**
* @return command name (uses in *.items files)
@ -1244,10 +1248,11 @@ public enum EcoTouchTags {
if (type == Type.Bitfield) {
// ignore any scaling from \ref divisor
int value = raw.intValue();
if ((value & (1 << bitnum)) != 0)
if ((value & (1 << bitnum)) != 0) {
return BigDecimal.ONE;
else
} else {
return BigDecimal.ZERO;
}
}
BigDecimal result = raw.divide(new BigDecimal(divisor));
return result;
@ -1260,8 +1265,8 @@ public enum EcoTouchTags {
* command string e.g. "temperature_outside"
* @return matching EcoTouchTags instance, if available
*/
public static EcoTouchTags fromString(String heatpumpCommand) {
if ("".equals(heatpumpCommand)) {
public static @Nullable EcoTouchTags fromString(String heatpumpCommand) {
if (heatpumpCommand.isEmpty()) {
return null;
}
for (EcoTouchTags c : EcoTouchTags.values()) {

View File

@ -586,13 +586,13 @@
<item-type>Number:Temperature</item-type>
<label>Temperature Cooling Enable</label>
<category>Temperature</category>
<state readOnly="true" pattern="%.1f %unit%"/>
<state readOnly="false" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="nviSollKuehlen" advanced="true">
<item-type>Number:Temperature</item-type>
<label>nviSollKuehlen</label>
<category>Temperature</category>
<state readOnly="true" pattern="%.1f %unit%"/>
<state readOnly="false" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="tempchange_heating_pv" advanced="true">
<item-type>Number:Temperature</item-type>