Skip to content

Commit

Permalink
[kermi] Added all channels of XCenter
Browse files Browse the repository at this point in the history
Signed-off-by: Kai Neuhaus <[email protected]>
  • Loading branch information
KaaNee committed May 7, 2024
1 parent fbda860 commit 1a5a6af
Show file tree
Hide file tree
Showing 28 changed files with 1,114 additions and 173 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,47 @@ public class KermiBindingConstants {
// Supported Thing Types
public static final ThingTypeUID THING_TYPE_KERMI_XCENTER = new ThingTypeUID(BINDING_ID, "kermi-xcenter");

// Channels for State Block
// Channels for State
public static final String GLOBAL_STATE_CHANNEL = "global-state";
public static final String GLOBAL_STATE_ID_CHANNEL = "global-state-id";

// Alarm State
public static final String ALARM_STATE_CHANNEL = "alarm-state";

// Energy Source
public static final String FLOW_TEMPERATURE_CHANNEL = "flow-temperature";
public static final String RETURN_TEMPERATURE_CHANNEL = "return-temperature";
public static final String FLOW_SPEED_CHANNEL = "flow-speed";

// Charging Circuit
public static final String EXIT_TEMPERATURE_CHANNEL = "exit-temperature";
public static final String INCOMING_TEMPERATURE_CHANNEL = "incoming-temperature";
public static final String TEMPERATURE_SENSOR_OUTSIDE_CHANNEL = "temperature-sensor-outside";

// Power
public static final String COP_CHANNEL = "cop";
public static final String COP_HEATING_CHANNEL = "cop-heating";
public static final String COP_DRINKINGWATER_CHANNEL = "cop-drinkingwater";
public static final String COP_COOLING_CHANNEL = "cop-cooling";

public static final String POWER_CHANNEL = "power";
public static final String POWER_HEATING_CHANNEL = "power-heating";
public static final String POWER_DRINKINGWATER_CHANNEL = "power-drinkingwater";
public static final String POWER_COOLING_CHANNEL = "power-cooling";

public static final String ELECTRIC_POWER_CHANNEL = "electric-power";
public static final String ELECTRIC_POWER_HEATING_CHANNEL = "electric-power-heating";
public static final String ELECTRIC_POWER_DRINKINGWATER_CHANNEL = "electric-power-drinkingwater";
public static final String ELECTRIC_POWER_COOLING_CHANNEL = "electric-power-cooling";

// Work hours
public static final String WORKHOURS_FAN_CHANNEL = "workhours-fan";
public static final String WORKHOURS_STORAGE_LOADING_PUMP_CHANNEL = "workhours-storage-loading-pump";
public static final String WORKHOURS_COMPRESSOR_CHANNEL = "workhours-compressor";

// PV
public static final String PV_STATE_CHANNEL = "pv-state";
public static final String PV_POWER_CHANNEL = "pv-power";
public static final String PV_TARGET_TEMPERATURE_HEATING_CHANNEL = "pv-target-temperature-heating";
public static final String PV_TARGET_TEMPERATURE_DRINKINGWATER_CHANNEL = "pv-target-temperature-drinkingwater";
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
public class KermiConfiguration {

public int refresh = 5000;
public boolean pvEnabled = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.modbus.kermi.internal.dto;

import static org.openhab.binding.modbus.kermi.internal.modbus.KermiModbusConstans.ALARM_REG_SIZE;

import org.openhab.binding.modbus.kermi.internal.modbus.Data;
import org.openhab.core.io.transport.modbus.ModbusBitUtilities;
import org.openhab.core.library.types.OnOffType;

/**
* The {@link AlarmDTO} Data object for Kermi Xcenter
*
* @author Kai Neuhaus - Initial contribution
*/
public class AlarmDTO implements Data {

public OnOffType alarmIsActive;

public AlarmDTO(byte[] bArray) {
int status = ModbusBitUtilities.extractBit(bArray, ALARM_REG_SIZE);
alarmIsActive = status == 0 ? OnOffType.OFF : OnOffType.ON;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.modbus.kermi.internal.dto;

import static org.openhab.core.library.unit.Units.LITRE_PER_MINUTE;

import javax.measure.quantity.Temperature;

import org.openhab.binding.modbus.kermi.internal.modbus.Data;
import org.openhab.core.io.transport.modbus.ValueBuffer;
import org.openhab.core.library.dimension.VolumetricFlowRate;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;

/**
* The {@link ChargingCircuitDTO} Data object for Kermi Xcenter
*
* @author Kai Neuhaus - Initial contribution
*/
public class ChargingCircuitDTO implements Data {

public QuantityType<Temperature> flowTemperature;
public QuantityType<Temperature> returnFlowTemperature;
public QuantityType<VolumetricFlowRate> flowSpeed;

public ChargingCircuitDTO(byte[] bArray) {
ValueBuffer wrap = ValueBuffer.wrap(bArray);
flowTemperature = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), SIUnits.CELSIUS);
returnFlowTemperature = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), SIUnits.CELSIUS);
flowSpeed = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), LITRE_PER_MINUTE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.modbus.kermi.internal.dto;

import javax.measure.quantity.Temperature;

import org.openhab.binding.modbus.kermi.internal.modbus.Data;
import org.openhab.core.io.transport.modbus.ValueBuffer;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;

/**
* The {@link EnergySourceDTO} Data object for Kermi Xcenter
*
* @author Kai Neuhaus - Initial contribution
*/
public class EnergySourceDTO implements Data {

public QuantityType<Temperature> exitTemperature;
public QuantityType<Temperature> incomingTemperature;
public QuantityType<Temperature> outsideTemperature;

public EnergySourceDTO(byte[] bArray) {
ValueBuffer wrap = ValueBuffer.wrap(bArray);
exitTemperature = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), SIUnits.CELSIUS);
incomingTemperature = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), SIUnits.CELSIUS);
outsideTemperature = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), SIUnits.CELSIUS);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.modbus.kermi.internal.dto;

