| zoneN#source (where N= 1-20) | Number | Select the source input for a zone (1-6) |
| zoneN#volume (where N= 1-20) | Dimmer | Control the volume for a zone (0-100%) [translates to 0-79] |
| zoneN#mute (where N= 1-20) | Switch | Mute or unmute a zone |
+| zoneN#favorite (where N= 1-20) | Number | Select a preset Favorite for a zone (1-12) |
| zoneN#control (where N= 1-20) | Player | Simulate pressing the transport control buttons on the keypad e.g. play/pause/next/previous |
| zoneN#treble (where N= 1-20) | Number | Adjust the treble control for a zone (-18 to 18 [in increments of 2]) -18=none, 0=flat, 18=full |
| zoneN#bass (where N= 1-20) | Number | Adjust the bass control for a zone (-18 to 18 [in increments of 2]) -18=none, 0=flat, 18=full |
Number nuvo_z1_source "Source Input [%s]" { channel="nuvo:amplifier:myamp:zone1#source" }
Dimmer nuvo_z1_volume "Volume [%d %%]" { channel="nuvo:amplifier:myamp:zone1#volume" }
Switch nuvo_z1_mute "Mute" { channel="nuvo:amplifier:myamp:zone1#mute" }
+Number nuvo_z1_favorite "Favorite" { channel="nuvo:amplifier:myamp:zone1#favorite" }
Player nuvo_z1_control "Control" { channel="nuvo:amplifier:myamp:zone1#control" }
Number nuvo_z1_treble "Treble Adjustment [%s]" { channel="nuvo:amplifier:myamp:zone1#treble" }
Number nuvo_z1_bass "Bass Adjustment [%s]" { channel="nuvo:amplifier:myamp:zone1#bass" }
//Volume can be a Setpoint also
Slider item=nuvo_z1_volume minValue=0 maxValue=100 step=1 visibility=[nuvo_z1_power==ON] icon="soundvolume"
Switch item=nuvo_z1_mute visibility=[nuvo_z1_power==ON] icon="soundvolume_mute"
+ // mappings is optional to override the default dropdown item labels
+ Selection item=nuvo_z1_favorite visibility=[nuvo_z1_power==ON] icon="player" //mappings=[1="WNYC", 2="BBC One", 2="My Playlist"]
Default item=nuvo_z1_control visibility=[nuvo_z1_power==ON]
Text item=nuvo_s1_display_line1 visibility=[nuvo_z1_source=="1"] icon="zoom"
Text item=nuvo_s6_track_position visibility=[nuvo_z1_source=="6"]
Text item=nuvo_s6_button_press visibility=[nuvo_z1_source=="6"] icon="none"
- Setpoint item=nuvo_z1_treble label="Treble Adjustment [%d]" minValue=-18 maxValue=18 step=2 visibility=[nuvo_z1_power==ON]
- Setpoint item=nuvo_z1_bass label="Bass Adjustment [%d]" minValue=-18 maxValue=18 step=2 visibility=[nuvo_z1_power==ON]
- Setpoint item=nuvo_z1_balance label="Balance Adjustment [%d]" minValue=-18 maxValue=18 step=2 visibility=[nuvo_z1_power==ON]
- Switch item=nuvo_z1_loudness visibility=[nuvo_z1_power==ON]
- Switch item=nuvo_z1_dnd visibility=[nuvo_z1_power==ON]
- Text item=nuvo_z1_lock label="Zone Locked: [%s]" icon="lock"
- Switch item=nuvo_z1_party visibility=[nuvo_z1_power==ON]
+ Text label="Advanced" icon="settings" visibility=[nuvo_z1_power==ON] {
+ Setpoint item=nuvo_z1_treble label="Treble Adjustment [%d]" minValue=-18 maxValue=18 step=2
+ Setpoint item=nuvo_z1_bass label="Bass Adjustment [%d]" minValue=-18 maxValue=18 step=2
+ Setpoint item=nuvo_z1_balance label="Balance Adjustment [%d]" minValue=-18 maxValue=18 step=2
+ Switch item=nuvo_z1_loudness
+ Switch item=nuvo_z1_dnd
+ Switch item=nuvo_z1_party
+ }
+ Text item=nuvo_z1_lock label="Zone Locked: [%s]" icon="lock" visibility=[nuvo_z1_lock=="1"]
}
//repeat for zones 2-20 (substitute z1)
// Send a message to Zone 11
//actions.sendNuvoCommand("Z11MSG\"Hello World\",0,0")
- // Select a Favorite (1-12) for Zone 2
- //actions.sendNuvoCommand("Z2FAV1")
-
end
// In the below examples, a method for maintaing Metadata information
// zone
public static final String CHANNEL_TYPE_POWER = "power";
public static final String CHANNEL_TYPE_SOURCE = "source";
+ public static final String CHANNEL_TYPE_FAVORITE = "favorite";
public static final String CHANNEL_TYPE_VOLUME = "volume";
public static final String CHANNEL_TYPE_MUTE = "mute";
public static final String CHANNEL_TYPE_CONTROL = "control";
ON("ON"),
OFF("OFF"),
SOURCE("SRC"),
+ FAVORITE("FAV"),
VOLUME("VOL"),
MUTE_ON("MUTEON"),
MUTE_OFF("MUTEOFF"),
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.TreeMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
private static final int MAX_ZONES = 20;
private static final int MAX_SRC = 6;
+ private static final int MAX_FAV = 12;
private static final int MIN_VOLUME = 0;
private static final int MAX_VOLUME = 79;
private static final int MIN_EQ = -18;
Set<Integer> activeZones = new HashSet<>(1);
- // A state option list for the source labels
- List<StateOption> sourceLabels = new ArrayList<>();
+ // A tree map that maps the source ids to source labels
+ TreeMap<String, String> sourceLabels = new TreeMap<String, String>();
/**
* Constructor
}
}
break;
+ case CHANNEL_TYPE_FAVORITE:
+ if (command instanceof DecimalType) {
+ int value = ((DecimalType) command).intValue();
+ if (value >= 1 && value <= MAX_FAV) {
+ logger.debug("Got favorite command {} zone {}", value, target);
+ connector.sendCommand(target, NuvoCommand.FAVORITE, String.valueOf(value));
+ }
+ }
+ break;
case CHANNEL_TYPE_VOLUME:
if (command instanceof PercentType) {
int value = (MAX_VOLUME
break;
case CHANNEL_TYPE_ALLMUTE:
if (command instanceof OnOffType) {
- connector.sendCommand(target,
+ connector.sendCommand(
command == OnOffType.ON ? NuvoCommand.ALLMUTE_ON : NuvoCommand.ALLMUTE_OFF);
}
break;
case CHANNEL_TYPE_PAGE:
if (command instanceof OnOffType) {
- connector.sendCommand(target,
- command == OnOffType.ON ? NuvoCommand.PAGE_ON : NuvoCommand.PAGE_OFF);
+ connector.sendCommand(command == OnOffType.ON ? NuvoCommand.PAGE_ON : NuvoCommand.PAGE_OFF);
}
break;
}
} else {
logger.debug("no match on message: {}", updateData);
}
- } else if (updateData.contains(NAME_QUOTE) && sourceLabels.size() <= MAX_SRC) {
+ } else if (updateData.contains(NAME_QUOTE)) {
// example: NAME"Ipod"
String name = updateData.split("\"")[1];
- sourceLabels.add(new StateOption(key, name));
+ sourceLabels.put(key, name);
}
break;
case TYPE_ZONE_UPDATE:
if (prevUpdateTime == lastEventReceived) {
error = "Controller not responding to status requests";
} else {
+ List<StateOption> sourceStateOptions = new ArrayList<>();
+ sourceLabels.keySet().forEach(key -> {
+ sourceStateOptions.add(new StateOption(key, sourceLabels.get(key)));
+ });
+
// Put the source labels on all active zones
activeZones.forEach(zoneNum -> {
stateDescriptionProvider.setStateOptions(new ChannelUID(getThing().getUID(),
ZONE.toLowerCase() + zoneNum + CHANNEL_DELIMIT + CHANNEL_TYPE_SOURCE),
- sourceLabels);
+ sourceStateOptions);
});
}
} catch (NuvoException e) {
<!-- Nuvo Whole House Amplifier Thing -->
<thing-type id="amplifier">
- <label>Whole House Amplifier</label>
+ <label>Nuvo Whole House Amplifier</label>
<description>
A Multi-zone Whole House Amplifier System
</description>
<label>Zone 20</label>
<description>The Controls for Zone 20</description>
</channel-group>
- <channel-group id="source1" typeId="source">
+ <channel-group id="source1" typeId="source_info">
<label>Source 1</label>
<description>The Display Information for Source 1</description>
</channel-group>
- <channel-group id="source2" typeId="source">
+ <channel-group id="source2" typeId="source_info">
<label>Source 2</label>
<description>The Display Information for Source 2</description>
</channel-group>
- <channel-group id="source3" typeId="source">
+ <channel-group id="source3" typeId="source_info">
<label>Source 3</label>
<description>The Display Information for Source 3</description>
</channel-group>
- <channel-group id="source4" typeId="source">
+ <channel-group id="source4" typeId="source_info">
<label>Source 4</label>
<description>The Display Information for Source 4</description>
</channel-group>
- <channel-group id="source5" typeId="source">
+ <channel-group id="source5" typeId="source_info">
<label>Source 5</label>
<description>The Display Information for Source 5</description>
</channel-group>
- <channel-group id="source6" typeId="source">
+ <channel-group id="source6" typeId="source_info">
<label>Source 6</label>
<description>The Display Information for Source 6</description>
</channel-group>
<channels>
<channel id="power" typeId="system.power"/>
<channel id="source" typeId="source"/>
+ <channel id="favorite" typeId="favorite"/>
<channel id="volume" typeId="system.volume"/>
<channel id="mute" typeId="system.mute"/>
<channel id="control" typeId="control"/>
</channels>
</channel-group-type>
- <channel-group-type id="source">
+ <channel-group-type id="source_info">
<label>Source Info</label>
<description>The Display Information for the Source</description>
<channels>
<description>Select the Source Input for the Zone</description>
</channel-type>
+ <channel-type id="favorite">
+ <item-type>Number</item-type>
+ <label>Favorite</label>
+ <description>Select a Preset Favorite for the Zone</description>
+ <state>
+ <options>
+ <option value="1">Favorite 1</option>
+ <option value="2">Favorite 2</option>
+ <option value="3">Favorite 3</option>
+ <option value="4">Favorite 4</option>
+ <option value="5">Favorite 5</option>
+ <option value="6">Favorite 6</option>
+ <option value="7">Favorite 7</option>
+ <option value="8">Favorite 8</option>
+ <option value="9">Favorite 9</option>
+ <option value="10">Favorite 10</option>
+ <option value="11">Favorite 11</option>
+ <option value="12">Favorite 12</option>
+ </options>
+ </state>
+ </channel-type>
+
<channel-type id="control">
<item-type>Player</item-type>
<label>Control</label>