This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1366 from gerrieg/homematic
[Homematic] Fixed CCU firmware version extraction.
- Loading branch information
Showing
5 changed files
with
114 additions
and
31 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
...c/main/java/org/openhab/binding/homematic/internal/communicator/client/BaseRpcClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Copyright (c) 2010-2014, openHAB.org and others. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.openhab.binding.homematic.internal.communicator.client; | ||
|
||
import java.util.Map; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.openhab.binding.homematic.internal.communicator.client.interfaces.RpcClient; | ||
import org.openhab.binding.homematic.internal.model.HmInterface; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Abstract class with common methods for all RpcClients. | ||
* | ||
* @author Gerhard Riegler | ||
* @since 1.6.0 | ||
*/ | ||
public abstract class BaseRpcClient implements RpcClient { | ||
private final static Logger logger = LoggerFactory.getLogger(BaseRpcClient.class); | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public void start() throws HomematicClientException { | ||
logger.debug("Starting {}", this.getClass().getSimpleName()); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ServerId getServerId(HmInterface hmInterface) throws HomematicClientException { | ||
ServerId serverId = null; | ||
try { | ||
serverId = new ServerId(getVersion(hmInterface)); | ||
} catch (Exception ex) { | ||
// ignore, the getVersion method may not be implemented (CCU1) | ||
} | ||
|
||
if (serverId == null || !serverId.isHomegear()) { | ||
Map<String, String> deviceDescription = getDeviceDescription(hmInterface, "BidCoS-RF"); | ||
String firmwareVersion = null; | ||
if (deviceDescription != null) { | ||
firmwareVersion = deviceDescription.get("FIRMWARE"); | ||
} | ||
serverId = new ServerId(StringUtils.defaultIfBlank(firmwareVersion, "unknown")); | ||
} | ||
|
||
return serverId; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters