diff --git a/bundles/binding/org.openhab.binding.swegonventilation/src/main/java/org/openhab/binding/swegonventilation/internal/SwegonVentilationCommandType.java b/bundles/binding/org.openhab.binding.swegonventilation/src/main/java/org/openhab/binding/swegonventilation/internal/SwegonVentilationCommandType.java index 6c38c787669..14db321d3f9 100644 --- a/bundles/binding/org.openhab.binding.swegonventilation/src/main/java/org/openhab/binding/swegonventilation/internal/SwegonVentilationCommandType.java +++ b/bundles/binding/org.openhab.binding.swegonventilation/src/main/java/org/openhab/binding/swegonventilation/internal/SwegonVentilationCommandType.java @@ -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 @@ -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 itemClass; @@ -63,7 +103,7 @@ public Class getItemClass() { /** * Procedure to validate command type string. - * + * * @param commandTypeText * command string e.g. T1 * @return true if item is valid. @@ -92,7 +132,7 @@ public static boolean validateBinding(String commandTypeText, Class parseMessage21(byt HashMap map = new HashMap(); - 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; } @@ -74,7 +80,15 @@ private static HashMap 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); @@ -86,24 +100,24 @@ private static HashMap 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; } @@ -112,10 +126,50 @@ private static HashMap parseMessage73(byt HashMap map = new HashMap(); - 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; } - }