]> git.basschouten.com Git - openhab-addons.git/commitdiff
[rotel] New channel to select FM/DAB/iRadio preset (#13285)
authorlolodomo <lg.hc@free.fr>
Sun, 11 Sep 2022 08:08:50 +0000 (10:08 +0200)
committerGitHub <noreply@github.com>
Sun, 11 Sep 2022 08:08:50 +0000 (10:08 +0200)
* [rotel] New channel to select FM/DAB/iRadio preset

For models RCX-1500, RDG-1520, RT-11, RT-1570, T11 and T14

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
15 files changed:
bundles/org.openhab.binding.rotel/README.md
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/RotelBindingConstants.java
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/communication/RotelCommand.java
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/communication/RotelSimuConnector.java
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/handler/RotelHandler.java
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/protocol/ascii/RotelAsciiV1ProtocolHandler.java
bundles/org.openhab.binding.rotel/src/main/java/org/openhab/binding/rotel/internal/protocol/ascii/RotelAsciiV2ProtocolHandler.java
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/i18n/rotel.properties
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/thing/channels.xml
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/thing/rcx1500.xml
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/thing/rdg1520.xml
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/thing/rt11.xml
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/thing/rt1570.xml
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/thing/t11.xml
bundles/org.openhab.binding.rotel/src/main/resources/OH-INF/thing/t14.xml

index cf002594e1c9f566b17fabe03b0ffb6ee44398d3..6fb0a92a769adb3f736b6bba4064243a71fc3f99 100644 (file)
@@ -166,6 +166,7 @@ The following channels are available:
 | track          | Current Track                  | Number    | The current CD track number                              |                                    |
 | random         | Random Mode                    | Switch    | The current random mode                                  |                                    |
 | repeat         | Repeat Mode                    | String    | The current repeat mode                                  | TRACK, DISC, OFF                   |
+| radioPreset    | Radio Preset                   | Number    | Select a radio preset                                    | INCREASE, DECREASE, value between 1 and 30 |
 | mainZone#line1 | Front Panel Line 1             | String    | The first line displayed on the device front panel       |                                    |
 | mainZone#line2 | Front Panel Line 2             | String    | The second line displayed on the device front panel      |                                    |
 | frequency, zone1#frequency, zone2#frequency, zone3#frequency, zone4#frequency | Current Frequency              | Number    | The current frequency (in kHz) for digital source input  |                                    |
@@ -198,9 +199,9 @@ Here are the list of channels available for each thing type:
 | rc1590     | power, source, volume, mute, bass, treble, frequency, brightness, tcbypass, balance, otherCommand       |
 | rcd1570    | power, playControl, brightness                                                                          |
 | rcd1572    | power, playControl, track, random, repeat, brightness, otherCommand                                     |
-| rcx1500    | power, source, volume, mute, playControl                                                                |
+| rcx1500    | power, source, volume, mute, playControl, radioPreset                                                   |
 | rdd1580    | power, source, playControl, frequency, otherCommand                                                     |
-| rdg1520    | power, source, playControl                                                                              |
+| rdg1520    | power, source, playControl, radioPreset                                                                 |
 | rsp1066    | mainZone#power, mainZone#source, mainZone#recordSource, mainZone#dsp, mainZone#volumeUpDown, mainZone#mute, mainZone#bass, mainZone#treble, mainZone#line1, mainZone#otherCommand, zone2#power, zone2#source, zone2#volumeUpDown |
 | rsp1068    | mainZone#power, mainZone#source, mainZone#recordSource, mainZone#dsp, mainZone#volume, mainZone#mute, mainZone#bass, mainZone#treble, mainZone#line1, mainZone#line2, mainZone#otherCommand, zone2#power, zone2#source, zone2#volume, zone2#mute, zone3#power, zone3#source, zone3#volume, zone3#mute, zone4#power, zone4#source, zone4#volume, zone4#mute |
 | rsp1069    | mainZone#power, mainZone#source, mainZone#recordSource, mainZone#dsp, mainZone#volume, mainZone#mute, mainZone#bass, mainZone#treble, mainZone#line1, mainZone#line2, mainZone#otherCommand, zone2#power, zone2#source, zone2#volume, zone2#mute, zone3#power, zone3#source, zone3#volume, zone3#mute, zone4#power, zone4#source, zone4#volume, zone4#mute |
@@ -219,11 +220,11 @@ Here are the list of channels available for each thing type:
 | rsx1560    | mainZone#power, mainZone#source, mainZone#recordSource, mainZone#dsp, mainZone#volume, mainZone#mute, mainZone#bass, mainZone#treble, mainZone#line1, mainZone#line2, mainZone#otherCommand, zone2#power, zone2#source, zone2#volume, zone2#mute, zone3#power, zone3#source, zone3#volume, zone3#mute, zone4#power, zone4#source, zone4#volume, zone4#mute |
 | rsx1562    | mainZone#power, mainZone#source, mainZone#recordSource, mainZone#dsp, mainZone#volume, mainZone#mute, mainZone#line1, mainZone#line2, mainZone#otherCommand, zone2#power, zone2#source, zone2#volume, zone2#mute, zone3#power, zone3#source, zone3#volume, zone3#mute, zone4#power, zone4#source, zone4#volume, zone4#mute |
 | rt09       | power, source, playControl, brightness                                                                  |
-| rt11       | power, source, brightness                                                                               |
-| rt1570     | power, source, brightness                                                                               |
+| rt11       | power, source, radioPreset, brightness                                                                  |
+| rt1570     | power, source, radioPreset, brightness                                                                  |
 | s5         | power, brightness                                                                                       |
-| t11        | power, source, brightness                                                                               |
-| t14        | power, source, brightness                                                                               |
+| t11        | power, source, radioPreset, brightness                                                                  |
+| t14        | power, source, radioPreset, brightness                                                                  |
 | x3         | power, source, volume, mute, bass, treble, frequency, brightness, tcbypass, balance, otherCommand       |
 | x5         | power, source, volume, mute, bass, treble, frequency, brightness, tcbypass, balance, otherCommand       |
 
index 5f4a7e3f84037249397dd1cd34ec8624272a8b6d..6ef0390c1b41bb9ba591d1dc52bc578e751075cd 100644 (file)
@@ -139,6 +139,7 @@ public class RotelBindingConstants {
     public static final String CHANNEL_RANDOM = "random";
     public static final String CHANNEL_REPEAT = "repeat";
     public static final String CHANNEL_FREQUENCY = "frequency";
+    public static final String CHANNEL_RADIO_PRESET = "radioPreset";
     public static final String CHANNEL_LINE1 = "mainZone#line1";
     public static final String CHANNEL_LINE2 = "mainZone#line2";
     public static final String CHANNEL_BRIGHTNESS = "brightness";
index d3bb3dc679c521f2aa0838e2af5bd00ea32a3d26..8d441e30d78c2645070451eb18c9452dfacd60c3 100644 (file)
@@ -355,7 +355,13 @@ public enum RotelCommand {
     RDS_PTY("RDS PTY", PRIMARY_CMD, (byte) 0x45),
     RDS_TP("RDS TP", PRIMARY_CMD, (byte) 0x46),
     RDS_TA("RDS TA", PRIMARY_CMD, (byte) 0x47),
-    FM_MONO_TOGGLE("FM Mono", PRIMARY_CMD, (byte) 0x26),
+    FM_MONO_TOGGLE("FM Mono", PRIMARY_CMD, (byte) 0x26, "fm_mono", null),
+    CALL_FM_PRESET("Recall FM Preset", "call_fm_preset_", "fm_"),
+    CALL_DAB_PRESET("Recall DAB Preset", "call_dab_preset_", "dab_"),
+    CALL_IRADIO_PRESET("Recall iRadio Preset", "call_iradio_preset_", null),
+    PRESET("Request current preset", "get_current_preset", null),
+    FM_PRESET("Request current FM preset number", null, "fm?"),
+    DAB_PRESET("Request current DAB preset number", null, "dab?"),
     ZONE2_TUNE_UP("Zone 2 Tune Up", ZONE2_CMD, (byte) 0x28),
     ZONE2_TUNE_DOWN("Zone 2 Tune Down", ZONE2_CMD, (byte) 0x29),
     ZONE2_PRESET_UP("Zone 2 Preset Up", ZONE2_CMD, (byte) 0x6F),
index b57e8da340a491849cf97a7ef03521b11c60a5ee..30b6316250c31b888167f51148916dfe5a914add 100644 (file)
@@ -78,6 +78,9 @@ public class RotelSimuConnector extends RotelConnector {
     private int track = 1;
     private boolean randomMode;
     private RotelRepeatMode repeatMode = RotelRepeatMode.OFF;
+    private int fmPreset = 5;
+    private int dabPreset = 15;
+    private int iradioPreset = 25;
     private boolean selectingRecord;
     private int showZone;
     private int dimmer;
@@ -834,6 +837,69 @@ public class RotelSimuConnector extends RotelConnector {
                 case REPEAT_MODE:
                     textAscii = buildRepeatModeAsciiResponse();
                     break;
+                case CALL_FM_PRESET:
+                    if (value != null) {
+                        fmPreset = value.intValue();
+                        if (protocol == RotelProtocol.ASCII_V1) {
+                            variableLength = true;
+                            textAscii = buildAsciiResponse(String.format("%s%d", KEY_FM_PRESET, fmPreset),
+                                    "8,Radio FM");
+                        } else {
+                            accepted = false;
+                        }
+                    } else {
+                        accepted = false;
+                    }
+                    break;
+                case CALL_DAB_PRESET:
+                    if (value != null) {
+                        dabPreset = value.intValue();
+                        if (protocol == RotelProtocol.ASCII_V1) {
+                            variableLength = true;
+                            textAscii = buildAsciiResponse(String.format("%s%d", KEY_DAB_PRESET, dabPreset),
+                                    "9,Radio DAB");
+                        } else {
+                            accepted = false;
+                        }
+                    } else {
+                        accepted = false;
+                    }
+                    break;
+                case CALL_IRADIO_PRESET:
+                    if (value != null) {
+                        iradioPreset = value.intValue();
+                        variableLength = true;
+                        textAscii = buildAsciiResponse(String.format("%s%d", KEY_IRADIO_PRESET, iradioPreset),
+                                "12,Radio iRadio");
+                    } else {
+                        accepted = false;
+                    }
+                    break;
+                case PRESET:
+                    if ("FM".equals(sources[0].getName())) {
+                        textAscii = buildAsciiResponse(KEY_PRESET_FM, fmPreset);
+                    } else if ("DAB".equals(sources[0].getName())) {
+                        textAscii = buildAsciiResponse(KEY_PRESET_DAB, dabPreset);
+                    } else if ("IRADIO".equals(sources[0].getName())) {
+                        textAscii = buildAsciiResponse(KEY_PRESET_IRADIO, iradioPreset);
+                    } else {
+                        textAscii = buildAsciiResponse(KEY_PRESET_FM, 0);
+                    }
+                    break;
+                case FM_PRESET:
+                    if ("FM".equals(sources[0].getName())) {
+                        textAscii = buildAsciiResponse(KEY_FM, String.format("%02d", fmPreset));
+                    } else {
+                        textAscii = buildAsciiResponse(KEY_FM, "00");
+                    }
+                    break;
+                case DAB_PRESET:
+                    if ("DAB".equals(sources[0].getName())) {
+                        textAscii = buildAsciiResponse(KEY_DAB, String.format("%02d", dabPreset));
+                    } else {
+                        textAscii = buildAsciiResponse(KEY_DAB, "00");
+                    }
+                    break;
                 case SOURCE_MULTI_INPUT:
                     multiinput = !multiinput;
                     text = "MULTI IN " + (multiinput ? "ON" : "OFF");
index f0bd7b02d1e253bd8760ca9f5cb8451baeb5cd8f..dd5ef9f1efae7966ecd5be6dbaf9cef08fde98ba 100644 (file)
@@ -118,6 +118,7 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
     private int track;
     private boolean randomMode;
     private RotelRepeatMode repeatMode = RotelRepeatMode.OFF;
+    private int radioPreset;
     private double[] frequencies = { 0.0, 0.0, 0.0, 0.0, 0.0 };
     private String frontPanelLine1 = "";
     private String frontPanelLine2 = "";
@@ -855,6 +856,45 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
                             }
                         }
                         break;
+                    case CHANNEL_RADIO_PRESET:
+                        if (!isPowerOn()) {
+                            success = false;
+                            logger.debug("Command {} from channel {} ignored: device in standby", command, channel);
+                        } else {
+                            int value = 0;
+                            if (radioPreset > 0 && command instanceof IncreaseDecreaseType
+                                    && command == IncreaseDecreaseType.INCREASE) {
+                                value = radioPreset + 1;
+                            } else if (radioPreset > 0 && command instanceof IncreaseDecreaseType
+                                    && command == IncreaseDecreaseType.DECREASE) {
+                                value = radioPreset - 1;
+                            } else if (command instanceof DecimalType) {
+                                value = ((DecimalType) command).intValue();
+                            }
+                            if (value >= 1 && value <= 30) {
+                                RotelSource source = sources[0];
+                                RotelCommand presetCallCmd = source == null ? null : getRadioPresetCallCommand(source);
+                                if (presetCallCmd != null) {
+                                    sendCommand(presetCallCmd, value);
+                                    // In ASCII V2, the previous command will return nothing
+                                    RotelCommand presetGetCmd = source == null ? null
+                                            : getRadioPresetGetCommand(source);
+                                    if (protocol == RotelProtocol.ASCII_V2 && presetGetCmd != null) {
+                                        Thread.sleep(SLEEP_INTV);
+                                        sendCommand(presetGetCmd);
+                                    }
+                                } else {
+                                    success = false;
+                                    logger.debug("Command {} from channel {} ignored: current source is not radio",
+                                            command, channel);
+                                }
+                            } else {
+                                success = false;
+                                logger.debug("Command {} from channel {} ignored: value out of bounds", command,
+                                        channel);
+                            }
+                        }
+                        break;
                     case CHANNEL_BRIGHTNESS:
                     case CHANNEL_ALL_BRIGHTNESS:
                         if (!isPowerOn()) {
@@ -1327,6 +1367,33 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
             default:
                 break;
         }
+        int preset = 0;
+        if (key.startsWith(KEY_FM_PRESET)) {
+            try {
+                preset = Integer.parseInt(key.substring(KEY_FM_PRESET.length()));
+            } catch (NumberFormatException e) {
+                // Considering the Rotel protocol, the parsing could not fail in practice.
+                // In case it would fail, 0 will be considered as preset, meaning undefined.
+            }
+            key = KEY_FM_PRESET;
+        } else if (key.startsWith(KEY_DAB_PRESET)) {
+            try {
+                preset = Integer.parseInt(key.substring(KEY_DAB_PRESET.length()));
+            } catch (NumberFormatException e) {
+                // Considering the Rotel protocol, the parsing could not fail in practice.
+                // In case it would fail, 0 will be considered as preset, meaning undefined.
+            }
+            key = KEY_DAB_PRESET;
+        } else if (key.startsWith(KEY_IRADIO_PRESET)) {
+            try {
+                preset = Integer.parseInt(key.substring(KEY_IRADIO_PRESET.length()));
+            } catch (NumberFormatException e) {
+                // Considering the Rotel protocol, the parsing could not fail in practice.
+                // In case it would fail, 0 will be considered as preset, meaning undefined.
+            }
+            key = KEY_IRADIO_PRESET;
+        }
+        RotelSource source;
         try {
             switch (key) {
                 case KEY_ERROR:
@@ -1488,9 +1555,24 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
                     }
                     break;
                 case KEY_SOURCE:
-                    sources[0] = model.getSourceFromCommand(RotelCommand.getFromAsciiCommand(value));
+                    source = model.getSourceFromCommand(RotelCommand.getFromAsciiCommand(value));
+                    sources[0] = source;
                     updateChannelState(CHANNEL_SOURCE);
                     updateChannelState(CHANNEL_MAIN_SOURCE);
+                    RotelCommand presetGetCmd = getRadioPresetGetCommand(source);
+                    if (presetGetCmd != null) {
+                        // Request current preset (with a delay)
+                        scheduler.schedule(() -> {
+                            try {
+                                sendCommand(presetGetCmd);
+                            } catch (RotelException e) {
+                                logger.debug("Getting the radio preset failed: {}", e.getMessage());
+                            }
+                        }, 250, TimeUnit.MILLISECONDS);
+                    } else {
+                        radioPreset = 0;
+                        updateChannelState(CHANNEL_RADIO_PRESET);
+                    }
                     break;
                 case KEY_RECORD:
                     recordSource = model.getRecordSourceFromCommand(RotelCommand.getFromAsciiCommand(value));
@@ -1535,7 +1617,7 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
                     }
                     break;
                 case KEY_TRACK:
-                    RotelSource source = sources[0];
+                    source = sources[0];
                     if (source != null && source.getName().equals("CD") && !model.hasSourceControl()) {
                         track = Integer.parseInt(value);
                         updateChannelState(CHANNEL_TRACK);
@@ -1566,6 +1648,28 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
                         throw new RotelException("Invalid value");
                     }
                     break;
+                case KEY_PRESET_FM:
+                case KEY_PRESET_DAB:
+                case KEY_PRESET_IRADIO:
+                    preset = Integer.parseInt(value);
+                case KEY_FM_PRESET:
+                case KEY_DAB_PRESET:
+                case KEY_IRADIO_PRESET:
+                    if (preset >= 1 && preset <= 30) {
+                        radioPreset = preset;
+                    } else {
+                        radioPreset = 0;
+                    }
+                    updateChannelState(CHANNEL_RADIO_PRESET);
+                    break;
+                case KEY_FM:
+                case KEY_DAB:
+                    preset = Integer.parseInt(value);
+                    if (preset >= 1 && preset <= 30) {
+                        radioPreset = preset;
+                        updateChannelState(CHANNEL_RADIO_PRESET);
+                    }
+                    break;
                 case KEY_FREQ:
                 case KEY_FREQ_ZONE1:
                 case KEY_FREQ_ZONE2:
@@ -1744,6 +1848,7 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
         updateChannelState(CHANNEL_TRACK);
         updateChannelState(CHANNEL_RANDOM);
         updateChannelState(CHANNEL_REPEAT);
+        updateChannelState(CHANNEL_RADIO_PRESET);
         updateChannelState(CHANNEL_FREQUENCY);
         updateChannelState(CHANNEL_BRIGHTNESS);
         updateChannelState(CHANNEL_TCBYPASS);
@@ -2296,6 +2401,11 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
                     }
                 }
                 break;
+            case CHANNEL_RADIO_PRESET:
+                if (isPowerOn()) {
+                    state = radioPreset == 0 ? UnDefType.UNDEF : new DecimalType(radioPreset);
+                }
+                break;
             case CHANNEL_FREQUENCY:
             case CHANNEL_ZONE1_FREQUENCY:
             case CHANNEL_ZONE2_FREQUENCY:
@@ -2779,6 +2889,43 @@ public class RotelHandler extends BaseThingHandler implements RotelMessageEventL
         }
     }
 
