mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[astro] Use the existing ChannelUID instance to check the linked state (#17126)
Signed-off-by: Jörg Sautter <joerg.sautter@gmx.net>
This commit is contained in:
parent
104a1e5379
commit
937ccf6753
@ -167,8 +167,8 @@ public abstract class AstroThingHandler extends BaseThingHandler {
|
||||
*/
|
||||
public void publishChannelIfLinked(ChannelUID channelUID) {
|
||||
Planet planet = getPlanet();
|
||||
if (isLinked(channelUID.getId()) && planet != null) {
|
||||
final Channel channel = getThing().getChannel(channelUID.getId());
|
||||
if (isLinked(channelUID) && planet != null) {
|
||||
final Channel channel = getThing().getChannel(channelUID);
|
||||
if (channel == null) {
|
||||
logger.error("Cannot find channel for {}", channelUID);
|
||||
return;
|
||||
@ -272,8 +272,8 @@ public abstract class AstroThingHandler extends BaseThingHandler {
|
||||
private boolean isPositionalChannelLinked() {
|
||||
List<String> positionalChannels = Arrays.asList(getPositionalChannelIds());
|
||||
for (Channel channel : getThing().getChannels()) {
|
||||
String id = channel.getUID().getId();
|
||||
if (isLinked(id) && positionalChannels.contains(id)) {
|
||||
ChannelUID id = channel.getUID();
|
||||
if (isLinked(id) && positionalChannels.contains(id.getId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class AstroCommandTest {
|
||||
Thing thing = mock(Thing.class);
|
||||
when(thing.getConfiguration()).thenReturn(thingConfiguration);
|
||||
when(thing.getUID()).thenReturn(thingUID);
|
||||
when(thing.getChannel(DEFAULT_TEST_CHANNEL_ID)).thenReturn(channel);
|
||||
when(thing.getChannel(channelUID)).thenReturn(channel);
|
||||
|
||||
ThingHandlerCallback callback = mock(ThingHandlerCallback.class);
|
||||
CronScheduler cronScheduler = mock(CronScheduler.class);
|
||||
|
Loading…
Reference in New Issue
Block a user