use of org.openhab.binding.stiebelheatpump.protocol.RecordDefinition in project openhab1-addons by openhab.
the class CommunicationService method setData.
/**
* This method updates the parameter item of a heat pump request
*
* @param value
* the new value of the item
* @param parameter
* to be update in the heat pump
*/
public Map<String, String> setData(String value, String parameter) throws StiebelHeatPumpException {
Request updateRequest = null;
RecordDefinition updateRecord = null;
Map<String, String> data = new HashMap<String, String>();
// be updated
if (parameter != null) {
for (Request request : heatPumpSettingConfiguration) {
for (RecordDefinition record : request.getRecordDefinitions()) {
if (record.getName().equalsIgnoreCase(parameter)) {
updateRecord = record;
updateRequest = request;
logger.debug("Found valid record definition {} in request {}:{}", record.getName(), request.getName(), request.getDescription());
break;
}
}
}
}
if (updateRecord == null || updateRequest == null) {
// did not find any valid record, do nothing
logger.warn("Could not find valid record definition for {}", parameter);
return data;
}
try {
// get actual value for the corresponding request
// as we do no have individual requests for each settings we need to
// decode the new value
// into a current response , the response is available in the
// connector object
byte[] requestMessage = createRequestMessage(updateRequest);
byte[] response = getData(requestMessage);
data = parser.parseRecords(response, updateRequest);
// lookup parameter value in the data
String currentState = data.get(updateRecord.getName());
if (currentState.equals(value)) {
// current State is already same as new values!
logger.debug("Current State for {} is already {}.", parameter, value);
return data;
}
// create new set request out from the existing read response
byte[] requestUpdateMessage = parser.composeRecord(value, response, updateRecord);
logger.debug("Setting new value [{}] for parameter [{}]", value, parameter);
Thread.sleep(WAITING_TIME_BETWEEN_REQUESTS);
response = setData(requestUpdateMessage);
if (parser.setDataCheck(response)) {
logger.debug("Updated parameter {} successfully.", parameter);
} else {
logger.debug("Update for parameter {} failed!", parameter);
}
} catch (StiebelHeatPumpException e) {
logger.error("Stiebel heat pump communication error during update of value! " + e.toString());
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
}
return data;
}
use of org.openhab.binding.stiebelheatpump.protocol.RecordDefinition in project openhab1-addons by openhab.
the class CommunicationService method setTime.
/**
* This method set the time of the heat pump to the current time
*
* @return true if time has been updated
*/
public Map<String, String> setTime() throws StiebelHeatPumpException {
startCommunication();
Map<String, String> data = new HashMap<String, String>();
Request timeRequest = null;
for (Request request : heatPumpSettingConfiguration) {
if (request.getName().equals("Time")) {
timeRequest = request;
break;
}
}
if (timeRequest == null) {
logger.warn("Could not find request definition for time settings! Skip setting time.");
return data;
}
logger.debug("Loading current time data ...");
try {
// get time from heat pump
byte[] requestMessage = createRequestMessage(timeRequest);
byte[] response = getData(requestMessage);
// get current time from local machine
DateTime dt = DateTime.now();
logger.debug("Current time is : {}", dt.toString());
String weekday = Integer.toString(dt.getDayOfWeek() - 1);
String day = Integer.toString(dt.getDayOfMonth());
String month = Integer.toString(dt.getMonthOfYear());
String year = Integer.toString(dt.getYearOfCentury());
String seconds = Integer.toString(dt.getSecondOfMinute());
String hours = Integer.toString(dt.getHourOfDay());
String minutes = Integer.toString(dt.getMinuteOfHour());
data = parser.parseRecords(response, timeRequest);
boolean updateRequired = false;
for (Map.Entry<String, String> entry : data.entrySet()) {
String entryName = entry.getKey();
String entryValue = entry.getValue();
RecordDefinition currentRecord = null;
for (RecordDefinition record : timeRequest.getRecordDefinitions()) {
if (record.getName().equals(entryName)) {
currentRecord = record;
break;
}
}
if (entryName.equals("WeekDay") && !entryValue.equals(weekday)) {
updateRequired = true;
response = parser.composeRecord(weekday, response, currentRecord);
logger.debug("WeekDay needs update from {} to {}", entryValue, weekday);
continue;
}
if (entryName.equals("Hours") && !entryValue.equals(hours)) {
updateRequired = true;
response = parser.composeRecord(hours, response, currentRecord);
logger.debug("Hours needs update from {} to {}", entryValue, hours);
continue;
}
if (entryName.equals("Minutes") && !entryValue.equals(minutes)) {
updateRequired = true;
response = parser.composeRecord(minutes, response, currentRecord);
logger.debug("Minutes needs update from {} to {}", entryValue, minutes);
continue;
}
if (entryName.equals("Seconds") && !entryValue.equals(seconds)) {
updateRequired = true;
response = parser.composeRecord(seconds, response, currentRecord);
logger.debug("Seconds needs update from {} to {}", entryValue, seconds);
continue;
}
if (entryName.equals("Year") && !entryValue.equals(year)) {
updateRequired = true;
response = parser.composeRecord(year, response, currentRecord);
logger.debug("Year needs update from {} to {}", entryValue, year);
continue;
}
if (entryName.equals("Month") && !entryValue.equals(month)) {
updateRequired = true;
response = parser.composeRecord(month, response, currentRecord);
logger.debug("Month needs update from {} to {}", entryValue, month);
continue;
}
if (entryName.equals("Day") && !entryValue.equals(day)) {
updateRequired = true;
response = parser.composeRecord(day, response, currentRecord);
logger.debug("Day needs update from {} to {}", entryValue, day);
continue;
}
}
if (updateRequired) {
Thread.sleep(WAITING_TIME_BETWEEN_REQUESTS);
logger.info("Time need update. Set time to " + dt.toString());
setData(response);
Thread.sleep(WAITING_TIME_BETWEEN_REQUESTS);
response = getData(requestMessage);
data = parser.parseRecords(response, timeRequest);
dt = DateTime.now();
logger.debug("Current time is : {}", dt.toString());
}
return data;
} catch (InterruptedException e) {
throw new StiebelHeatPumpException(e.toString());
}
}
use of org.openhab.binding.stiebelheatpump.protocol.RecordDefinition in project openhab1-addons by openhab.
the class ConfigLocatorTest method LoadResourceFiles.
@Test
public void LoadResourceFiles() throws StiebelHeatPumpException {
String workingDir = System.getProperty("user.dir");
String FILEDUMP = "itemDump.txt";
FILEDUMP = workingDir + File.separator + FILEDUMP;
String GROUPPREFIX = "gEnergieWaermepumpe_";
String PARENTGROUP = "gEnergieWaermepumpe";
ConfigLocator configLocator = new ConfigLocator("2.06.xml");
List<Request> configuration = configLocator.getConfig();
Request firstRequest = configuration.get(0);
Assert.assertEquals("Version", firstRequest.getName());
Assert.assertEquals((byte) 0xfd, firstRequest.getRequestByte());
Assert.assertEquals((byte) 0x05, configuration.get(7).getRequestByte());
FileWriter dumpFile;
try {
dumpFile = new FileWriter(FILEDUMP);
String newLine = System.getProperty("line.separator");
// dump items definition
for (Request request : configuration) {
// create group item
String groupItem = String.format("Group %s%s \"%s\" (%s) ", GROUPPREFIX, request.getName(), request.getName(), PARENTGROUP);
dumpFile.write(groupItem + newLine);
// add item definition per record
for (RecordDefinition record : request.getRecordDefinitions()) {
String itemType;
String itemFormat;
if (record.getDataType() == Type.Status) {
if (record.getUnit() == "") {
itemType = "String";
itemFormat = "[%s]";
} else if (record.getScale() != 1.0) {
itemType = "Number";
itemFormat = "[%.1f " + record.getUnit() + "]";
} else {
itemType = "Number";
itemFormat = "[%d " + record.getUnit() + "]";
}
} else {
itemType = "Number";
if (record.getScale() != 1.0) {
itemFormat = "[%.1f " + record.getUnit() + "]";
} else {
itemFormat = "[%d " + record.getUnit() + "]";
}
}
// { stiebelheatpump="OutputElectricalHeatingStage1" }
String itemDefinition = String.format("%s %s \"%s %s\" (%s,%s) { stiebelheatpump=\"%s\" }", itemType, record.getName(), record.getName(), itemFormat, GROUPPREFIX + request.getName(), PARENTGROUP, record.getName());
dumpFile.write(itemDefinition + newLine);
}
// add site item definition per record
for (RecordDefinition record : request.getRecordDefinitions()) {
String itemType = "";
String itemFormat = "";
Type dataType = record.getDataType();
switch(dataType) {
case Settings:
itemType = "Setpoint item=";
itemFormat = String.format("%s minValue=%s maxValue=%s step=%s", record.getName(), record.getMin(), record.getMax(), record.getStep());
break;
case Status:
case Sensor:
itemType = "Text item=";
itemFormat = record.getName();
break;
}
dumpFile.write(itemType + itemFormat + newLine);
}
dumpFile.write(newLine);
}
for (Request request : configuration) {
for (RecordDefinition record : request.getRecordDefinitions()) {
if (record.getDataType() == Type.Settings) {
dumpFile.write(record.getName() + ",");
}
}
}
dumpFile.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of org.openhab.binding.stiebelheatpump.protocol.RecordDefinition in project openhab1-addons by openhab.
the class ConfigParserTest method getHeatPumpConfiguration.
public List<Request> getHeatPumpConfiguration() {
List<Request> configuration = new ArrayList<Request>();
Request version = new Request("Version", "Read version information", (byte) 0xfd);
version.getRecordDefinitions().add(new RecordDefinition("Version", 4, 2, 0.01, RecordDefinition.Type.Status, ""));
configuration.add(version);
Request time = new Request("Time", "Reads Time", (byte) 0xfc);
time.getRecordDefinitions().add(new RecordDefinition("WeekDay", 5, 1, 1, RecordDefinition.Type.Settings, 0, 6, 1.0, "d"));
time.getRecordDefinitions().add(new RecordDefinition("Hours", 6, 1, 1, RecordDefinition.Type.Settings, 0, 23, 1.0, "h"));
time.getRecordDefinitions().add(new RecordDefinition("Minutes", 7, 1, 1, RecordDefinition.Type.Settings, 0, 59, 1.0, "min"));
time.getRecordDefinitions().add(new RecordDefinition("Seconds", 8, 1, 1, RecordDefinition.Type.Settings, 0, 59, 1.0, "s"));
time.getRecordDefinitions().add(new RecordDefinition("Year", 9, 1, 1, RecordDefinition.Type.Settings, 0, 99, 1.0, "Y"));
time.getRecordDefinitions().add(new RecordDefinition("Month", 11, 1, 1, RecordDefinition.Type.Settings, 1, 12, 1.0, "M"));
time.getRecordDefinitions().add(new RecordDefinition("Day", 12, 1, 1, RecordDefinition.Type.Settings, 1, 31, 1.0, "d"));
configuration.add(time);
Request operationStatus = new Request("OperationCounters", "Reads Operation counters and Time", (byte) 0x09);
operationStatus.getRecordDefinitions().add(new RecordDefinition("CompressorA", 4, 2, 1, RecordDefinition.Type.Status, "h"));
operationStatus.getRecordDefinitions().add(new RecordDefinition("CompressorB", 6, 2, 1, RecordDefinition.Type.Status, "h"));
operationStatus.getRecordDefinitions().add(new RecordDefinition("HeatingMode", 8, 2, 1, RecordDefinition.Type.Status, "h"));
operationStatus.getRecordDefinitions().add(new RecordDefinition("DHWMode", 10, 2, 1, RecordDefinition.Type.Status, "h"));
operationStatus.getRecordDefinitions().add(new RecordDefinition("CoolingMode", 12, 2, 1, RecordDefinition.Type.Status, "h"));
configuration.add(operationStatus);
Request currentValues = new Request("CurrentValues", "Reads measurements", (byte) 0xfb);
currentValues.getRecordDefinitions().add(new RecordDefinition("CollectorTemperatur", 4, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("OutsideTemperature", 6, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("FlowTemperature", 8, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("ReturnTemperature", 10, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("HotGasTemperature", 12, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("CylinderTemperature", 14, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("EvaporatorTemperature", 20, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("CondenserTemperature", 22, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("ExtractFanSpeed", 30, 1, 1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("SupplyFanSpeed", 31, 1, 1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("ExhaustFanSpeed", 32, 1, 1, RecordDefinition.Type.Sensor, "°C"));
currentValues.getRecordDefinitions().add(new RecordDefinition("FilteredOutsideTemperature", 34, 2, 0.1, RecordDefinition.Type.Sensor, "°C"));
configuration.add(currentValues);
Request settingsNominalValues = new Request("SettingsNominalValues", "Reads nominal setting values", (byte) 0x17);
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P01RoomTemperatureStandardMode", 4, 2, 0.1, RecordDefinition.Type.Settings, 10, 30, 0.1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P02RoomTemperatureSetbackMode", 6, 2, 0.1, RecordDefinition.Type.Settings, 10, 30, 0.1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P03RoomTemperatureStandby", 8, 2, 0.1, RecordDefinition.Type.Settings, 10, 30, 0.1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P04DHWTemperatureStandardMode", 10, 2, 0.1, RecordDefinition.Type.Settings, 10, 55, 0.1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P05DHWTemperaturSetbackMode", 12, 2, 0.1, RecordDefinition.Type.Settings, 10, 55, 1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P06DHWTemperatureStandby", 14, 2, 0.1, RecordDefinition.Type.Settings, 10, 55, 1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P07FanStageStandardMode", 16, 1, 1, RecordDefinition.Type.Settings, 0, 3, 1.0, ""));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P08FanStageSetbackMode", 17, 1, 1, RecordDefinition.Type.Settings, 0, 3, 1.0, ""));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P09FanStageStandby", 18, 1, 1, RecordDefinition.Type.Settings, 0, 3, 1.0, ""));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P10HeatingCircuitTemperatureManualMode", 19, 2, 0.1, RecordDefinition.Type.Settings, 10, 65, 0.1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P11DHWTemperatureManualMode", 21, 2, 0.1, RecordDefinition.Type.Settings, 10, 65, 0.1, "°C"));
settingsNominalValues.getRecordDefinitions().add(new RecordDefinition("P12FanStageManualMode", 23, 1, 1, RecordDefinition.Type.Settings, 0, 3, 1.0, ""));
configuration.add(settingsNominalValues);
Request settingsVentilation = new Request("SettingsVentilation", "Reads ventilation setting values", (byte) 0x01);
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P37FanStageSupplyAir1", 4, 2, 1, RecordDefinition.Type.Settings, 60, 280, 1.0, "m^3/s"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P38FanStageSupplyAir2", 6, 2, 1, RecordDefinition.Type.Settings, 60, 280, 1.0, "m^3/s"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P39FanStageSupplyAir3", 8, 2, 1, RecordDefinition.Type.Settings, 60, 280, 1.0, "m^3/s"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P40FanStageExtractyAir1", 10, 2, 1, RecordDefinition.Type.Settings, 60, 280, 1.0, "m^3/s"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P41FanStageExtractyAir2", 12, 2, 1, RecordDefinition.Type.Settings, 60, 280, 1.0, "m^3/s"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P42FanStageExtractyAir3", 14, 2, 1, RecordDefinition.Type.Settings, 60, 280, 1.0, "m^3/s"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P43VentilationTimeUnscheduledStage3", 16, 2, 1, RecordDefinition.Type.Settings, 0, 1000, 1.0, "min"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P44VentilationTimeUnscheduledStage2", 18, 2, 1, RecordDefinition.Type.Settings, 0, 1000, 1.0, "min"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P45VentilationTimeUnscheduledStage1", 20, 2, 1, RecordDefinition.Type.Settings, 0, 1000, 1.0, "min"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P46VentilationTimeUnscheduledStage0", 22, 2, 1, RecordDefinition.Type.Settings, 0, 1000, 1.0, "min"));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("P75OperatingModePassiveCooling", 24, 1, 1, RecordDefinition.Type.Settings, 0, 2, 1.0, ""));
settingsVentilation.getRecordDefinitions().add(new RecordDefinition("StoveFireplaceOperation", 25, 1, 1, RecordDefinition.Type.Settings, 0, 4, 1.0, ""));
configuration.add(settingsVentilation);
Request settingsHeating1 = new Request("SettingsHeating1", "Read heating setting values", (byte) 0x06);
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P21HysteresisHeating1", 4, 1, 0.1, RecordDefinition.Type.Settings, 0, 10, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P22HysteresisHeating2", 5, 1, 0.1, RecordDefinition.Type.Settings, 0, 10, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P23HysteresisHeating3", 6, 1, 0.1, RecordDefinition.Type.Settings, 0, 5, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P24HysteresisHeating4", 7, 1, 0.1, RecordDefinition.Type.Settings, 0, 5, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P25HysteresisHeating5", 8, 1, 0.1, RecordDefinition.Type.Settings, 0, 5, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P26HysteresisHeating6", 9, 1, 0.1, RecordDefinition.Type.Settings, 0, 5, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P27HysteresisHeating7", 10, 1, 0.1, RecordDefinition.Type.Settings, 0, 5, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P28HysteresisHeating8", 11, 1, 0.1, RecordDefinition.Type.Settings, 0, 5, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P29SwitchingHysteresisAsymmetry", 12, 1, 1, RecordDefinition.Type.Settings, 1, 5, 1.0, ""));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P30SwitchingValueIntegralPortionHeating", 13, 2, 1, RecordDefinition.Type.Settings, 1, 999, 1.0, "Kmin"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P31AmountOfUnlockedElectricalBoosterStages", 15, 1, 1, RecordDefinition.Type.Settings, 0, 3, 1.0, ""));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("MaximumFlowTemperatureHeatingMode", 16, 2, 0.1, RecordDefinition.Type.Settings, 10, 75, 0.1, "°C"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P49ChangeoverTemperatureSummerWinter", 18, 2, 0.1, RecordDefinition.Type.Settings, 10, 25, 0.1, "°C"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P50HysteresisChangeoverTemperatureSummerWinter", 20, 2, 0.1, RecordDefinition.Type.Settings, 1, 5, 0.1, "K"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P77OutsideTemperatureAdjustment", 22, 2, 1, RecordDefinition.Type.Settings, 0, 24, 1.0, "h"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P78BivalencePoint", 24, 2, 0.1, RecordDefinition.Type.Settings, -10, 20, 0.1, "°C"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("P79DelayedEnableReheating", 26, 1, 1, RecordDefinition.Type.Settings, 0, 60, 1.0, "min"));
settingsHeating1.getRecordDefinitions().add(new RecordDefinition("OutputElectricalHeatingStage1", 27, 1, 0.1, RecordDefinition.Type.Settings, 0, 10, 1.0, "kW"));
configuration.add(settingsHeating1);
Request settingsHeating2 = new Request("SettingsHeating2", "Read heating setting values", (byte) 0x05);
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P13IncreaseHeatingHC1", 4, 2, 0.1, RecordDefinition.Type.Settings, 1, 5, 0.1, ""));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P14LowEndPointHeatingHC1", 6, 2, 0.1, RecordDefinition.Type.Settings, 1, 20, 0.1, "K"));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P15RoomInfluenceHeatingHC1", 8, 2, 0.1, RecordDefinition.Type.Settings, 1, 10, 0.1, ""));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P16IncreaseHeatingHC2", 10, 1, 0.1, RecordDefinition.Type.Settings, 0, 5, 0.1, ""));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P17LowEndPointHeatingHC2", 11, 2, 0.1, RecordDefinition.Type.Settings, 0, 20, 0.1, "K"));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P18RoomInfluenceHeatingHC2", 13, 2, 0.1, RecordDefinition.Type.Settings, 0, 10, 0.1, ""));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P19TemperatureCaptureReturnFlowHC1", 15, 1, 1.0, RecordDefinition.Type.Settings, 1, 100, 1.0, "%"));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("P20TemperatureCaptureReturnFlowHC2", 16, 2, 1.0, RecordDefinition.Type.Settings, 1, 100, 1.0, "%"));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("MaxSetHeatingCircuitTemperatureHC1", 18, 2, 0.1, RecordDefinition.Type.Settings, 20, 65, 0.1, "°C"));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("MinSetHeatingCircuitTemperatureHC1", 20, 2, 0.1, RecordDefinition.Type.Settings, 5, 40, 0.1, "°C"));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("MaxSetHeatingCircuitTemperatureHC2", 22, 2, 0.1, RecordDefinition.Type.Settings, 20, 65, 0.1, "°C"));
settingsHeating2.getRecordDefinitions().add(new RecordDefinition("MinSetHeatingCircuitTemperatureHC2", 24, 2, 0.1, RecordDefinition.Type.Settings, 5, 40, 0.1, "°C"));
configuration.add(settingsHeating2);
Request settingsEvaporator1 = new Request("SettingsEvaporator1", "Read evaporator settings values", (byte) 0x03);
settingsEvaporator1.getRecordDefinitions().add(new RecordDefinition("UpperLimitEvaporatorTemperatureForDefrostEnd", 4, 2, 0.1, RecordDefinition.Type.Settings, 10, 30, 0.1, "°C"));
settingsEvaporator1.getRecordDefinitions().add(new RecordDefinition("MaxEvaporatorDefrostTime", 6, 2, 1, RecordDefinition.Type.Settings, 2, 20, 1.0, "min"));
settingsEvaporator1.getRecordDefinitions().add(new RecordDefinition("LimitTemperatureCondenserElectricalReheating", 8, 2, 0.1, RecordDefinition.Type.Settings, 10, 30, 0.1, "°C"));
settingsEvaporator1.getRecordDefinitions().add(new RecordDefinition("LimitTemperatureCondenserDefrostTermination", 10, 2, 0.1, RecordDefinition.Type.Settings, 5, 10, 0.1, "°C"));
settingsEvaporator1.getRecordDefinitions().add(new RecordDefinition("P47CompressorRestartDelay", 12, 1, 1, RecordDefinition.Type.Settings, 0, 20, 1.0, "min"));
settingsEvaporator1.getRecordDefinitions().add(new RecordDefinition("P48ExhaustFanSpeed", 13, 1, 1, RecordDefinition.Type.Settings, 10, 100, 1.0, "%"));
configuration.add(settingsEvaporator1);
Request settingsEvaporator2 = new Request("SettingsEvaporator2", "Read evaporator settings values", (byte) 0x04);
settingsEvaporator2.getRecordDefinitions().add(new RecordDefinition("MaxDefrostDurationAAExchanger", 4, 1, 1, RecordDefinition.Type.Settings, 0, 120, 1.0, "min"));
settingsEvaporator2.getRecordDefinitions().add(new RecordDefinition("DefrostStartThreshold", 5, 2, 0.1, RecordDefinition.Type.Settings, 0, 10, 0.1, "%"));
settingsEvaporator2.getRecordDefinitions().add(new RecordDefinition("VolumeFlowFilterReplacement", 7, 2, 1, RecordDefinition.Type.Settings, 50, 100, 1.0, "%"));
settingsEvaporator2.getRecordDefinitions().add(new RecordDefinition("P85DefrostModeAAHE", 9, 1, 1, RecordDefinition.Type.Settings, 1, 5, 1.0, ""));
configuration.add(settingsEvaporator2);
Request settingsDryHeatingProgram = new Request("SettingsDryHeatingProgram", "Read dry heatingprogram settings values", (byte) 0x10);
settingsDryHeatingProgram.getRecordDefinitions().add(new RecordDefinition("P70Start", 4, 1, 1, RecordDefinition.Type.Settings, 0, 0, 1.0, ""));
settingsDryHeatingProgram.getRecordDefinitions().add(new RecordDefinition("P71BaseTemperature", 5, 2, 0.1, RecordDefinition.Type.Settings, 20, 40, 0.1, "°C"));
settingsDryHeatingProgram.getRecordDefinitions().add(new RecordDefinition("P72PeakTemperature", 7, 2, 0.1, RecordDefinition.Type.Settings, 25, 50, 0.1, "°C"));
settingsDryHeatingProgram.getRecordDefinitions().add(new RecordDefinition("P73BaseTemperatureDuration", 9, 2, 1, RecordDefinition.Type.Settings, 0, 5, 1.0, "days"));
settingsDryHeatingProgram.getRecordDefinitions().add(new RecordDefinition("P74Increase", 11, 2, 0.1, RecordDefinition.Type.Settings, 1, 10, 0.1, "K/days"));
configuration.add(settingsDryHeatingProgram);
Request settingsCirculationPump = new Request("SettingsCirculationPump", "Read circulation pump setting values", (byte) 0x0a);
settingsCirculationPump.getRecordDefinitions().add(new RecordDefinition("P54minStartupCycles", 4, 1, 1, RecordDefinition.Type.Settings, 1, 24, 1.0, "per/day"));
settingsCirculationPump.getRecordDefinitions().add(new RecordDefinition("P55maxStartupCycles", 5, 2, 1, RecordDefinition.Type.Settings, 1, 288, 1.0, "per/day"));
settingsCirculationPump.getRecordDefinitions().add(new RecordDefinition("P56OutsideTemperatureMinHeatingCycles", 7, 2, 0.1, RecordDefinition.Type.Settings, 0, 20, 0.1, "°C"));
settingsCirculationPump.getRecordDefinitions().add(new RecordDefinition("P57OutsideTemperatureMaxHeatingCycles", 9, 2, 0.1, RecordDefinition.Type.Settings, 0, 25, 0.1, "°C"));
settingsCirculationPump.getRecordDefinitions().add(new RecordDefinition("P58SuppressTemperatureCaptureDuringPumpStart", 11, 2, 1, RecordDefinition.Type.Settings, 0, 120, 1.0, "sec"));
configuration.add(settingsCirculationPump);
Request settingsHeatingProgram = new Request("SettingsHeatingProgram", "Read heating program 1 and 2 setting values", (byte) 0x0b);
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1StartTime", 4, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1StopTime", 6, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Monday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 7, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Tuesday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 6, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Wednesday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 5, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Thusday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 4, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Friday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 3, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Saturday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 2, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Sunday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP1Enabled", 9, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "On/Off"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2StartTime", 10, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2StopTime", 12, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Monday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 7, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Tuesday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 6, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Wednesday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 5, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Thusday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 4, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Friday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 3, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Saturday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 2, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Sunday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "weekday"));
settingsHeatingProgram.getRecordDefinitions().add(new RecordDefinition("HP2Enabled", 15, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "On/Off"));
configuration.add(settingsHeatingProgram);
Request settingsDomesticWaterProgram = new Request("SettingsDomesticHotWaterProgram", "Read Domestic Water program setting values", (byte) 0x0c);
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1StartTime", 4, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1StopTime", 6, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Monday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 7, "weekday"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Tuesday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 6, "weekday"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Wednesday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 5, "weekday"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Thusday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 4, "weekday"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Friday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 3, "weekday"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Saturday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 2, "weekday"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Sunday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "weekday"));
settingsDomesticWaterProgram.getRecordDefinitions().add(new RecordDefinition("BP1Enabled", 9, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "On/Off"));
configuration.add(settingsDomesticWaterProgram);
Request settingsVentilationProgram = new Request("SettingsVentilationProgram", "Read ventilation program 1 and 2 setting values", (byte) 0x0d);
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1StartTime", 4, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1StopTime", 6, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Monday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 7, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Tuesday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 6, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Wednesday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 5, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Thusday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 4, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Friday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 3, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Saturday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 2, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Sunday", 8, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP1Enabled", 9, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "On/Off"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2StartTime", 10, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2StopTime", 12, 2, 1, RecordDefinition.Type.Settings, 0, 2359, 1.0, "hh:mm"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Monday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 7, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Tuesday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 6, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Wednesday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 5, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Thusday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 4, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Friday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 3, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Saturday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 2, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Sunday", 14, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "weekday"));
settingsVentilationProgram.getRecordDefinitions().add(new RecordDefinition("LP2Enabled", 15, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1, 1, "On/Off"));
configuration.add(settingsVentilationProgram);
Request settingsAbsenceProgram = new Request("SettingsAbsenceProgram", "Read absence program setting values", (byte) 0x0f);
settingsAbsenceProgram.getRecordDefinitions().add(new RecordDefinition("AP0DurationUntilAbsenceStart", 4, 2, 0.1, RecordDefinition.Type.Settings, 0, 2388, 0.1, "h"));
settingsAbsenceProgram.getRecordDefinitions().add(new RecordDefinition("AP0AbsenceDuration", 6, 2, 0.1, RecordDefinition.Type.Settings, 0, 2388, 0.1, "h"));
settingsAbsenceProgram.getRecordDefinitions().add(new RecordDefinition("AP0EnableAbsenceProgram", 7, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1.0, ""));
configuration.add(settingsAbsenceProgram);
Request settingsRestartTime = new Request("SettingsRestartAndMixerTime", "Read restart and mixer time setting values", (byte) 0x0e);
settingsRestartTime.getRecordDefinitions().add(new RecordDefinition("P59RestartBeforSetbackEnd", 4, 2, 1, RecordDefinition.Type.Settings, 0, 300, 1.0, "min"));
settingsRestartTime.getRecordDefinitions().add(new RecordDefinition("MixerProportionalRange", 6, 2, 0.1, RecordDefinition.Type.Settings, 1, 100, 0.1, "%"));
settingsRestartTime.getRecordDefinitions().add(new RecordDefinition("DerivativeMixerTime", 8, 2, 0.1, RecordDefinition.Type.Settings, 1, 100, 0.1, "sec"));
settingsRestartTime.getRecordDefinitions().add(new RecordDefinition("MixerTimeInterval", 10, 2, 1, RecordDefinition.Type.Settings, 1, 10, 0.1, "K/day"));
configuration.add(settingsRestartTime);
Request SettingsDomesticHotWater = new Request("SettingsDomesticHotWater", "Read Domestic Water setting values", (byte) 0x07);
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("P32StartupHysteresisDHWTemperature", 4, 1, 0.1, RecordDefinition.Type.Settings, 2, 10, 0.1, "K"));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("P33TimeDelayElectricalReheating", 5, 1, 1.0, RecordDefinition.Type.Settings, 0, 240, 1.0, "min"));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("P34OutsideTemperatureLimitForImmElectricalReheating", 6, 2, 0.1, RecordDefinition.Type.Settings, -10, 10, 1.0, "°C"));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("P35PasteurisationInterval", 8, 1, 1.0, RecordDefinition.Type.Settings, 1, 30, 1.0, "K/day"));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("P36MaxDurationDHWLoading", 9, 1, 1.0, RecordDefinition.Type.Settings, 6, 12, 1.0, "h"));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("PasteurisationHeatupTemperature", 10, 2, 0.1, RecordDefinition.Type.Settings, 10, 65, 0.1, "°C"));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("NoOfEnabledElectricalReheatStagesDHWLoading", 12, 1, 1, RecordDefinition.Type.Settings, 0, 3, 1.0, ""));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("MaxFlowTemperatureDHWMode", 13, 2, 0.1, RecordDefinition.Type.Settings, 10, 75, 0.1, "°C"));
SettingsDomesticHotWater.getRecordDefinitions().add(new RecordDefinition("CompressorShutdownDHWLoading", 15, 1, 1, RecordDefinition.Type.Settings, 0, 1, 1.0, ""));
configuration.add(SettingsDomesticHotWater);
return configuration;
}
use of org.openhab.binding.stiebelheatpump.protocol.RecordDefinition in project openhab1-addons by openhab.
the class CommunicationService method categorizeHeatPumpConfiguration.
/**
* This method categorize the heat pump configuration into setting, sensor
* and status
*
* @return true if heat pump configuration for version could be found and
* loaded
*/
private boolean categorizeHeatPumpConfiguration() {
for (Request request : heatPumpConfiguration) {
logger.debug("Request : Name -> {}, Description -> {} , RequestByte -> {}", request.getName(), request.getDescription(), DatatypeConverter.printHexBinary(new byte[] { request.getRequestByte() }));
if (request.getName().equalsIgnoreCase("Version")) {
versionRequest = request;
logger.debug("Loaded Request : " + versionRequest.getDescription());
continue;
}
for (RecordDefinition record : request.getRecordDefinitions()) {
if (record.getDataType() == Type.Settings && !heatPumpSettingConfiguration.contains(request)) {
heatPumpSettingConfiguration.add(request);
}
if (record.getDataType() == Type.Status && !heatPumpStatusConfiguration.contains(request)) {
heatPumpStatusConfiguration.add(request);
}
if (record.getDataType() == Type.Sensor && !heatPumpSensorConfiguration.contains(request)) {
heatPumpSensorConfiguration.add(request);
}
}
}
if (versionRequest == null) {
logger.debug("version request could not be found in configuration");
return false;
}
return true;
}
Aggregations