Skip to content

Commit

Permalink
[dsmr] Add bridgeUID to thingUID during discovery (openhab#8446)
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Born <github@maindrain.net>
  • Loading branch information
wborn authored and andrewfg committed Oct 8, 2020
1 parent 27eaf31 commit 789ee34
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public DSMRDiscoveryService() {
public boolean meterDiscovered(DSMRMeterDescriptor meterDescriptor, ThingUID dsmrBridgeUID) {
DSMRMeterType meterType = meterDescriptor.getMeterType();
ThingTypeUID thingTypeUID = meterType.getThingTypeUID();
ThingUID thingUID = new ThingUID(thingTypeUID, meterDescriptor.getChannelId());
ThingUID thingUID = new ThingUID(thingTypeUID, dsmrBridgeUID, meterDescriptor.getChannelId());

// Construct the configuration for this meter
Map<String, Object> properties = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.stream.Collectors;

import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingUID;
import org.eclipse.smarthome.io.transport.serial.PortInUseException;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -95,6 +96,7 @@ protected void reportConfigurationValidationResults(List<DSMRMeterType> invalidC
return detectMetersRef.get().next();
});
when(thing.getHandler()).thenReturn(meterHandler);
when(bridge.getThing().getUID()).thenReturn(new ThingUID("dsmr:dsmrBridge:22e5393c"));
when(bridge.getThing().getThings()).thenReturn(things);

service.telegramReceived(expected);
Expand Down Expand Up @@ -122,6 +124,7 @@ protected void reportUnregisteredMeters() {
unregisteredMeter.set(true);
}
};
when(bridge.getThing().getUID()).thenReturn(new ThingUID("dsmr:dsmrBridge:22e5393c"));
when(bridge.getThing().getThings()).thenReturn(Collections.emptyList());

service.telegramReceived(telegram);
Expand Down

0 comments on commit 789ee34

Please sign in to comment.