mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[mercedesme] Add vin automatically to discovered vehicle (#17750)
* add vin as representation property Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
f9dee9230e
commit
22f953ff00
@ -29,6 +29,7 @@ import org.osgi.service.component.annotations.Component;
|
||||
* associated vehicles and provides DiscoveryResults
|
||||
*
|
||||
* @author Bernd Weymann - Initial Contribution
|
||||
* @author Bernd Weymann - Add vin as representation property
|
||||
*/
|
||||
@NonNullByDefault
|
||||
@Component(service = DiscoveryService.class, configurationPid = "discovery.mercedesme")
|
||||
@ -56,8 +57,9 @@ public class MercedesMeDiscoveryService extends AbstractDiscoveryService {
|
||||
break;
|
||||
}
|
||||
if (ttuid != null) {
|
||||
properties.put("vin", vin);
|
||||
thingDiscovered(DiscoveryResultBuilder.create(new ThingUID(ttuid, ac.getThing().getUID(), vin))
|
||||
.withBridge(ac.getThing().getUID()).withProperties(properties)
|
||||
.withBridge(ac.getThing().getUID()).withProperties(properties).withRepresentationProperty("vin")
|
||||
.withLabel("Mercedes Benz " + ttuid.getId().toUpperCase()).build());
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +324,9 @@ public class AccountHandler extends BaseBridgeHandler implements AccessTokenRefr
|
||||
} else {
|
||||
if (!capabilitiesMap.containsKey(vin)) {
|
||||
// only report new discovery if capabilities aren't discovered yet
|
||||
discoveryService.vehicleDiscovered(this, vin, getCapabilities(vin));
|
||||
Map<String, Object> discoveryProperties = getCapabilities(vin);
|
||||
discoveryProperties.put("vin", vin);
|
||||
discoveryService.vehicleDiscovered(this, vin, discoveryProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user