这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public enum SwegonVentilationCommandType {
T1("T1", NumberItem.class), // Temperature sensor, outdoor air
T2("T2", NumberItem.class), // Temperature sensor, supply air
T3("T3", NumberItem.class), // Temperature sensor, extract air
T4("T4", NumberItem.class), // Temperature sensor, supply air, reheating
T4("T4", NumberItem.class), // Temperature sensor, supply air, re-heating
T5("T5", NumberItem.class),
T6("T6", NumberItem.class), // The freeze protection sensor of the water-heated air heater
T7("T7", NumberItem.class), // Excess temperature sensor for the preheating air heater
T7("T7", NumberItem.class), // Excess temperature sensor for the pre-heating air heater
T8("T8", NumberItem.class), // Temperature sensor, exhaust air, freeze protection
OUTDOOR_TEMP("OutdoorTemperature", NumberItem.class), // T1
SUPPLY_TEMP("SupplyAirTemperature", NumberItem.class), // T2
Expand All @@ -42,7 +42,47 @@ public enum SwegonVentilationCommandType {
EFFICIENCY_EXTRACT("EfficiencyExtract", NumberItem.class),
FAN_SPEED("FanSpeed", NumberItem.class),
PREHEAT_STATE("PreheatState", SwitchItem.class),
REHEAT_STATE("ReheatState", SwitchItem.class),;
REHEAT_STATE("ReheatState", SwitchItem.class),
CO2("CO2", NumberItem.class),
HUMIDITY("Humidity", NumberItem.class),
OPERATING_MODE("OperatingMode", NumberItem.class),
UNIT_STATE("UnitState", NumberItem.class),
HEATING_STATE("HeatingState", SwitchItem.class),
COOLING_STATE("CoolingState", SwitchItem.class),
BYBASS_STATE("BybassState", SwitchItem.class),
FREEZE_PROTECTION_STATE("FreezeProtectionState", SwitchItem.class),
PREHEATING_STATE("PreheatingState", SwitchItem.class),
CHILLING_STATE("ChillingState", SwitchItem.class),
PREHEATER_OVERHEAT_STATE("PreheaterOverheatState", SwitchItem.class),
REHEATING_STATE("ReheatingState", SwitchItem.class),
FIREPLACE_FUNCTION_STATE("FireplaceFunctionState", SwitchItem.class),
UNDERPRESSURE_COMPENSATION_STATE("UnderpressureCompensationState", SwitchItem.class),
EXTERNAL_BOOST_STATE("ExternalBoostState", SwitchItem.class),
HUMIDITY_BOOST_STATE("HumidityBoostState", SwitchItem.class),
CO2_BOOST_STATE("CO2State", SwitchItem.class),
DEFROSTING_STATE("DefrostingState", SwitchItem.class),
DEFROST_STARTER_MODE("DefrostingStarterMode", NumberItem.class),
TF_STOP_STATE("TFStopState", SwitchItem.class),
EXTERNAL_BOOST_FUNCTION_STATE("ExternalBoostFunctionState", SwitchItem.class),
EXTERNAL_FIREPLACE_FUNCTION_STATE("ExternalFireplaceFunctionState", SwitchItem.class),
FILTER_GUARD_STATUS("FilterGuardStatus", SwitchItem.class),
IR_FREEZE_PROTECTION_STATUS("IRFreezeProctionStatus", SwitchItem.class),
EMERGENCY_STOP_STATE("EmergencyStopState", SwitchItem.class),
REHEATING_FREEZING_ALARM("ReheatingFreezingAlarm", SwitchItem.class),
REHEATING_OVERHEAT_ALARM("ReheatingOverheatAlarm", SwitchItem.class),
IR_SENSOR_FAILURE("IRSensorFailure", SwitchItem.class),
SUPPLY_FAN_FAILURE("SupplyFanFailure", SwitchItem.class),
EXTRACT_FAN_FAILURE("ExtractFanFailure", SwitchItem.class),
TEMPERATURE_DEVIATION_FAILURE("TemperatureDeviationFailure", SwitchItem.class),
EFFICINECY_ALARM("EfficiencyAlarm", SwitchItem.class),
FILTER_GUARD_ALARM("FilterGuardAlarm", SwitchItem.class),
SERVICE_REMINDER("ServiceReminder", SwitchItem.class),
TEMPERATURE_FAILURE("TemperatureFailure", SwitchItem.class),
AFTERHEATING_SETPOINT_SUPPLY_AIR_REGULATED("AfterheatingSetpointSupplyAirRegulated", NumberItem.class),
AFTERHEATING_SETPOINT_ROOM_REGULATED("AfterheatingSetpointRoomRegulated", NumberItem.class),
SUPPLY_FAN_VIRTUAL_SPEED("SupplyFanVirtualSpeed", NumberItem.class),
EXTRACT_FAN_VIRTUAL_SPEED("ExtractFanVirtualSpeed", NumberItem.class),
UNIT_STATUS("UnitStatus", NumberItem.class);

private final String text;
private Class<? extends Item> itemClass;
Expand All @@ -63,7 +103,7 @@ public Class<? extends Item> getItemClass() {

/**
* Procedure to validate command type string.
*
*
* @param commandTypeText
* command string e.g. T1
* @return true if item is valid.
Expand Down Expand Up @@ -92,7 +132,7 @@ public static boolean validateBinding(String commandTypeText, Class<? extends It

/**
* Procedure to convert command type string to command type class.
*
*
* @param commandTypeText
* command string e.g. T1
* @return corresponding command type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ private static HashMap<SwegonVentilationCommandType, Integer> parseMessage21(byt

HashMap<SwegonVentilationCommandType, Integer> map = new HashMap<SwegonVentilationCommandType, Integer>();

map.put(SwegonVentilationCommandType.FAN_SPEED, data[3] & 0x0F);
int operatingMode = data[0];
int unitState = data[1];
int fanSpeed = data[3] & 0x0F;

map.put(SwegonVentilationCommandType.OPERATING_MODE, operatingMode);
map.put(SwegonVentilationCommandType.UNIT_STATE, unitState);
map.put(SwegonVentilationCommandType.FAN_SPEED, fanSpeed);

return map;
}
Expand All @@ -74,7 +80,15 @@ private static HashMap<SwegonVentilationCommandType, Integer> parseMessage71(byt
int supplyTemp = data[1];
int extractTemp = data[2];
int supplyTempHeated = data[3];
int t5 = data[4];
int t6 = data[5];
int t7 = data[6];
int exhaustTemp = data[7];
int co2 = data[8];
int rh = data[9];
int supplyFanSpeed = (data[10] & 0xFF) * 10;
int extractFanSpeed = (data[11] & 0xFF) * 10;
int efficiency = data[12];

map.put(SwegonVentilationCommandType.T1, outdoorTemp);
map.put(SwegonVentilationCommandType.OUTDOOR_TEMP, outdoorTemp);
Expand All @@ -86,24 +100,24 @@ private static HashMap<SwegonVentilationCommandType, Integer> parseMessage71(byt
map.put(SwegonVentilationCommandType.SUPPLY_TEMP_HEATED, supplyTempHeated);
map.put(SwegonVentilationCommandType.T8, exhaustTemp);
map.put(SwegonVentilationCommandType.EXHAUST_TEMP, exhaustTemp);

map.put(SwegonVentilationCommandType.T5, (int) data[4]);
map.put(SwegonVentilationCommandType.T6, (int) data[5]);
map.put(SwegonVentilationCommandType.T7, (int) data[6]);

map.put(SwegonVentilationCommandType.SUPPLY_AIR_FAN_SPEED, (data[10] & 0xFF) * 10);
map.put(SwegonVentilationCommandType.EXTRACT_AIR_FAN_SPEED, (data[11] & 0xFF) * 10);
map.put(SwegonVentilationCommandType.EFFICIENCY, (int) data[12]);
map.put(SwegonVentilationCommandType.T5, t5);
map.put(SwegonVentilationCommandType.T6, t6);
map.put(SwegonVentilationCommandType.T7, t7);
map.put(SwegonVentilationCommandType.CO2, co2);
map.put(SwegonVentilationCommandType.HUMIDITY, rh);
map.put(SwegonVentilationCommandType.SUPPLY_AIR_FAN_SPEED, supplyFanSpeed);
map.put(SwegonVentilationCommandType.EXTRACT_AIR_FAN_SPEED, extractFanSpeed);
map.put(SwegonVentilationCommandType.EFFICIENCY, efficiency);

// Calculate supply efficiency
int efficiency = (int) (((double) supplyTemp - (double) outdoorTemp)
int calcEfficiency = (int) (((double) supplyTemp - (double) outdoorTemp)
/ ((double) extractTemp - (double) outdoorTemp) * 100);
map.put(SwegonVentilationCommandType.EFFICIENCY_SUPPLY, efficiency);
map.put(SwegonVentilationCommandType.EFFICIENCY_SUPPLY, calcEfficiency);

// Calculate extract efficiency
efficiency = (int) (((double) extractTemp - (double) exhaustTemp)
calcEfficiency = (int) (((double) extractTemp - (double) exhaustTemp)
/ ((double) extractTemp - (double) outdoorTemp) * 100);
map.put(SwegonVentilationCommandType.EFFICIENCY_EXTRACT, efficiency);
map.put(SwegonVentilationCommandType.EFFICIENCY_EXTRACT, calcEfficiency);

return map;
}
Expand All @@ -112,10 +126,50 @@ private static HashMap<SwegonVentilationCommandType, Integer> parseMessage73(byt

HashMap<SwegonVentilationCommandType, Integer> map = new HashMap<SwegonVentilationCommandType, Integer>();

map.put(SwegonVentilationCommandType.REHEAT_STATE, (data[0] & 0x80) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.HEATING_STATE, (data[0] & 0x01) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.COOLING_STATE, (data[0] & 0x02) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.BYBASS_STATE, (data[0] & 0x04) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.FREEZE_PROTECTION_STATE, (data[0] & 0x08) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.PREHEAT_STATE, (data[0] & 0x10) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.PREHEATING_STATE, (data[0] & 0x10) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.CHILLING_STATE, (data[0] & 0x20) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.PREHEATER_OVERHEAT_STATE, (data[0] & 0x40) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.REHEAT_STATE, (data[0] & 0x80) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.REHEATING_STATE, (data[0] & 0x80) > 0 ? 1 : 0);

map.put(SwegonVentilationCommandType.FIREPLACE_FUNCTION_STATE, (data[1] & 0x01) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.UNDERPRESSURE_COMPENSATION_STATE, (data[1] & 0x02) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.EXTERNAL_BOOST_STATE, (data[1] & 0x04) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.HUMIDITY_BOOST_STATE, (data[1] & 0x08) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.CO2_BOOST_STATE, (data[1] & 0x10) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.DEFROSTING_STATE, (data[1] & 0x20) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.DEFROST_STARTER_MODE, (data[1] & 0x40));
map.put(SwegonVentilationCommandType.TF_STOP_STATE, (data[1] & 0x80) > 0 ? 1 : 0);

map.put(SwegonVentilationCommandType.EXTERNAL_BOOST_FUNCTION_STATE, (data[3] & 0x04) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.EXTERNAL_FIREPLACE_FUNCTION_STATE, (data[3] & 0x08) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.FILTER_GUARD_STATUS, (data[3] & 0x10) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.IR_FREEZE_PROTECTION_STATUS, (data[3] & 0x20) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.EMERGENCY_STOP_STATE, (data[3] & 0x80) > 0 ? 1 : 0);

map.put(SwegonVentilationCommandType.REHEATING_FREEZING_ALARM, (data[7] & 0x01) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.REHEATING_OVERHEAT_ALARM, (data[7] & 0x02) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.IR_SENSOR_FAILURE, (data[7] & 0x04) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.SUPPLY_FAN_FAILURE, (data[7] & 0x08) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.EXTRACT_FAN_FAILURE, (data[7] & 0x10) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.TEMPERATURE_DEVIATION_FAILURE, (data[7] & 0x20) > 0 ? 1 : 0);

map.put(SwegonVentilationCommandType.EFFICINECY_ALARM, (data[8] & 0x01) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.FILTER_GUARD_ALARM, (data[8] & 0x02) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.SERVICE_REMINDER, (data[8] & 0x04) > 0 ? 1 : 0);
map.put(SwegonVentilationCommandType.TEMPERATURE_FAILURE, (data[8] & 0x08) > 0 ? 1 : 0);

map.put(SwegonVentilationCommandType.AFTERHEATING_SETPOINT_SUPPLY_AIR_REGULATED, (int) data[10]);
map.put(SwegonVentilationCommandType.AFTERHEATING_SETPOINT_ROOM_REGULATED, (int) data[11]);
map.put(SwegonVentilationCommandType.SUPPLY_FAN_VIRTUAL_SPEED, (int) data[12]);
map.put(SwegonVentilationCommandType.EXTRACT_FAN_VIRTUAL_SPEED, (int) data[13]);
map.put(SwegonVentilationCommandType.UNIT_STATUS, (int) data[14]);

return map;
}

}