+    private @Nullable RotelCommand getRadioPresetGetCommand(RotelSource source) {
+        if (protocol == RotelProtocol.ASCII_V1) {
+            switch (source.getName()) {
+                case "FM":
+                case "DAB":
+                case "IRADIO":
+                    return RotelCommand.PRESET;
+                default:
+                    break;
+            }
+        } else if (protocol == RotelProtocol.ASCII_V2) {
+            switch (source.getName()) {
+                case "FM":
+                    return RotelCommand.FM_PRESET;
+                case "DAB":
+                    return RotelCommand.DAB_PRESET;
+                default:
+                    break;
+            }
+        }
+        return null;
+    }
+
+    private @Nullable RotelCommand getRadioPresetCallCommand(RotelSource source) {
+        switch (source.getName()) {
+            case "FM":
+                return RotelCommand.CALL_FM_PRESET;
+            case "DAB":
+                return RotelCommand.CALL_DAB_PRESET;
+            case "IRADIO":
+                return RotelCommand.CALL_IRADIO_PRESET;
+            default:
+                break;
+        }
+        return null;
+    }
+
     private void sendCommand(RotelCommand cmd) throws RotelException {
         sendCommand(cmd, null);
     }
index 565e4f827800cc3a3a5fb51fe11cd3571bf3d9d0..e39c70aac4d21d1b3a0ce01176097d0d36b419cc 100644 (file)
@@ -101,6 +101,11 @@ public class RotelAsciiV1ProtocolHandler extends RotelAbstractAsciiProtocolHandl
                         messageStr += String.format("%d", value);
                     }
                     break;
