Skip to content

Commit d8d79b7

Browse files
committed
[bondhome] remove internal binding version
OpenHAB already has infrastructure to have things update their channel definitions when a binding is updated. Signed-off-by: Cody Cutrer <[email protected]>
1 parent 5a4c87b commit d8d79b7

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

bundles/org.openhab.binding.bondhome/src/main/java/org/openhab/binding/bondhome/internal/BondHomeBindingConstants.java

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
public class BondHomeBindingConstants {
3131

3232
public static final String BINDING_ID = "bondhome";
33-
public static final String CURRENT_BINDING_VERSION = "v0.2.4";
3433

3534
/**
3635
* List of all Thing Type UIDs.
@@ -110,7 +109,6 @@ public class BondHomeBindingConstants {
110109
public static final String PROPERTIES_TRUST_STATE = "trustState";
111110
public static final String PROPERTIES_ADDRESS = "addr";
112111
public static final String PROPERTIES_RF_FREQUENCY = "freq";
113-
public static final String PROPERTIES_BINDING_VERSION = "bindingVersion";
114112

115113
/**
116114
* Constants

bundles/org.openhab.binding.bondhome/src/main/java/org/openhab/binding/bondhome/internal/handler/BondDeviceHandler.java

+1-21
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ private void initializeThing() {
516516
// Anytime the configuration has changed or the binding has been updated,
517517
// recreate the thing to make sure all possible channels are available
518518
// NOTE: This will cause the thing to be disposed and re-initialized
519-
if (wasBindingUpdated() || wasThingUpdatedExternally(devInfo)) {
519+
if (wasThingUpdatedExternally(devInfo)) {
520520
recreateAllChannels(devInfo.type, devInfo.hash);
521521
return;
522522
}
@@ -536,7 +536,6 @@ private void initializeThing() {
536536
private void updateDevicePropertiesFromBond(BondDevice devInfo, BondDeviceProperties devProperties) {
537537
// Update all the thing properties based on the result
538538
Map<String, String> thingProperties = new HashMap<String, String>();
539-
thingProperties.put(PROPERTIES_BINDING_VERSION, CURRENT_BINDING_VERSION);
540539
thingProperties.put(CONFIG_DEVICE_ID, config.deviceId);
541540
logger.trace("Updating device name to {}", devInfo.name);
542541
thingProperties.put(PROPERTIES_DEVICE_NAME, devInfo.name);
@@ -697,25 +696,6 @@ private boolean hasConfigurationError() {
697696
&& statusInfo.getStatusDetail() == ThingStatusDetail.CONFIGURATION_ERROR || disposed;
698697
}
699698

700-
private synchronized boolean wasBindingUpdated() {
701-
// Check if the binding has been updated
702-
@Nullable
703-
String lastBindingVersion = this.getThing().getProperties().get(PROPERTIES_BINDING_VERSION);
704-
if (CURRENT_BINDING_VERSION.equals(lastBindingVersion)) {
705-
return false;
706-
}
707-
708-
logger.debug("Bond Home binding has been updated.");
709-
logger.debug("Current version is {}, prior version was {}.", CURRENT_BINDING_VERSION, lastBindingVersion);
710-
711-
// Update the thing with the new property value
712-
final Map<String, String> newProperties = editProperties();
713-
newProperties.put(PROPERTIES_BINDING_VERSION, CURRENT_BINDING_VERSION);
714-
715-
updateProperties(newProperties);
716-
return true;
717-
}
718-
719699
private synchronized boolean wasThingUpdatedExternally(BondDevice devInfo) {
720700
// Check if the Bond hash tree has changed
721701
final String lastDeviceConfigurationHash = config.lastDeviceConfigurationHash;

0 commit comments

Comments
 (0)