Skip to content

Commit

Permalink
Bugfixing
Browse files Browse the repository at this point in the history
Bugfixing
  • Loading branch information
andrasU committed Feb 1, 2023
1 parent 5aa5c00 commit 7457a58
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ public boolean createChannelFromJson(String deviceLabel, String channelId, JsonO

break;
}
case FID_DIMMING_SENSOR: {
this.channelId = channelId;

logger.info("Dimming sensor channel found - Channel FID: {}", channelFunctionID);

FreeAtHomeDatapointGroup newDatapointGroup = new FreeAtHomeDatapointGroup();
newDatapointGroup.addDatapointToGroup(DATAPOINT_DIRECTION_OUTPUT, 272, channelId, channelObject);

datapointGroups.add(newDatapointGroup);

break;
}
case FID_TRIGGER:
case FID_SWITCH_ACTUATOR: {
this.channelId = channelId;
Expand Down Expand Up @@ -159,6 +171,14 @@ public boolean createChannelFromJson(String deviceLabel, String channelId, JsonO
newDatapointGroup.addDatapointToGroup(DATAPOINT_DIRECTION_INPUT, 66, channelId, channelObject);
datapointGroups.add(newDatapointGroup);

// Additional channel for RTC device
if (HexUtils
.getIntegerFromHex(channelFunctionID) == FID_ROOM_TEMPERATURE_CONTROLLER_MASTER_WITHOUT_FAN) {
newDatapointGroup = new FreeAtHomeDatapointGroup();
newDatapointGroup.addDatapointToGroup(DATAPOINT_DIRECTION_OUTPUT, 48, channelId, channelObject);
datapointGroups.add(newDatapointGroup);
}

break;
}
case FID_WINDOW_DOOR_POSITION_SENSOR:
Expand Down Expand Up @@ -222,7 +242,7 @@ public boolean createChannelFromJson(String deviceLabel, String channelId, JsonO
logger.info("Door ring sensor channel - Channel FID: {}", channelFunctionID);

FreeAtHomeDatapointGroup newDatapointGroup = new FreeAtHomeDatapointGroup();
newDatapointGroup.addDatapointToGroup(DATAPOINT_DIRECTION_INPUT, 2, channelId, channelObject);
newDatapointGroup.addDatapointToGroup(DATAPOINT_DIRECTION_OUTPUT, 2, channelId, channelObject);

datapointGroups.add(newDatapointGroup);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ public void onWebSocketConnect(Session session) {
super.onWebSocketConnect(session);

if (closureLatch != null) {
logger.debug("Socket Connected - latch [ {} ] - sesson: {}", closureLatch.getCount(), session);
session.setIdleTimeout(60 * 60 * 1000);

logger.debug("Socket Connected - Timeout {} - latch [ {} ] - sesson: {}", session.getIdleTimeout(),
closureLatch.getCount(), session);

} else {
logger.debug("Socket Connected - but latch was not initialized - sesson: {}", session);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Base64;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -542,12 +543,13 @@ public boolean connectWebsocketSession() {
try {
// Start socket client
if ((websocketClient != null) && (socket != null)) {
websocketClient.setMaxTextMessageBufferSize(8 * 1024);
websocketClient.setMaxIdleTimeout(BRIDGE_WEBSOCKET_RECONNECT_DELAY * 60 * 1000);
websocketClient.start();
ClientUpgradeRequest request = new ClientUpgradeRequest();
request.setHeader("Authorization", authField);
request.setTimeout(BRIDGE_WEBSOCKET_RECONNECT_DELAY, TimeUnit.SECONDS);
websocketClient.connect(socket, uri, request);
websocketClient.setMaxIdleTimeout(3000000);

logger.debug("Websocket connection to SysAP is OK");

Expand Down Expand Up @@ -633,7 +635,7 @@ public boolean openWebSocketConnection() {
}

if (websocketClient == null) {
websocketClient = new WebSocketClient();
websocketClient = new WebSocketClient(httpClient);

if (websocketClient != null) {
websocketClient.setExecutor(jettyThreadPool);
Expand Down Expand Up @@ -725,6 +727,17 @@ public void initialize() {
FreeAtHomeBridgeHandler.freeAtHomeSystemHandler = this;
}

public void handleConfigurationUpdate(Map<String, Object> configurationParameters) {
super.handleConfigurationUpdate(configurationParameters);

// load configuration
FreeAtHomeBridgeHandlerConfiguration locConfig = getConfigAs(FreeAtHomeBridgeHandlerConfiguration.class);

ipAddress = locConfig.ipaddress;
password = locConfig.password;
username = locConfig.username;
}

/**
* Method to dispose
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
*/
public class FreeAtHomeDeviceHandler extends FreeAtHomeSystemBaseHandler {

private static final int VIRTUAL_DEVICE_KEEPALIVETIME_TIMEOUT_IN_MINUTE = 5;

private static final String CHANNEL_URI = "channel-type:freeathomesystem:config";

private final Logger logger = LoggerFactory.getLogger(FreeAtHomeDeviceHandler.class);
Expand All @@ -71,6 +73,7 @@ public class FreeAtHomeDeviceHandler extends FreeAtHomeSystemBaseHandler {
private static URI configDescriptionUriChannel;

private Map<ChannelUID, FreeAtHomeDatapointGroup> mapChannelUID = new HashMap<ChannelUID, FreeAtHomeDatapointGroup>();
private Map<ChannelUID, String> mapChannelUIDVal = new HashMap<ChannelUID, String>();

public FreeAtHomeDeviceHandler(Thing thing, FreeAtHomeChannelTypeProvider channelTypeProvider,
FreeAtHomeChannelGroupTypeProvider channelGroupTypeProvider) {
Expand Down Expand Up @@ -151,6 +154,11 @@ public void handleCommand(ChannelUID channelUID, Command command) {
ValueStateConverter vsc = dpg.getValueStateConverter();

updateState(channelUID, vsc.convertToState(valueStr));

// in case of virtual channels store the current value string
if (device.isVirtual()) {
mapChannelUIDVal.put(channelUID, valueStr);
}
} else {
ValueStateConverter vsc = dpg.getValueStateConverter();

Expand All @@ -171,6 +179,15 @@ public void handleCommand(ChannelUID channelUID, Command command) {
} else {
updateState(channelUID, new StringType("STOP"));
}

// in case of virtual channels store the current value string
if (device.isVirtual()) {

logger.info("refresh virtual device state device: {} ch: {} val: {}", deviceID,
channelUID.getAsString(), valueString);

mapChannelUIDVal.put(channelUID, valueString);
}
}

if (device.isScene()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ private static PIdContainerClass createFreeAtHomePairingIdTranslation(String p1,
"Force-position blind", "Forces value dependent high priority up or down state"));
mapDescObj.put("0x0029", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_INTEGER, CATEGORY_UNDEFINED, "", "",
"Window/Door position", "Delivers position for Window/Door (Open / Tilted / Closed)"));
mapDescObj.put("0x0030", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_INTEGER, CATEGORY_UNDEFINED, "", "",
"Actuating Value Heating", "Determines the through flow volume of the control valve"));
mapDescObj.put("0x0030", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_INTEGER, CATEGORY_TEMPERATURE, "",
"", "Actuating Value Heating", "Determines the through flow volume of the control valve"));
mapDescObj.put("0x0031", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_INTEGER, CATEGORY_UNDEFINED, "", "",
"Fan Level Heating", "Display value of the fan coil speed. (0=off / 1=lowest - 5=fastest)"));
mapDescObj.put("0x0032", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_INTEGER, CATEGORY_TEMPERATURE, "",
Expand Down Expand Up @@ -524,6 +524,7 @@ private static PIdContainerClass createFreeAtHomePairingIdTranslation(String p1,
mapDescObj.put("0xFF04", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_UNKNOWN, CATEGORY_UNDEFINED, "", "",
"Measured temperature 4", "For debug purposes"));

// new values missing original documentation
mapDescObj.put("0x061A", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_DECIMAL, CATEGORY_PRESSURE, "", "",
"Air Quality - Pressure value", "Air quality sensor value - Pressure value"));
mapDescObj.put("0x061B", createFreeAtHomePairingIdTranslation(PID_VALUETYPE_INTEGER, CATEGORY_UNDEFINED, "", "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<description>Password for gateway</description>
<default>12345</default>
</parameter>

</config-description>
</bridge-type>
</thing:thing-descriptions>

0 comments on commit 7457a58

Please sign in to comment.