2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.generacmobilelink.internal.discovery;
15 import static org.openhab.binding.generacmobilelink.internal.GeneracMobileLinkBindingConstants.THING_TYPE_GENERATOR;
19 import org.eclipse.jdt.annotation.NonNullByDefault;
20 import org.openhab.binding.generacmobilelink.internal.GeneracMobileLinkBindingConstants;
21 import org.openhab.binding.generacmobilelink.internal.dto.GeneratorStatusDTO;
22 import org.openhab.core.config.discovery.AbstractDiscoveryService;
23 import org.openhab.core.config.discovery.DiscoveryResult;
24 import org.openhab.core.config.discovery.DiscoveryResultBuilder;
25 import org.openhab.core.thing.ThingTypeUID;
26 import org.openhab.core.thing.ThingUID;
29 * The {@link GeneracMobileLinkDiscoveryService} is responsible for discovering generator things
31 * @author Dan Cunningham - Initial contribution
34 public class GeneracMobileLinkDiscoveryService extends AbstractDiscoveryService {
35 private static final Set<ThingTypeUID> SUPPORTED_DISCOVERY_THING_TYPES_UIDS = Set.of(THING_TYPE_GENERATOR);
37 public GeneracMobileLinkDiscoveryService() {
38 super(SUPPORTED_DISCOVERY_THING_TYPES_UIDS, 0);
42 public Set<ThingTypeUID> getSupportedThingTypes() {
43 return SUPPORTED_DISCOVERY_THING_TYPES_UIDS;
47 public void startScan() {
51 public boolean isBackgroundDiscoveryEnabled() {
55 public void generatorDiscovered(GeneratorStatusDTO generator, ThingUID bridgeUID) {
56 DiscoveryResult result = DiscoveryResultBuilder
57 .create(new ThingUID(GeneracMobileLinkBindingConstants.THING_TYPE_GENERATOR, bridgeUID,
58 String.valueOf(generator.gensetID)))
59 .withLabel("MobileLink Generator " + generator.generatorName)
60 .withProperty("generatorId", String.valueOf(generator.gensetID))
61 .withRepresentationProperty("generatorId").withBridge(bridgeUID).build();
62 thingDiscovered(result);