Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dsmr] Add bridgeUID to thingUID during discovery #8446

Merged
merged 1 commit into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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