import javax.measure.quantity.Power;

import org.openhab.binding.modbus.kermi.internal.modbus.Data;
import org.openhab.core.io.transport.modbus.ValueBuffer;
import org.openhab.core.library.types.DecimalType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.Units;

/**
* The {@link PowerDTO} Data object for Kermi Xcenter State Block
*
* @author Kai Neuhaus - Initial contribution
*/
public class PowerDTO implements Data {

public DecimalType cop;
public DecimalType copHeating;
public DecimalType copDrinkingwater;
public DecimalType copCooling;

public QuantityType<Power> power;
public QuantityType<Power> powerHeating;
public QuantityType<Power> powerDrinkingwater;
public QuantityType<Power> powerCooling;

public QuantityType<Power> electricPower;
public QuantityType<Power> electricPowerHeating;
public QuantityType<Power> electricPowerDrinkingwater;
public QuantityType<Power> electricPowerCooling;

public PowerDTO(byte[] bArray) {

ValueBuffer wrap = ValueBuffer.wrap(bArray);

cop = new DecimalType(DataConverter.getUDoubleValue(wrap, 0.1));
copHeating = new DecimalType(DataConverter.getUDoubleValue(wrap, 0.1));
copDrinkingwater = new DecimalType(DataConverter.getUDoubleValue(wrap, 0.1));
copCooling = new DecimalType(DataConverter.getUDoubleValue(wrap, 0.1));

power = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);
powerHeating = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);
powerDrinkingwater = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);
powerCooling = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);

electricPower = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);
electricPowerHeating = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);
electricPowerDrinkingwater = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);
electricPowerCooling = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 100), Units.WATT);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.modbus.kermi.internal.dto;

import javax.measure.quantity.Power;
import javax.measure.quantity.Temperature;

import org.openhab.binding.modbus.kermi.internal.modbus.Data;
import org.openhab.core.io.transport.modbus.ModbusBitUtilities;
import org.openhab.core.io.transport.modbus.ValueBuffer;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.SIUnits;
import org.openhab.core.library.unit.Units;

/**
* The {@link PvDTO} Data object for Kermi Xcenter
*
* @author Kai Neuhaus - Initial contribution
*/
public class PvDTO implements Data {

public OnOffType pvModulationActive;
public QuantityType<Power> pvModulationPower;
public QuantityType<Temperature> pvTargetTemperatureHeating;
public QuantityType<Temperature> pvTargetTemperatureDrinkingwater;

public PvDTO(byte[] bArray) {

int modActive = ModbusBitUtilities.extractBit(bArray, 0);
pvModulationActive = modActive == 0 ? OnOffType.OFF : OnOffType.ON;

ValueBuffer wrap = ValueBuffer.wrap(bArray);
// skip first bit -> modActive-Value
wrap.position(2);

pvModulationPower = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), Units.WATT);
pvTargetTemperatureHeating = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), SIUnits.CELSIUS);
pvTargetTemperatureDrinkingwater = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1),
SIUnits.CELSIUS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
import org.openhab.core.library.types.StringType;

/**
* The {@link StateDTO} Data object for Kermi Xcenter State Block
* The {@link StateDTO} Data object for Kermi Xcenter
*
* @author Kai Neuhaus - Initial contribution
*/
public class StateDTO implements Data {

public StringType globalState = STATE_UNKOWN;
public DecimalType globalStateId = new DecimalType(-1);
public StringType globalState;
public DecimalType globalStateId;

// State definitions
public static final StringType STATE_STANDBY = StringType.valueOf("Standby");
Expand All @@ -45,7 +45,7 @@ public class StateDTO implements Data {

public StateDTO(byte[] bArray) {

int status = ModbusBitUtilities.extractUInt16(bArray, 0);
int status = ModbusBitUtilities.extractBit(bArray, 0);

globalStateId = new DecimalType(status);

Expand All @@ -54,11 +54,5 @@ public StateDTO(byte[] bArray) {
} else {
globalState = STATE_UNKOWN;
}
//
// // index handling to calculate the correct start index
// ValueBuffer wrap = ValueBuffer.wrap(bArray);
//
// // int32_swap value = 4 byte
// int globalState = wrap.getUInt16();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.modbus.kermi.internal.dto;

import javax.measure.quantity.Time;

import org.openhab.binding.modbus.kermi.internal.modbus.Data;
import org.openhab.core.io.transport.modbus.ValueBuffer;
import org.openhab.core.library.types.QuantityType;
import org.openhab.core.library.unit.Units;

/**
* The {@link WorkHoursDTO} Data object for Kermi Xcenter State Block
*
* @author Kai Neuhaus - Initial contribution
*/
public class WorkHoursDTO implements Data {

public QuantityType<Time> workHoursFan;
public QuantityType<Time> workHoursStorageLoadingPump;
public QuantityType<Time> workHoursCompressor;

public WorkHoursDTO(byte[] bArray) {

ValueBuffer wrap = ValueBuffer.wrap(bArray);

workHoursFan = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), Units.HOUR);
workHoursStorageLoadingPump = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), Units.HOUR);
workHoursCompressor = QuantityType.valueOf(DataConverter.getUDoubleValue(wrap, 0.1), Units.HOUR);
}
}
Loading

0 comments on commit 1a5a6af

Please sign in to comment.