From e6def1d09800287fcaac24bceaacdca90b468e98 Mon Sep 17 00:00:00 2001 From: Jacob Laursen Date: Thu, 6 Jan 2022 21:52:07 +0100 Subject: [PATCH] Revert firmware information added. Signed-off-by: Jacob Laursen --- .../internal/HDPowerViewBindingConstants.java | 6 -- .../internal/HDPowerViewWebTargets.java | 17 ------ .../api/responses/FirmwareVersion.java | 55 ------------------- .../handler/HDPowerViewHubHandler.java | 40 -------------- 4 files changed, 118 deletions(-) delete mode 100644 bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/FirmwareVersion.java diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewBindingConstants.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewBindingConstants.java index e34384634e43f..e6f50a8a655fd 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewBindingConstants.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewBindingConstants.java @@ -33,12 +33,6 @@ public class HDPowerViewBindingConstants { public static final String BINDING_ID = "hdpowerview"; - // Hub properties - public static final String PROPERTY_FIRMWARE_NAME = "firmwareName"; - public static final String PROPERTY_FIRMWARE_REVISION = "firmwareRevision"; - public static final String PROPERTY_FIRMWARE_SUBREVISION = "firmwareSubRevision"; - public static final String PROPERTY_FIRMWARE_BUILD = "firmwareBuild"; - // List of all Thing Type UIDs public static final ThingTypeUID THING_TYPE_HUB = new ThingTypeUID(BINDING_ID, "hub"); public static final ThingTypeUID THING_TYPE_SHADE = new ThingTypeUID(BINDING_ID, "shade"); diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java index 9dad988cd364d..a7fb69253cdec 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/HDPowerViewWebTargets.java @@ -28,7 +28,6 @@ import org.openhab.binding.hdpowerview.internal.api.ShadePosition; import org.openhab.binding.hdpowerview.internal.api.requests.ShadeMove; import org.openhab.binding.hdpowerview.internal.api.requests.ShadeStop; -import org.openhab.binding.hdpowerview.internal.api.responses.FirmwareVersion; import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections; import org.openhab.binding.hdpowerview.internal.api.responses.Scenes; import org.openhab.binding.hdpowerview.internal.api.responses.ScheduledEvents; @@ -66,7 +65,6 @@ public class HDPowerViewWebTargets { private final String base; private final String shades; - private final String firmwareVersion; private final String sceneActivate; private final String scenes; private final String sceneCollectionActivate; @@ -115,7 +113,6 @@ public String toString() { public HDPowerViewWebTargets(HttpClient httpClient, String ipAddress) { base = "http://" + ipAddress + "/api/"; shades = base + "shades/"; - firmwareVersion = base + "fwversion/"; sceneActivate = base + "scenes"; scenes = base + "scenes/"; @@ -154,20 +151,6 @@ public void moveShade(int shadeId, ShadePosition position) throws HubProcessingE invoke(HttpMethod.PUT, shades + Integer.toString(shadeId), null, json); } - /** - * Fetches a JSON package with firmware information for the hub. - * - * @return FirmwareVersion class instance - * @throws JsonParseException if there is a JSON parsing error - * @throws HubProcessingException if there is any processing error - * @throws HubMaintenanceException if the hub is down for maintenance - */ - public @Nullable FirmwareVersion getFirmwareVersion() - throws JsonParseException, HubProcessingException, HubMaintenanceException { - String json = invoke(HttpMethod.GET, firmwareVersion, null, null); - return gson.fromJson(json, FirmwareVersion.class); - } - /** * Fetches a JSON package that describes all scenes in the hub, and wraps it in * a Scenes class instance diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/FirmwareVersion.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/FirmwareVersion.java deleted file mode 100644 index 838784225f654..0000000000000 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/api/responses/FirmwareVersion.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) 2010-2022 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.hdpowerview.internal.api.responses; - -import org.openhab.binding.hdpowerview.internal.api.responses.FirmwareVersion.Firmware.MainProcessor; - -/** - * Firmware information for an HD PowerView hub - * - * @author Jacob Laursen - Initial contribution - */ -public class FirmwareVersion { - public Firmware firmware; - - public static class Firmware { - public MainProcessor mainProcessor; - public Radio radio; - - public static class MainProcessor { - public String name; - public int revision; - public int subRevision; - public int build; - - @Override - public String toString() { - return String.format("name:%s, revision:%d, subRevision:%d, build:%d", name, revision, subRevision, - build); - } - } - - public static class Radio { - public int revision; - public int subRevision; - public int build; - } - } - - public MainProcessor getMainProcessor() { - if (firmware != null) { - return firmware.mainProcessor; - } - return null; - } -} diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java index 1ce43f598cac7..2acfb9451bc55 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/handler/HDPowerViewHubHandler.java @@ -31,8 +31,6 @@ import org.openhab.binding.hdpowerview.internal.HDPowerViewWebTargets; import org.openhab.binding.hdpowerview.internal.HubMaintenanceException; import org.openhab.binding.hdpowerview.internal.HubProcessingException; -import org.openhab.binding.hdpowerview.internal.api.responses.FirmwareVersion; -import org.openhab.binding.hdpowerview.internal.api.responses.FirmwareVersion.Firmware.MainProcessor; import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections; import org.openhab.binding.hdpowerview.internal.api.responses.SceneCollections.SceneCollection; import org.openhab.binding.hdpowerview.internal.api.responses.Scenes; @@ -95,7 +93,6 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler { private List sceneCache = new CopyOnWriteArrayList<>(); private List sceneCollectionCache = new CopyOnWriteArrayList<>(); private List scheduledEventCache = new CopyOnWriteArrayList<>(); - private @Nullable MainProcessor firmwareMainProcessor; private Boolean deprecatedChannelsCreated = false; private final ChannelTypeUID sceneChannelTypeUID = new ChannelTypeUID(HDPowerViewBindingConstants.BINDING_ID, @@ -255,7 +252,6 @@ private synchronized void stopPoll() { private synchronized void poll() { try { logger.debug("Polling for state"); - fetchFirmwareVersion(); pollShades(); List scenes = updateSceneChannels(); @@ -275,42 +271,6 @@ private synchronized void poll() { } } - private void fetchFirmwareVersion() throws JsonParseException, HubProcessingException, HubMaintenanceException { - if (firmwareMainProcessor != null) { - return; - } - HDPowerViewWebTargets webTargets = this.webTargets; - if (webTargets == null) { - throw new ProcessingException("Web targets not initialized"); - } - - FirmwareVersion firmwareVersion = webTargets.getFirmwareVersion(); - if (firmwareVersion == null) { - logger.warn("Unable to get firmware version information."); - return; - } - MainProcessor mainProcessor = firmwareVersion.getMainProcessor(); - if (mainProcessor == null) { - logger.warn("Invalid or incomplete firmware version information received."); - return; - } - logger.debug("Firmware version information received: {}", mainProcessor.toString()); - updateFirmwareProperties(mainProcessor); - this.firmwareMainProcessor = mainProcessor; - } - - private void updateFirmwareProperties(MainProcessor mainProcessor) { - Map properties = editProperties(); - if (mainProcessor.name != null) { - properties.put(HDPowerViewBindingConstants.PROPERTY_FIRMWARE_NAME, mainProcessor.name); - } - properties.put(HDPowerViewBindingConstants.PROPERTY_FIRMWARE_REVISION, String.valueOf(mainProcessor.revision)); - properties.put(HDPowerViewBindingConstants.PROPERTY_FIRMWARE_SUBREVISION, - String.valueOf(mainProcessor.subRevision)); - properties.put(HDPowerViewBindingConstants.PROPERTY_FIRMWARE_BUILD, String.valueOf(mainProcessor.build)); - updateProperties(properties); - } - private void pollShades() throws JsonParseException, HubProcessingException, HubMaintenanceException { HDPowerViewWebTargets webTargets = this.webTargets; if (webTargets == null) {