Skip to content

Commit

Permalink
Revert firmware information added.
Browse files Browse the repository at this point in the history
Signed-off-by: Jacob Laursen <[email protected]>
  • Loading branch information
jlaur committed Jan 6, 2022
1 parent ed1fe0d commit e6def1d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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/";

Expand Down Expand Up @@ -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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -95,7 +93,6 @@ public class HDPowerViewHubHandler extends BaseBridgeHandler {
private List<Scene> sceneCache = new CopyOnWriteArrayList<>();
private List<SceneCollection> sceneCollectionCache = new CopyOnWriteArrayList<>();
private List<ScheduledEvent> scheduledEventCache = new CopyOnWriteArrayList<>();
private @Nullable MainProcessor firmwareMainProcessor;
private Boolean deprecatedChannelsCreated = false;

private final ChannelTypeUID sceneChannelTypeUID = new ChannelTypeUID(HDPowerViewBindingConstants.BINDING_ID,
Expand Down Expand Up @@ -255,7 +252,6 @@ private synchronized void stopPoll() {
private synchronized void poll() {
try {
logger.debug("Polling for state");
fetchFirmwareVersion();
pollShades();

List<Scene> scenes = updateSceneChannels();
Expand All @@ -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<String, String> 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) {
Expand Down

0 comments on commit e6def1d

Please sign in to comment.