[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 | | Channel ID | Type | Read-Only | Description |
|----------------------------------|----------------------|-----------|-------------------------------------------------------------------------| |----------------------------------|----------------------|-----------|-------------------------------------------------------------------------|
| compressor_power | Number:Dimensionless | yes | Percent Power Compressor | | 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_day | Number:Dimensionless | yes | Day |
| date_month | Number:Dimensionless | yes | Month | | date_month | Number:Dimensionless | yes | Month |
| date_year | Number:Dimensionless | yes | Year | | date_year | Number:Dimensionless | yes | Year |
@ -85,7 +85,7 @@ Advanced channels:
| maxVLTemp | Number:Temperature | yes | maxVLTemp | | maxVLTemp | Number:Temperature | yes | maxVLTemp |
| nviHeizkreisNorm | Number:Temperature | no | nviHeizkreisNorm | | nviHeizkreisNorm | Number:Temperature | no | nviHeizkreisNorm |
| nviNormAussen | Number:Temperature | no | nviNormAussen | | nviNormAussen | Number:Temperature | no | nviNormAussen |
| nviSollKuehlen | Number:Temperature | yes | nviSollKuehlen | | nviSollKuehlen | Number:Temperature | no | nviSollKuehlen |
| nviTHeizgrenze | Number:Temperature | no | nviTHeizgrenze | | nviTHeizgrenze | Number:Temperature | no | nviTHeizgrenze |
| nviTHeizgrenzeSoll | Number:Temperature | no | nviTHeizgrenze Setpoint | | nviTHeizgrenzeSoll | Number:Temperature | no | nviTHeizgrenze Setpoint |
| operating_hours_circulation_pump | Number:Time | yes | Operating Hours Circulation Pump | | 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:Power HeatPump_power_th { channel="ecotouch:geo:heatpump:power_heating" }
Number HeatPump_COP_heating { channel="ecotouch:geo:heatpump:cop_heating" } Number HeatPump_COP_heating { channel="ecotouch:geo:heatpump:cop_heating" }
Number:Temperature HeatPump_adaptHeating { channel="ecotouch:geo:heatpump:adapt_heating" } Number:Temperature HeatPump_adaptHeating { channel="ecotouch:geo:heatpump:adapt_heating" }
Switch HeatPump_state_sourcepump { channel="ecotouch:geo:heatpump:state_sourcepump" }
``` ```
### ecotouch.sitemap ### ecotouch.sitemap
@ -198,3 +199,21 @@ sitemap ecotouch label="Waterkotte EcoTouch"
Setpoint item=HeatPump_adaptHeating minValue=-2.0 maxValue=2.0 step=0.5 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.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLEncoder; 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.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -110,10 +114,11 @@ public class EcoTouchConnector {
throw new IOException("Too many users already logged in."); throw new IOException("Too many users already logged in.");
} }
if (cookies == null) { if (cookies == null) {
if (cause == null) if (cause == null) {
throw new IOException("Cannot login"); throw new IOException("Cannot login");
else } else {
throw new IOException("Cannot login: " + cause); throw new IOException("Cannot login: " + cause);
}
} }
} }
@ -212,8 +217,9 @@ public class EcoTouchConnector {
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
String line2 = reader.readLine(); String line2 = reader.readLine();
if (line2 == null) if (line2 == null) {
break; break;
}
String doubleline = line + "\n" + line2; String doubleline = line + "\n" + line2;
Matcher m = responsePattern.matcher(doubleline); Matcher m = responsePattern.matcher(doubleline);
if (m.find()) { if (m.find()) {
@ -237,8 +243,9 @@ public class EcoTouchConnector {
} }
loginAttempt++; loginAttempt++;
} finally { } finally {
if (reader != null) if (reader != null) {
reader.close(); reader.close();
}
} }
} }
@ -291,8 +298,9 @@ public class EcoTouchConnector {
} }
loginAttempt++; loginAttempt++;
} finally { } finally {
if (reader != null) if (reader != null) {
reader.close(); reader.close();
}
} }
} }

View File

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

View File

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

View File

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