diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceBindingConstants.java b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceBindingConstants.java index 4895fa0bcf3..33eb0b91fb6 100644 --- a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceBindingConstants.java +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceBindingConstants.java @@ -36,6 +36,7 @@ public class PJLinkDeviceBindingConstants { public static final String CHANNEL_TYPE_INPUT = "input"; public static final String CHANNEL_TYPE_AUDIO_MUTE = "audioMute"; public static final String CHANNEL_TYPE_VIDEO_MUTE = "videoMute"; + public static final String CHANNEL_TYPE_AUDIO_AND_VIDEO_MUTE = "audioAndVideoMute"; public static final String CHANNEL_TYPE_LAMP_HOURS = "lampHours"; public static final String CHANNEL_TYPE_LAMP_ACTIVE = "lampActive"; diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceHandler.java b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceHandler.java index 76f45dafd16..2fd759cf1cc 100644 --- a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceHandler.java +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/PJLinkDeviceHandler.java @@ -181,9 +181,12 @@ public class PJLinkDeviceHandler extends BaseThingHandler { break; case CHANNEL_TYPE_AUDIO_MUTE: case CHANNEL_TYPE_VIDEO_MUTE: + case CHANNEL_TYPE_AUDIO_AND_VIDEO_MUTE: boolean isAudioMute = channelTypeId.equals(PJLinkDeviceBindingConstants.CHANNEL_TYPE_AUDIO_MUTE); boolean isVideoMute = channelTypeId.equals(PJLinkDeviceBindingConstants.CHANNEL_TYPE_VIDEO_MUTE); - if (isVideoMute || isAudioMute) { + boolean isAudioAndVideoMute = channelTypeId + .equals(PJLinkDeviceBindingConstants.CHANNEL_TYPE_AUDIO_AND_VIDEO_MUTE); + if (isVideoMute || isAudioMute || isAudioAndVideoMute) { if (command == RefreshType.REFRESH) { // refresh both video and audio mute, as it's one request MuteQueryResponseValue muteStatus = device.getMuteStatus(); @@ -191,6 +194,8 @@ public class PJLinkDeviceHandler extends BaseThingHandler { OnOffType.from(muteStatus.isAudioMuted())); updateState(PJLinkDeviceBindingConstants.CHANNEL_VIDEO_MUTE, OnOffType.from(muteStatus.isVideoMuted())); + updateState(PJLinkDeviceBindingConstants.CHANNEL_TYPE_AUDIO_AND_VIDEO_MUTE, + OnOffType.from(muteStatus.isAudioAndVideoMuted())); } else { if (isAudioMute) { logger.trace("Received audio mute command {}", command); @@ -202,6 +207,11 @@ public class PJLinkDeviceHandler extends BaseThingHandler { boolean muteOn = command == OnOffType.ON; device.setMute(MuteInstructionChannel.VIDEO, muteOn); } + if (isAudioAndVideoMute) { + logger.trace("Received video mute command {}", command); + boolean muteOn = command == OnOffType.ON; + device.setMute(MuteInstructionChannel.AUDIO_AND_VIDEO, muteOn); + } } } else { logger.debug("Received unknown audio/video mute command {}", command); diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/mute/MuteQueryResponse.java b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/mute/MuteQueryResponse.java index 50bf5ef8c77..b56625247ee 100644 --- a/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/mute/MuteQueryResponse.java +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/java/org/openhab/binding/pjlinkdevice/internal/device/command/mute/MuteQueryResponse.java @@ -29,21 +29,24 @@ import org.openhab.binding.pjlinkdevice.internal.device.command.ResponseExceptio public class MuteQueryResponse extends PrefixedResponse { public enum MuteQueryResponseValue { - OFF("Mute off", "30", false, false), - VIDEO_MUTE_ON("Video muted", "11", false, true), - AUDIO_MUTE_ON("Audio muted", "21", true, false), - AUDIO_AND_VIDEO_MUTE_ON("Audio and video muted", "31", true, true); + OFF("Mute off", "30", false, false, false), + VIDEO_MUTE_ON("Video muted", "11", false, true, false), + AUDIO_MUTE_ON("Audio muted", "21", true, false, false), + AUDIO_AND_VIDEO_MUTE_ON("Audio and video muted", "31", true, true, true); private String text; private String code; private boolean audioMuted; private boolean videoMuted; + private boolean audioAndVideoMuted; - private MuteQueryResponseValue(String text, String code, boolean audioMuted, boolean videoMuted) { + private MuteQueryResponseValue(String text, String code, boolean audioMuted, boolean videoMuted, + boolean audioAndVideoMuted) { this.text = text; this.code = code; this.audioMuted = audioMuted; this.videoMuted = videoMuted; + this.audioAndVideoMuted = audioAndVideoMuted; } public String getText() { @@ -67,6 +70,10 @@ public class MuteQueryResponse extends PrefixedResponse SPECIFIED_ERRORCODES = new HashSet<>( diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/i18n/pjLinkDevice.properties b/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/i18n/pjLinkDevice.properties index 407416c4658..4dc05cfda91 100644 --- a/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/i18n/pjLinkDevice.properties +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/i18n/pjLinkDevice.properties @@ -34,6 +34,8 @@ thing-type.config.pjLinkDevice.pjLinkDevice.tcpPort.description = The TCP port o # channel types +channel-type.pjLinkDevice.audioAndVideoMute.label = Audio and Video Mute +channel-type.pjLinkDevice.audioAndVideoMute.description = Select the audio and video mute status channel-type.pjLinkDevice.audioMute.label = Audio Mute channel-type.pjLinkDevice.audioMute.description = Select the audio mute status channel-type.pjLinkDevice.input.label = Input diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/thing/thing-types.xml b/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/thing/thing-types.xml index b70918c9a99..9e20e7a1a47 100644 --- a/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/thing/thing-types.xml +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/thing/thing-types.xml @@ -13,10 +13,15 @@ + + + 1 + + basic @@ -103,6 +108,12 @@ Select the video mute status + + Switch + + Select the audio and video mute status + + Number diff --git a/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/update/instructions.xml b/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/update/instructions.xml new file mode 100644 index 00000000000..82f5100e375 --- /dev/null +++ b/bundles/org.openhab.binding.pjlinkdevice/src/main/resources/OH-INF/update/instructions.xml @@ -0,0 +1,13 @@ + + + + + + pjLinkDevice:audioAndVideoMute + + + + +