-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[dirigera] Initial contribution #17719
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
071b542
feature-squash
weymann 338eb9c
bundles pom spotless
weymann 4a54db1
fix review comments
weymann b774cc7
review comments OH5
weymann e979f7b
review comments
weymann c6c1934
typos & mock storage
weymann c8c9592
enable parallel device calls
weymann 2bfb77a
reemove HSB test
weymann 1b87fde
temperature-abs
weymann b26f635
temperature-abs
weymann 3ecc36b
OH5 adaptions
weymann 6112a20
initialize rework
weymann cf4156a
checkstyle
weymann 1ab1bb6
plug detection improvement
weymann f631e94
remove unused model function
weymann 560f8af
go back to rgb color model
weymann 2fe6c44
OH5 header adaptions
weymann 22bf1da
move debug actions to console
weymann 229d019
OH5 adaptions
weymann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| This content is produced and maintained by the openHAB project. | ||
|
|
||
| * Project home: https://www.openhab.org | ||
|
|
||
| == Declared Project Licenses | ||
|
|
||
| This program and the accompanying materials are made available under the terms | ||
| of the Eclipse Public License 2.0 which is available at | ||
| https://www.eclipse.org/legal/epl-2.0/. | ||
|
|
||
| == Source Code | ||
|
|
||
| https://github.com/openhab/openhab-addons |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
|
||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <parent> | ||
| <groupId>org.openhab.addons.bundles</groupId> | ||
| <artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
| <version>5.0.0-SNAPSHOT</version> | ||
| </parent> | ||
|
|
||
| <artifactId>org.openhab.binding.dirigera</artifactId> | ||
|
|
||
| <name>openHAB Add-ons :: Bundles :: Dirigera Binding</name> | ||
| <dependencies> | ||
| <!-- version needs to match with other projects like org.openhab.io.openhabcloud.pom.xml --> | ||
| <dependency> | ||
| <groupId>org.json</groupId> | ||
| <artifactId>json</artifactId> | ||
| <version>20231013</version> | ||
| <scope>compile</scope> | ||
| </dependency> | ||
| </dependencies> | ||
|
|
||
| </project> |
9 changes: 9 additions & 0 deletions
9
bundles/org.openhab.binding.dirigera/src/main/feature/feature.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <features name="org.openhab.binding.dirigera-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
| <repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
|
||
| <feature name="openhab-binding-dirigera" description="Dirigera Binding" version="${project.version}"> | ||
| <feature>openhab-runtime-base</feature> | ||
| <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.dirigera/${project.version}</bundle> | ||
| </feature> | ||
| </features> |
362 changes: 362 additions & 0 deletions
362
...enhab.binding.dirigera/src/main/java/org/openhab/binding/dirigera/internal/Constants.java
Large diffs are not rendered by default.
Oops, something went wrong.
41 changes: 41 additions & 0 deletions
41
...dirigera/src/main/java/org/openhab/binding/dirigera/internal/DirigeraCommandProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 Contributors to the openHAB project | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0 | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| */ | ||
| package org.openhab.binding.dirigera.internal; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.openhab.core.events.EventPublisher; | ||
| import org.openhab.core.thing.binding.BaseDynamicCommandDescriptionProvider; | ||
| import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService; | ||
| import org.openhab.core.thing.link.ItemChannelLinkRegistry; | ||
| import org.openhab.core.thing.type.DynamicCommandDescriptionProvider; | ||
| import org.osgi.service.component.annotations.Activate; | ||
| import org.osgi.service.component.annotations.Component; | ||
| import org.osgi.service.component.annotations.Reference; | ||
|
|
||
| /** | ||
| * Dynamic provider of command options while leaving other state description fields as original. | ||
| * | ||
| * @author Bernd Weymann - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| @Component(service = { DynamicCommandDescriptionProvider.class, DirigeraCommandProvider.class }) | ||
| public class DirigeraCommandProvider extends BaseDynamicCommandDescriptionProvider { | ||
| @Activate | ||
| public DirigeraCommandProvider(final @Reference EventPublisher eventPublisher, // | ||
| final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry, // | ||
| final @Reference ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { | ||
| this.eventPublisher = eventPublisher; | ||
| this.itemChannelLinkRegistry = itemChannelLinkRegistry; | ||
| this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService; | ||
| } | ||
| } |
174 changes: 174 additions & 0 deletions
174
....dirigera/src/main/java/org/openhab/binding/dirigera/internal/DirigeraHandlerFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 Contributors to the openHAB project | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0 | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| */ | ||
| package org.openhab.binding.dirigera.internal; | ||
|
|
||
| import static org.openhab.binding.dirigera.internal.Constants.*; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.eclipse.jetty.client.HttpClient; | ||
| import org.eclipse.jetty.client.WWWAuthenticationProtocolHandler; | ||
| import org.eclipse.jetty.util.ssl.SslContextFactory; | ||
| import org.openhab.binding.dirigera.internal.discovery.DirigeraDiscoveryService; | ||
| import org.openhab.binding.dirigera.internal.handler.DirigeraHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.airpurifier.AirPurifierHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.blind.BlindHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.controller.BlindsControllerHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.controller.DoubleShortcutControllerHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.controller.LightControllerHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.controller.ShortcutControllerHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.controller.SoundControllerHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.light.ColorLightHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.light.DimmableLightHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.light.SwitchLightHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.light.TemperatureLightHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.plug.PowerPlugHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.plug.SimplePlugHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.plug.SmartPlugHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.repeater.RepeaterHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.scene.SceneHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.sensor.AirQualityHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.sensor.ContactSensorHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.sensor.MotionLightSensorHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.sensor.MotionSensorHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.sensor.WaterSensorHandler; | ||
| import org.openhab.binding.dirigera.internal.handler.speaker.SpeakerHandler; | ||
| import org.openhab.core.i18n.LocationProvider; | ||
| import org.openhab.core.storage.Storage; | ||
| import org.openhab.core.storage.StorageService; | ||
| import org.openhab.core.thing.Bridge; | ||
| import org.openhab.core.thing.Thing; | ||
| import org.openhab.core.thing.ThingTypeUID; | ||
| import org.openhab.core.thing.binding.BaseThingHandlerFactory; | ||
| import org.openhab.core.thing.binding.ThingHandler; | ||
| import org.openhab.core.thing.binding.ThingHandlerFactory; | ||
| import org.osgi.service.component.annotations.Activate; | ||
| import org.osgi.service.component.annotations.Component; | ||
| import org.osgi.service.component.annotations.Deactivate; | ||
| import org.osgi.service.component.annotations.Reference; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| /** | ||
| * The {@link DirigeraHandlerFactory} is responsible for creating things and thing | ||
| * handlers. | ||
| * | ||
| * @author Bernd Weymann - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| @Component(configurationPid = "binding.dirigera", service = ThingHandlerFactory.class) | ||
| public class DirigeraHandlerFactory extends BaseThingHandlerFactory { | ||
| private final Logger logger = LoggerFactory.getLogger(DirigeraHandlerFactory.class); | ||
| private final DirigeraStateDescriptionProvider stateProvider; | ||
| private final DirigeraDiscoveryService discoveryService; | ||
| private final DirigeraCommandProvider commandProvider; | ||
| private final LocationProvider locationProvider; | ||
| private final Storage<String> bindingStorage; | ||
| private final HttpClient insecureClient; | ||
|
|
||
| @Activate | ||
| public DirigeraHandlerFactory(@Reference StorageService storageService, | ||
| final @Reference DirigeraDiscoveryService discovery, final @Reference LocationProvider locationProvider, | ||
| final @Reference DirigeraCommandProvider commandProvider, | ||
| final @Reference DirigeraStateDescriptionProvider stateProvider) { | ||
| this.locationProvider = locationProvider; | ||
| this.commandProvider = commandProvider; | ||
| this.discoveryService = discovery; | ||
| this.stateProvider = stateProvider; | ||
|
|
||
| this.insecureClient = new HttpClient(new SslContextFactory.Client(true)); | ||
| insecureClient.setUserAgentField(null); | ||
| try { | ||
| this.insecureClient.start(); | ||
| // from https://github.com/jetty-project/jetty-reactive-httpclient/issues/33#issuecomment-777771465 | ||
| insecureClient.getProtocolHandlers().remove(WWWAuthenticationProtocolHandler.NAME); | ||
| } catch (Exception e) { | ||
| // catching exception is necessary due to the signature of HttpClient.start() | ||
| logger.warn("DIRIGERA FACTORY Failed to start http client: {}", e.getMessage()); | ||
| throw new IllegalStateException("Could not create HttpClient", e); | ||
| } | ||
| bindingStorage = storageService.getStorage(BINDING_ID); | ||
| } | ||
|
|
||
| @Deactivate | ||
| public void deactivate() { | ||
| try { | ||
| insecureClient.stop(); | ||
| } catch (Exception e) { | ||
| logger.warn("Failed to stop http client: {}", e.getMessage()); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
| return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
| } | ||
|
|
||
| @Override | ||
| protected @Nullable ThingHandler createHandler(Thing thing) { | ||
| ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
| if (THING_TYPE_GATEWAY.equals(thingTypeUID)) { | ||
| return new DirigeraHandler((Bridge) thing, insecureClient, bindingStorage, discoveryService, | ||
| locationProvider, commandProvider, bundleContext); | ||
| } else if (THING_TYPE_COLOR_LIGHT.equals(thingTypeUID)) { | ||
| return new ColorLightHandler(thing, COLOR_LIGHT_MAP, stateProvider); | ||
| } else if (THING_TYPE_TEMPERATURE_LIGHT.equals(thingTypeUID)) { | ||
| return new TemperatureLightHandler(thing, TEMPERATURE_LIGHT_MAP, stateProvider); | ||
| } else if (THING_TYPE_DIMMABLE_LIGHT.equals(thingTypeUID)) { | ||
| return new DimmableLightHandler(thing, TEMPERATURE_LIGHT_MAP); | ||
| } else if (THING_TYPE_SWITCH_LIGHT.equals(thingTypeUID)) { | ||
| return new SwitchLightHandler(thing, TEMPERATURE_LIGHT_MAP); | ||
| } else if (THING_TYPE_MOTION_SENSOR.equals(thingTypeUID)) { | ||
| return new MotionSensorHandler(thing, MOTION_SENSOR_MAP); | ||
| // } else if (THING_TYPE_LIGHT_SENSOR.equals(thingTypeUID)) { | ||
| // return new LightSensorHandler(thing, LIGHT_SENSOR_MAP); | ||
| } else if (THING_TYPE_MOTION_LIGHT_SENSOR.equals(thingTypeUID)) { | ||
| return new MotionLightSensorHandler(thing, MOTION_LIGHT_SENSOR_MAP); | ||
| } else if (THING_TYPE_CONTACT_SENSOR.equals(thingTypeUID)) { | ||
| return new ContactSensorHandler(thing, CONTACT_SENSOR_MAP); | ||
| } else if (THING_TYPE_SIMPLE_PLUG.equals(thingTypeUID)) { | ||
| return new SimplePlugHandler(thing, SMART_PLUG_MAP); | ||
| } else if (THING_TYPE_POWER_PLUG.equals(thingTypeUID)) { | ||
| return new PowerPlugHandler(thing, SMART_PLUG_MAP); | ||
| } else if (THING_TYPE_SMART_PLUG.equals(thingTypeUID)) { | ||
| return new SmartPlugHandler(thing, SMART_PLUG_MAP); | ||
| } else if (THING_TYPE_SPEAKER.equals(thingTypeUID)) { | ||
| return new SpeakerHandler(thing, SPEAKER_MAP); | ||
| } else if (THING_TYPE_SCENE.equals(thingTypeUID)) { | ||
| return new SceneHandler(thing, SCENE_MAP); | ||
| } else if (THING_TYPE_REPEATER.equals(thingTypeUID)) { | ||
| return new RepeaterHandler(thing, REPEATER_MAP); | ||
| } else if (THING_TYPE_LIGHT_CONTROLLER.equals(thingTypeUID)) { | ||
| return new LightControllerHandler(thing, LIGHT_CONTROLLER_MAP); | ||
| } else if (THING_TYPE_BLIND_CONTROLLER.equals(thingTypeUID)) { | ||
| return new BlindsControllerHandler(thing, BLIND_CONTROLLER_MAP); | ||
| } else if (THING_TYPE_SOUND_CONTROLLER.equals(thingTypeUID)) { | ||
| return new SoundControllerHandler(thing, SOUND_CONTROLLER_MAP); | ||
| } else if (THING_TYPE_SINGLE_SHORTCUT_CONTROLLER.equals(thingTypeUID)) { | ||
| return new ShortcutControllerHandler(thing, SHORTCUT_CONTROLLER_MAP, bindingStorage); | ||
| } else if (THING_TYPE_DOUBLE_SHORTCUT_CONTROLLER.equals(thingTypeUID)) { | ||
| return new DoubleShortcutControllerHandler(thing, SHORTCUT_CONTROLLER_MAP, bindingStorage); | ||
| } else if (THING_TYPE_AIR_QUALITY.equals(thingTypeUID)) { | ||
| return new AirQualityHandler(thing, AIR_QUALITY_MAP); | ||
| } else if (THING_TYPE_WATER_SENSOR.equals(thingTypeUID)) { | ||
| return new WaterSensorHandler(thing, WATER_SENSOR_MAP); | ||
| } else if (THING_TYPE_BLIND.equals(thingTypeUID)) { | ||
| return new BlindHandler(thing, BLINDS_MAP); | ||
| } else if (THING_TYPE_AIR_PURIFIER.equals(thingTypeUID)) { | ||
| return new AirPurifierHandler(thing, AIR_PURIFIER_MAP); | ||
| } else { | ||
| logger.debug("DIRIGERA FACTORY Request for {} doesn't match {}", thingTypeUID, THING_TYPE_GATEWAY); | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
87 changes: 87 additions & 0 deletions
87
...src/main/java/org/openhab/binding/dirigera/internal/DirigeraStateDescriptionProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 Contributors to the openHAB project | ||
| * | ||
| * See the NOTICE file(s) distributed with this work for additional | ||
| * information. | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License 2.0 which is available at | ||
| * http://www.eclipse.org/legal/epl-2.0 | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| */ | ||
| package org.openhab.binding.dirigera.internal; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.Locale; | ||
| import java.util.Map; | ||
| import java.util.Set; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.openhab.core.events.EventPublisher; | ||
| import org.openhab.core.thing.Channel; | ||
| import org.openhab.core.thing.ChannelUID; | ||
| import org.openhab.core.thing.binding.BaseDynamicStateDescriptionProvider; | ||
| import org.openhab.core.thing.events.ThingEventFactory; | ||
| import org.openhab.core.thing.i18n.ChannelTypeI18nLocalizationService; | ||
| import org.openhab.core.thing.link.ItemChannelLinkRegistry; | ||
| import org.openhab.core.thing.type.DynamicStateDescriptionProvider; | ||
| import org.openhab.core.types.StateDescription; | ||
| import org.openhab.core.types.StateDescriptionFragment; | ||
| import org.osgi.service.component.annotations.Activate; | ||
| import org.osgi.service.component.annotations.Component; | ||
| import org.osgi.service.component.annotations.Reference; | ||
|
|
||
| /** | ||
| * The {@link Clip2StateDescriptionProvider} provides dynamic state descriptions of alert, effect, scene, and colour | ||
| * temperature channels whose capabilities are dynamically determined at runtime. | ||
| * | ||
| * @author Andrew Fiddian-Green - Initial contribution | ||
| * | ||
| */ | ||
| @NonNullByDefault | ||
| @Component(service = { DynamicStateDescriptionProvider.class, DirigeraStateDescriptionProvider.class }) | ||
| public class DirigeraStateDescriptionProvider extends BaseDynamicStateDescriptionProvider { | ||
| private Map<ChannelUID, StateDescriptionFragment> stateDescriptionMap = new HashMap<>(); | ||
|
|
||
| @Activate | ||
| public DirigeraStateDescriptionProvider(final @Reference EventPublisher eventPublisher, | ||
| final @Reference ItemChannelLinkRegistry itemChannelLinkRegistry, | ||
| final @Reference ChannelTypeI18nLocalizationService channelTypeI18nLocalizationService) { | ||
| this.eventPublisher = eventPublisher; | ||
| this.itemChannelLinkRegistry = itemChannelLinkRegistry; | ||
| this.channelTypeI18nLocalizationService = channelTypeI18nLocalizationService; | ||
| } | ||
|
|
||
| @Override | ||
| public @Nullable StateDescription getStateDescription(Channel channel, | ||
| @Nullable StateDescription originalStateDescription, @Nullable Locale locale) { | ||
| StateDescription original = null; | ||
| StateDescriptionFragment fragment = stateDescriptionMap.get(channel.getUID()); | ||
| if (fragment != null) { | ||
| original = fragment.toStateDescription(); | ||
| StateDescription modified = super.getStateDescription(channel, original, locale); | ||
| if (modified == null) { | ||
| modified = original; | ||
| } | ||
| return modified; | ||
| } | ||
| return super.getStateDescription(channel, original, locale); | ||
| } | ||
|
|
||
| public void setStateDescription(ChannelUID channelUid, StateDescriptionFragment stateDescriptionFragment) { | ||
| StateDescription stateDescription = stateDescriptionFragment.toStateDescription(); | ||
| if (stateDescription != null) { | ||
| StateDescriptionFragment old = stateDescriptionMap.get(channelUid); | ||
| stateDescriptionMap.put(channelUid, stateDescriptionFragment); | ||
| Set<String> linkedItems = null; | ||
| ItemChannelLinkRegistry compareRegistry = itemChannelLinkRegistry; | ||
| if (compareRegistry != null) { | ||
| linkedItems = compareRegistry.getLinkedItemNames(channelUid); | ||
| } | ||
| postEvent(ThingEventFactory.createChannelDescriptionChangedEvent(channelUid, | ||
| linkedItems != null ? linkedItems : Set.of(), stateDescriptionFragment, old)); | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.