From 0fbe6f7ca1895a902cb8913048c68cfbe1d75f98 Mon Sep 17 00:00:00 2001 From: mlobstein Date: Sat, 8 Jun 2024 08:31:25 -0500 Subject: [PATCH] [epsonprojector] Incorporate review suggestions from other PRs (#16860) Signed-off-by: Michael Lobstein Signed-off-by: Ciprian Pascu --- .../discovery/EpsonProjectorDiscoveryParticipant.java | 7 ++++--- .../internal/discovery/EpsonProjectorDiscoveryService.java | 2 +- .../src/main/resources/OH-INF/addon/addon.xml | 6 +++++- .../main/resources/OH-INF/i18n/epsonprojector.properties | 2 +- .../src/main/resources/OH-INF/thing/thing-types.xml | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryParticipant.java b/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryParticipant.java index c064d8a5359..8099364e47c 100644 --- a/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryParticipant.java @@ -49,7 +49,7 @@ public class EpsonProjectorDiscoveryParticipant implements SddpDiscoveryParticip @Override public Set getSupportedThingTypeUIDs() { - return SUPPORTED_THING_TYPES_UIDS; + return Set.of(THING_TYPE_PROJECTOR_TCP); } @Override @@ -76,9 +76,10 @@ public class EpsonProjectorDiscoveryParticipant implements SddpDiscoveryParticip @Override public @Nullable ThingUID getThingUID(SddpDevice device) { if (device.manufacturer.toUpperCase(Locale.ENGLISH).contains(EPSON) - && device.type.toUpperCase(Locale.ENGLISH).contains(TYPE_PROJECTOR) && !device.macAddress.isBlank()) { - + && device.type.toUpperCase(Locale.ENGLISH).contains(TYPE_PROJECTOR) && !device.macAddress.isBlank() + && !device.ipAddress.isBlank()) { logger.debug("Epson projector with mac {} found at {}", device.macAddress, device.ipAddress); + return new ThingUID(THING_TYPE_PROJECTOR_TCP, device.macAddress.replaceAll("-", "").toUpperCase(Locale.ENGLISH)); } diff --git a/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryService.java b/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryService.java index cb43300bb87..8d81d9f5c3c 100644 --- a/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryService.java +++ b/bundles/org.openhab.binding.epsonprojector/src/main/java/org/openhab/binding/epsonprojector/internal/discovery/EpsonProjectorDiscoveryService.java @@ -78,7 +78,7 @@ public class EpsonProjectorDiscoveryService extends AbstractDiscoveryService { @Override public Set getSupportedThingTypes() { - return SUPPORTED_THING_TYPES_UIDS; + return Set.of(THING_TYPE_PROJECTOR_TCP); } @Override diff --git a/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/addon/addon.xml b/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/addon/addon.xml index 92184d5ceb4..e60eb7cc766 100644 --- a/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/addon/addon.xml +++ b/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/addon/addon.xml @@ -12,9 +12,13 @@ sddp + + manufacturer + (?i).*epson.* + type - (?i)epson:projector.* + (?i).*projector.* diff --git a/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/i18n/epsonprojector.properties b/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/i18n/epsonprojector.properties index 9a4001feb6e..f427ca1349d 100644 --- a/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/i18n/epsonprojector.properties +++ b/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/i18n/epsonprojector.properties @@ -116,7 +116,7 @@ channel-type.epsonprojector.horizontalreverse.description = Turn the Horizontal channel-type.epsonprojector.keycode.label = KeyCode channel-type.epsonprojector.keycode.description = Send a KEY Operation Command to the Projector channel-type.epsonprojector.lamptime.label = Lamp Time -channel-type.epsonprojector.lamptime.description = Retrieves the Lamp Hours +channel-type.epsonprojector.lamptime.description = Retrieves the number of hours the lamp has been used channel-type.epsonprojector.luminance.label = Luminance channel-type.epsonprojector.luminance.description = Retrieve or Set the Lamp Mode channel-type.epsonprojector.luminance.state.option.NORMAL = NORMAL diff --git a/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/thing/thing-types.xml index 4f28d375be2..29745fb1b91 100644 --- a/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.epsonprojector/src/main/resources/OH-INF/thing/thing-types.xml @@ -142,7 +142,7 @@ Number - Retrieves the Lamp Hours + Retrieves the number of hours the lamp has been used