Skip to content

Commit

Permalink
[hyperion] Fixes #6377 hyperion NPE (#7898)
Browse files Browse the repository at this point in the history
* [hyperion] Fixes #6377 hyperion NPE

Incorporate changes to HyperionNG serverInfo API - alpha6.
HyperionEnabled state channel is now determined by special component
state "ALL" for newer APIs.

See: https://docs.hyperion-project.org/en/json/ServerInfo.html

* Update bundles/org.openhab.binding.hyperion/src/main/java/org/openhab/binding/hyperion/internal/handler/HyperionNgHandler.java

Signed-off-by: Łukasz Serwicki <[email protected]>
Co-authored-by: Connor Petty <[email protected]>
  • Loading branch information
posseydon6891 and Connor Petty authored Jun 15, 2020
1 parent 65f6fa6 commit d817302
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class HyperionBindingConstants {
public static final String COMPONENT_GRABBER = "GRABBER";
public static final String COMPONENT_V4L = "V4L";
public static final String COMPONENT_LEDDEVICE = "LEDDEVICE";
public static final String COMPONENT_ALL = "ALL";

// List of all properties
public static final String PROP_HOST = "host";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,13 @@ public void dispose() {
protected void handleServerInfoResponse(NgResponse response) {
NgInfo info = response.getInfo();
if (info != null) {
// update Hyperion
// update Hyperion, older API compatibility
Hyperion hyperion = info.getHyperion();
updateHyperion(hyperion);

if (hyperion != null) {

updateHyperion(hyperion);
}

// populate the effect states
List<Effect> effects = info.getEffects();
populateEffects(effects);
Expand Down Expand Up @@ -295,6 +298,9 @@ private void updateComponents(List<Component> components) {
case COMPONENT_LEDDEVICE:
updateState(CHANNEL_LEDDEVICE, componentState);
break;
case COMPONENT_ALL:
updateState(CHANNEL_HYPERION_ENABLED, componentState);
break;
default:
logger.debug("Unknown component: {}", componentName);
}
Expand Down

0 comments on commit d817302

Please sign in to comment.