+                case CALL_FM_PRESET:
+                case CALL_DAB_PRESET:
+                case CALL_IRADIO_PRESET:
+                    messageStr += String.format("%02d", value);
+                    break;
                 default:
                     break;
             }
index 8b9ca22a5c5da2cd00f133a0cc94fbf1f2ac9397..cf69ab4cbecc7530d290ff951520ae796b5dbb2c 100644 (file)
@@ -112,6 +112,10 @@ public class RotelAsciiV2ProtocolHandler extends RotelAbstractAsciiProtocolHandl
                         messageStr += String.format("%d", value);
                     }
                     break;
+                case CALL_FM_PRESET:
+                case CALL_DAB_PRESET:
+                    messageStr += String.format("%02d", value);
+                    break;
                 default:
                     break;
             }
index 2fa4976732fcac66a3bc9603692d5188c9f014ff..7bc44e09afdb22014c6a9a4bce135d6152dcbf0b 100644 (file)
@@ -116,6 +116,120 @@ channel-type.rotel.frontPanelLine.label = Front Panel Line
 channel-type.rotel.frontPanelLine.description = The line content displayed on the device front panel
 channel-type.rotel.otherCommand.label = Other Command
 channel-type.rotel.otherCommand.description = Choose the command to send to the device
+channel-type.rotel.radioPreset.label = Radio Preset
+channel-type.rotel.radioPreset.description = Select a radio preset
+channel-type.rotel.random.label = Random Mode
+channel-type.rotel.random.description = The current random mode
+channel-type.rotel.recordSource.label = Record Source
+channel-type.rotel.recordSource.description = Select the source to be recorded
+channel-type.rotel.repeat.label = Repeat Mode
+channel-type.rotel.repeat.description = The current repeat mode
+channel-type.rotel.repeat.state.option.TRACK = Track
+channel-type.rotel.repeat.state.option.DISC = Disc
+channel-type.rotel.repeat.state.option.OFF = Off
+channel-type.rotel.source.label = Source Input
+channel-type.rotel.source.description = Select the source input
+channel-type.rotel.speakera.label = Speaker-A Adjustment
+channel-type.rotel.speakera.description = Turn on/off the speaker group A
+channel-type.rotel.speakerb.label = Speaker-B Adjustment
+channel-type.rotel.speakerb.description = Turn on/off the speaker group B
+channel-type.rotel.tcbypass.label = Tone Control Bypass
+channel-type.rotel.tcbypass.description = The user's bass-/treble-settings are bypassed
+channel-type.rotel.track.label = Current Track
+channel-type.rotel.track.description = The current CD track number
+channel-type.rotel.treble.label = Treble Adjustment
+channel-type.rotel.treble.description = Adjust the treble
+channel-type.rotel.volumeUpDown.label = Volume
+channel-type.rotel.volumeUpDown.description = Increase or decrease the volume
+
+# thing type configuration
+
+config.host.label = Address
+config.host.description = Host name or IP address of the Rotel device (IP connection) or the machine connected to the Rotel device (serial over IP)
+config.hostOverIp.label = Address
+config.hostOverIp.description = Host name or IP address of the machine connected to the Rotel device (serial over IP)
+config.inputLabelCd.label = Input Label CD
+config.inputLabelCd.description = Label setup for the source CD
+config.inputLabelMulti.label = Input Label Multi Input
+config.inputLabelMulti.description = Label setup for the source Multi Input
+config.inputLabelTape.label = Input Label Tape
+config.inputLabelTape.description = Label setup for the source Tape
+config.inputLabelTuner.label = Input Label Tuner
+config.inputLabelTuner.description = Label setup for the source Tuner
+config.inputLabelUsb.label = Input Label USB
+config.inputLabelUsb.description = Label setup for the source USB
+config.inputLabelVideo1.label = Input Label Video 1
+config.inputLabelVideo1.description = Label setup for the source Video 1
+config.inputLabelVideo2.label = Input Label Video 2
+config.inputLabelVideo2.description = Label setup for the source Video 2
+config.inputLabelVideo3.label = Input Label Video 3
+config.inputLabelVideo3.description = Label setup for the source Video 3
+config.inputLabelVideo4.label = Input Label Video 4
+config.inputLabelVideo4.description = Label setup for the source Video 4
+config.inputLabelVideo5.label = Input Label Video 5
+config.inputLabelVideo5.description = Label setup for the source Video 5
+config.inputLabelVideo6.label = Input Label Video 6
+config.inputLabelVideo6.description = Label setup for the source Video 6
+config.port.label = Port
+config.port.description = Communication port (IP or serial over IP). For IP connection to the Rotel device, keep the default port 9590
+config.portOverIp.label = Port
+config.portOverIp.description = Communication port (serial over IP)
+config.protocol.label = Protocol Version
+config.protocol.description = Choose one of the two protocol versions (depends on your device firmware)
+config.protocol.option.ASCII_V1 = ASCII V1
+config.protocol.option.ASCII_V2 = ASCII V2
+config.serialPort.label = Serial Port
+config.serialPort.description = Serial port to use for connecting to the Rotel device
+
+# channel group types
+
+channel-group.allZones.label = All Zones
+channel-group.allZones.description = The controls applied to all zones
+channel-group.mainZone.label = Main Zone
+channel-group.mainZone.description = The controls of the main zone
+channel-group.zone.label = Zone
+channel-group.zone.description = The controls of the zone
+channel-group.zone1.label = Zone 1
+channel-group.zone1.description = The controls of the zone 1
+channel-group.zone2.label = Zone 2
+channel-group.zone2.description = The controls of the zone 2
+channel-group.zone3.label = Zone 3
+channel-group.zone3.description = The controls of the zone 3
+channel-group.zone4.label = Zone 4
+channel-group.zone4.description = The controls of the zone 4
+
+# channel dynamic state options
+
+channel-type.rotel.dsp.state.option.NONE = No DSP
+channel-type.rotel.dsp.state.option.STEREO3 = Dolby 3 Stereo
+channel-type.rotel.dsp.state.option.STEREO5 = 5 Channel Stereo
+channel-type.rotel.dsp.state.option.STEREO7 = 7 Channel Stereo
+channel-type.rotel.dsp.state.option.STEREO9 = 9 Channel Stereo
+channel-type.rotel.dsp.state.option.STEREO11 = 11 Channel Stereo
+channel-type.rotel.dsp.state.option.MUSIC1 = Music 1
+channel-type.rotel.dsp.state.option.MUSIC2 = Music 2
+channel-type.rotel.dsp.state.option.MUSIC3 = Music 3
+channel-type.rotel.dsp.state.option.MUSIC4 = Music 4
+channel-type.rotel.dsp.state.option.DSP1 = DSP 1
+channel-type.rotel.dsp.state.option.DSP2 = DSP 2
+channel-type.rotel.dsp.state.option.DSP3 = DSP 3
+channel-type.rotel.dsp.state.option.DSP4 = DSP 4
+channel-type.rotel.dsp.state.option.PROLOGIC = Dolby Pro Logic
+channel-type.rotel.dsp.state.option.PLIICINEMA = Dolby PLII Cinema
+channel-type.rotel.dsp.state.option.PLIIMUSIC = Dolby PLII Music
+channel-type.rotel.dsp.state.option.PLIIGAME = Dolby PLII Game
+channel-type.rotel.dsp.state.option.PLIIXCINEMA = Dolby PLII/PLIIx Cinema
+channel-type.rotel.dsp.state.option.PLIIXMUSIC = Dolby PLII/PLIIx Music
+channel-type.rotel.dsp.state.option.PLIIXGAME = Dolby PLII/PLIIx Game
+channel-type.rotel.dsp.state.option.PLIIZ = Dolby PLIIz
+channel-type.rotel.dsp.state.option.NEO6CINEMA = dts Neo:6 Cinema
+channel-type.rotel.dsp.state.option.NEO6MUSIC = dts Neo:6 Music
+channel-type.rotel.dsp.state.option.BYPASS = Analog Bypass
+channel-type.rotel.dsp.state.option.ATMOS = Dolby Atmos
+channel-type.rotel.dsp.state.option.NEURALX = dts Neural:X
+
+# channel dynamic command options
+
 channel-type.rotel.otherCommand.command.option.POWER_MODE = Request current power mode
 channel-type.rotel.otherCommand.command.option.POWER_MODE_QUICK = Set power mode to quick
 channel-type.rotel.otherCommand.command.option.POWER_MODE_NORMAL = Set power mode to normal
