/**
   * Merges the content of the specified source {@link DiscoveryResult} into this object.
   *
   * <p><i>Hint:</i> The {@link DiscoveryResultFlag} of this object keeps its state.
   *
   * <p>This method returns silently if the specified source {@link DiscoveryResult} is {@code null}
   * or its {@code Thing} type or ID does not fit to this object.
   *
   * @param sourceResult the discovery result which is used as source for the merge
   */
  public void synchronize(DiscoveryResult sourceResult) {
    if ((sourceResult != null) && (sourceResult.getThingUID().equals(this.thingUID))) {

      this.properties = sourceResult.getProperties();
      this.representationProperty = sourceResult.getRepresentationProperty();
      this.label = sourceResult.getLabel();
      this.timestamp = new Date().getTime();
      this.timeToLive = sourceResult.getTimeToLive();
    }
  }
  private void addThing(ThingUID bridgeUID, String thingType, String thingID) {
    logger.trace("Adding new Vitotronic thing: {}", thingID);
    ThingUID thingUID = null;
    switch (thingType) {
      case VitotronicBindingConstants.THING_ID_HEATING:
        thingUID =
            new ThingUID(VitotronicBindingConstants.THING_TYPE_UID_HEATING, bridgeUID, thingID);
        break;
      case VitotronicBindingConstants.THING_ID_PELLETBURNER:
        thingUID =
            new ThingUID(
                VitotronicBindingConstants.THING_TYPE_UID_PELLETBURNER, bridgeUID, thingID);
        break;
      case VitotronicBindingConstants.THING_ID_STORAGETANK:
        thingUID =
            new ThingUID(VitotronicBindingConstants.THING_TYPE_UID_STORAGETANK, bridgeUID, thingID);
        break;
      case VitotronicBindingConstants.THING_ID_CIRCUIT:
        thingUID =
            new ThingUID(VitotronicBindingConstants.THING_TYPE_UID_CIRCUIT, bridgeUID, thingID);
        break;
      case VitotronicBindingConstants.THING_ID_SOLAR:
        thingUID =
            new ThingUID(VitotronicBindingConstants.THING_TYPE_UID_SOLAR, bridgeUID, thingID);
        break;
    }

    if (thingUID != null) {
      logger.trace(
          "Adding new Discovery thingType: {} bridgeType: {}",
          thingUID.getThingTypeId(),
          bridgeUID.getThingTypeId());

      DiscoveryResult discoveryResult =
          DiscoveryResultBuilder.create(thingUID).withBridge(bridgeUID).withLabel(thingID).build();
      logger.trace(
          "call register: {} label: {}",
          discoveryResult.getBindingId(),
          discoveryResult.getLabel());
      thingDiscovered(discoveryResult);
    } else {
      logger.debug("Discovered Thing is unsupported: type '{}'", thingID);
    }
  }