forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[daikin] Support the BRP1B61 (aka Airbase) controller (openhab#5910)
* Support the BRP1B61 (aka Airbase) controller * Move common thing config to a separate xml file Signed-off-by: Paul Smedley <paul@smedley.id.au> Signed-off-by: Maximilian Hess <mail@ne0h.de>
- Loading branch information
Showing
15 changed files
with
789 additions
and
43 deletions.
There are no files selected for viewing
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
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
58 changes: 58 additions & 0 deletions
58
...aikin/src/main/java/org/openhab/binding/daikin/internal/api/airbase/AirbaseBasicInfo.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,58 @@ | ||
/** | ||
* Copyright (c) 2010-2019 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.daikin.internal.api.airbase; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* Holds information from the basic_info call. | ||
* | ||
* @author Paul Smedley - Initial contribution | ||
* | ||
*/ | ||
public class AirbaseBasicInfo { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(AirbaseBasicInfo.class); | ||
|
||
public String ssid; | ||
|
||
private AirbaseBasicInfo() { | ||
} | ||
|
||
public static AirbaseBasicInfo parse(String response) { | ||
LOGGER.debug("Parsing string: \"{}\"", response); | ||
|
||
Map<String, String> responseMap = Arrays.asList(response.split(",")).stream().filter(kv -> kv.contains("=")) | ||
.map(kv -> { | ||
String[] keyValue = kv.split("="); | ||
String key = keyValue[0]; | ||
String value = keyValue.length > 1 ? keyValue[1] : ""; | ||
return new String[] { key, value }; | ||
}).collect(Collectors.toMap(x -> x[0], x -> x[1])); | ||
|
||
AirbaseBasicInfo info = new AirbaseBasicInfo(); | ||
info.ssid = responseMap.get("ssid"); | ||
return info; | ||
} | ||
|
||
public Map<String, String> getParamString() { | ||
Map<String, String> params = new HashMap<>(); | ||
params.put("ssid", ssid); | ||
return params; | ||
} | ||
|
||
} |
Oops, something went wrong.