@@ -305,115 +419,6 @@ channel-type.rotel.otherCommand.command.option.HDMI_AMP_MODE = HDMI Amp Mode
 channel-type.rotel.otherCommand.command.option.HDMI_TV_MODE = HDMI TV Mode
 channel-type.rotel.otherCommand.command.option.ROOM_EQ_TOGGLE = Temporary Room EQ Toggle
 channel-type.rotel.otherCommand.command.option.SPEAKER_SETTING_TOGGLE = Speaker Level Setting Toggle
-channel-type.rotel.random.label = Random Mode
-channel-type.rotel.random.description = The current random mode
-channel-type.rotel.recordSource.label = Record Source
-channel-type.rotel.recordSource.description = Select the source to be recorded
-channel-type.rotel.repeat.label = Repeat Mode
-channel-type.rotel.repeat.description = The current repeat mode
-channel-type.rotel.repeat.state.option.TRACK = Track
-channel-type.rotel.repeat.state.option.DISC = Disc
-channel-type.rotel.repeat.state.option.OFF = Off
-channel-type.rotel.source.label = Source Input
-channel-type.rotel.source.description = Select the source input
-channel-type.rotel.speakera.label = Speaker-A Adjustment
-channel-type.rotel.speakera.description = Turn on/off the speaker group A
-channel-type.rotel.speakerb.label = Speaker-B Adjustment
-channel-type.rotel.speakerb.description = Turn on/off the speaker group B
-channel-type.rotel.tcbypass.label = Tone Control Bypass
-channel-type.rotel.tcbypass.description = The user's bass-/treble-settings are bypassed
-channel-type.rotel.track.label = Current Track
-channel-type.rotel.track.description = The current CD track number
-channel-type.rotel.treble.label = Treble Adjustment
-channel-type.rotel.treble.description = Adjust the treble
-channel-type.rotel.volumeUpDown.label = Volume
-channel-type.rotel.volumeUpDown.description = Increase or decrease the volume
-
-# thing type configuration
-
-config.host.label = Address
-config.host.description = Host name or IP address of the Rotel device (IP connection) or the machine connected to the Rotel device (serial over IP)
-config.hostOverIp.label = Address
-config.hostOverIp.description = Host name or IP address of the machine connected to the Rotel device (serial over IP)
-config.inputLabelCd.label = Input Label CD
-config.inputLabelCd.description = Label setup for the source CD
-config.inputLabelMulti.label = Input Label Multi Input
-config.inputLabelMulti.description = Label setup for the source Multi Input
-config.inputLabelTape.label = Input Label Tape
-config.inputLabelTape.description = Label setup for the source Tape
-config.inputLabelTuner.label = Input Label Tuner
-config.inputLabelTuner.description = Label setup for the source Tuner
-config.inputLabelUsb.label = Input Label USB
-config.inputLabelUsb.description = Label setup for the source USB
-config.inputLabelVideo1.label = Input Label Video 1
-config.inputLabelVideo1.description = Label setup for the source Video 1
-config.inputLabelVideo2.label = Input Label Video 2
-config.inputLabelVideo2.description = Label setup for the source Video 2
-config.inputLabelVideo3.label = Input Label Video 3
-config.inputLabelVideo3.description = Label setup for the source Video 3
-config.inputLabelVideo4.label = Input Label Video 4
-config.inputLabelVideo4.description = Label setup for the source Video 4
-config.inputLabelVideo5.label = Input Label Video 5
-config.inputLabelVideo5.description = Label setup for the source Video 5
-config.inputLabelVideo6.label = Input Label Video 6
-config.inputLabelVideo6.description = Label setup for the source Video 6
-config.port.label = Port
-config.port.description = Communication port (IP or serial over IP). For IP connection to the Rotel device, keep the default port 9590
-config.portOverIp.label = Port
-config.portOverIp.description = Communication port (serial over IP)
-config.protocol.label = Protocol Version
-config.protocol.description = Choose one of the two protocol versions (depends on your device firmware)
-config.protocol.option.ASCII_V1 = ASCII V1
-config.protocol.option.ASCII_V2 = ASCII V2
-config.serialPort.label = Serial Port
-config.serialPort.description = Serial port to use for connecting to the Rotel device
-
-# channel group types
-
-channel-group.allZones.label = All Zones
-channel-group.allZones.description = The controls applied to all zones
-channel-group.mainZone.label = Main Zone
-channel-group.mainZone.description = The controls of the main zone
-channel-group.zone.label = Zone
-channel-group.zone.description = The controls of the zone
-channel-group.zone1.label = Zone 1
-channel-group.zone1.description = The controls of the zone 1
-channel-group.zone2.label = Zone 2
-channel-group.zone2.description = The controls of the zone 2
-channel-group.zone3.label = Zone 3
-channel-group.zone3.description = The controls of the zone 3
-channel-group.zone4.label = Zone 4
-channel-group.zone4.description = The controls of the zone 4
-
-# channel types
-
-channel-type.rotel.dsp.state.option.NONE = No DSP
-channel-type.rotel.dsp.state.option.STEREO3 = Dolby 3 Stereo
-channel-type.rotel.dsp.state.option.STEREO5 = 5 Channel Stereo
-channel-type.rotel.dsp.state.option.STEREO7 = 7 Channel Stereo
-channel-type.rotel.dsp.state.option.STEREO9 = 9 Channel Stereo
-channel-type.rotel.dsp.state.option.STEREO11 = 11 Channel Stereo
-channel-type.rotel.dsp.state.option.MUSIC1 = Music 1
-channel-type.rotel.dsp.state.option.MUSIC2 = Music 2
-channel-type.rotel.dsp.state.option.MUSIC3 = Music 3
-channel-type.rotel.dsp.state.option.MUSIC4 = Music 4
-channel-type.rotel.dsp.state.option.DSP1 = DSP 1
-channel-type.rotel.dsp.state.option.DSP2 = DSP 2
-channel-type.rotel.dsp.state.option.DSP3 = DSP 3
-channel-type.rotel.dsp.state.option.DSP4 = DSP 4
-channel-type.rotel.dsp.state.option.PROLOGIC = Dolby Pro Logic
-channel-type.rotel.dsp.state.option.PLIICINEMA = Dolby PLII Cinema
-channel-type.rotel.dsp.state.option.PLIIMUSIC = Dolby PLII Music
-channel-type.rotel.dsp.state.option.PLIIGAME = Dolby PLII Game
-channel-type.rotel.dsp.state.option.PLIIXCINEMA = Dolby PLII/PLIIx Cinema
-channel-type.rotel.dsp.state.option.PLIIXMUSIC = Dolby PLII/PLIIx Music
-channel-type.rotel.dsp.state.option.PLIIXGAME = Dolby PLII/PLIIx Game
-channel-type.rotel.dsp.state.option.PLIIZ = Dolby PLIIz
-channel-type.rotel.dsp.state.option.NEO6CINEMA = dts Neo:6 Cinema
-channel-type.rotel.dsp.state.option.NEO6MUSIC = dts Neo:6 Music
-channel-type.rotel.dsp.state.option.BYPASS = Analog Bypass
-channel-type.rotel.dsp.state.option.ATMOS = Dolby Atmos
-channel-type.rotel.dsp.state.option.NEURALX = dts Neural:X
 
 # thing status descriptions
 
index a87f436d014aa9a4951d0a2c582c0430340e9d5c..e44c50f9ca02a1c70f66710e5580ec4a081be002 100644 (file)
                <label>Other Command</label>
                <description>Choose the command to send to the device</description>
        </channel-type>
+
+       <channel-type id="radioPreset">
+               <item-type>Number</item-type>
+               <label>Radio Preset</label>
+               <description>Select a radio preset</description>
+               <state pattern="%d" readOnly="false" min="1" max="30"/>
+               <autoUpdatePolicy>veto</autoUpdatePolicy>
+       </channel-type>
 </thing:thing-descriptions>
index 3656bedaf34f7fa23058477c0edd5307f04d1349..5ebf612d9966e7e5df86cf20207f1d64a251c617 100644 (file)
@@ -15,6 +15,7 @@
                        <channel id="volume" typeId="system.volume"/>
                        <channel id="mute" typeId="system.mute"/>
                        <channel id="playControl" typeId="system.media-control"/>
+                       <channel id="radioPreset" typeId="radioPreset"/>
                </channels>
 
                <properties>
index 32fc5b2faf32ce86206608b36f3325397560a54f..3f3e1c6c96caae16dd085d93f7cc2e13655eecd1 100644 (file)
@@ -13,6 +13,7 @@
                        <channel id="power" typeId="system.power"/>
                        <channel id="source" typeId="source"/>
                        <channel id="playControl" typeId="system.media-control"/>
+                       <channel id="radioPreset" typeId="radioPreset"/>
                </channels>
 
                <properties>
index f902738f65cd8069ff4e34b2f2e218e1735c9ded..45c18ffa903e0d6517d67593bcbecc3b1e842dcc 100644 (file)
@@ -12,6 +12,7 @@
                <channels>
                        <channel id="power" typeId="system.power"/>
                        <channel id="source" typeId="source"/>
+                       <channel id="radioPreset" typeId="radioPreset"/>
                        <channel id="brightness" typeId="brightness"/>
                </channels>
 
index e35b06345d441e5d10abe14f50b943873f7d0af0..474aa00906912ce1b37b92a047fb2ffada9f0bcd 100644 (file)
@@ -12,6 +12,7 @@
                <channels>
                        <channel id="power" typeId="system.power"/>
                        <channel id="source" typeId="source"/>
+                       <channel id="radioPreset" typeId="radioPreset"/>
                        <channel id="brightness" typeId="brightness"/>
                </channels>
 
index ed0f8e71d9000022d186b67d85c95dd6b3ebb062..ed6c2787b62f6667b7b5de4b38ca586ea81e5f4a 100644 (file)
@@ -12,6 +12,7 @@
                <channels>
                        <channel id="power" typeId="system.power"/>
                        <channel id="source" typeId="source"/>
+                       <channel id="radioPreset" typeId="radioPreset"/>
                        <channel id="brightness" typeId="brightness"/>
                </channels>
 
index 3af348acb6b6ba742b75bf39ef66373c43ac71a3..f457dc557cf98b2345c924335864828872107dc2 100644 (file)
@@ -12,6 +12,7 @@
                <channels>
                        <channel id="power" typeId="system.power"/>
                        <channel id="source" typeId="source"/>
+                       <channel id="radioPreset" typeId="radioPreset"/>
                        <channel id="brightness" typeId="brightness"/>
                </channels>