| Channel | Type | Description |
|----------|--------|----------------------------------------------------|
+| power | Switch | Whether the zone/group is active or off |
| volume | Dimmer | The volume of the zone/group |
| mute | Switch | Mutes the zone/group |
| source | Number | The source (1-4) that this zone/group is playing |
String Input3 "Input 3" { channel="amplipi:controller:1:input3" }
String Input4 "Input 4" { channel="amplipi:controller:1:input4" }
+Switch PowerZ2 "Power Zone2" { channel="amplipi:zone:1:zone2:power" }
Dimmer VolumeZ2 "Volume Zone2" { channel="amplipi:zone:1:zone2:volume" }
Switch MuteZ2 "Mute Zone2" { channel="amplipi:zone:1:zone2::mute" }
Number SourceZ2 "Source Zone2" { channel="amplipi:zone:1:zone2::source" }
Selection item=Input4
}
Frame label="Living Room Zone" {
+ Switch item=PowerZ2
Slider item=VolumeZ2 label="Volume Zone 1 [%.1f %%]"
Switch item=MuteZ2
Selection item=SourceZ2
// List of all Channel ids
public static final String CHANNEL_PRESET = "preset";
public static final String CHANNEL_INPUT = "input";
+ public static final String CHANNEL_POWER = "power";
public static final String CHANNEL_VOLUME = "volume";
public static final String CHANNEL_MUTE = "mute";
public static final String CHANNEL_SOURCE = "source";
}
GroupUpdate update = new GroupUpdate();
switch (channelUID.getId()) {
+ case AmpliPiBindingConstants.CHANNEL_POWER:
+ if (command instanceof OnOffType) {
+ update.setMute(command == OnOffType.OFF);
+ }
+ break;
case AmpliPiBindingConstants.CHANNEL_MUTE:
if (command instanceof OnOffType) {
update.setMute(command == OnOffType.ON);
private void updateGroupState(Group state) {
this.groupState = state;
+ Boolean power = !groupState.getMute();
Boolean mute = groupState.getMute();
Integer volDelta = groupState.getVolDelta();
Integer sourceId = groupState.getSourceId();
+ updateState(AmpliPiBindingConstants.CHANNEL_POWER, OnOffType.from(power));
updateState(AmpliPiBindingConstants.CHANNEL_MUTE, OnOffType.from(mute));
updateState(AmpliPiBindingConstants.CHANNEL_VOLUME, AmpliPiUtils.volumeToPercentType(volDelta));
updateState(AmpliPiBindingConstants.CHANNEL_SOURCE, new DecimalType(sourceId));
}
ZoneUpdate update = new ZoneUpdate();
switch (channelUID.getId()) {
+ case AmpliPiBindingConstants.CHANNEL_POWER:
+ if (command instanceof OnOffType) {
+ update.setMute(command == OnOffType.OFF);
+ }
+ break;
case AmpliPiBindingConstants.CHANNEL_MUTE:
if (command instanceof OnOffType) {
update.setMute(command == OnOffType.ON);
private void updateZoneState(Zone state) {
this.zoneState = state;
+ Boolean power = !zoneState.getMute();
Boolean mute = zoneState.getMute();
Integer vol = zoneState.getVol();
Integer sourceId = zoneState.getSourceId();
+ updateState(AmpliPiBindingConstants.CHANNEL_POWER, OnOffType.from(power));
updateState(AmpliPiBindingConstants.CHANNEL_MUTE, OnOffType.from(mute));
updateState(AmpliPiBindingConstants.CHANNEL_VOLUME, AmpliPiUtils.volumeToPercentType(vol));
updateState(AmpliPiBindingConstants.CHANNEL_SOURCE, new DecimalType(sourceId));
<description>A zone of the AmpliPi system</description>
<channels>
+ <channel typeId="system.power" id="power"/>
<channel typeId="system.volume" id="volume"/>
<channel typeId="system.mute" id="mute"/>
<channel typeId="source" id="source"/>
</channels>
+ <properties>
+ <property name="thingTypeVersion">1</property>
+ </properties>
+
<config-description>
<parameter name="id" type="integer" required="true">
<label>Zone ID</label>
<description>A group of the AmpliPi system</description>
<channels>
+ <channel typeId="system.power" id="power"/>
<channel typeId="system.volume" id="volume"/>
<channel typeId="system.mute" id="mute"/>
<channel typeId="source" id="source"/>
</channels>
+ <properties>
+ <property name="thingTypeVersion">1</property>
+ </properties>
+
<config-description>
<parameter name="id" type="integer" required="true">
<label>Group ID</label>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<update:update-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:update="https://openhab.org/schemas/update-description/v1.0.0"
+ xsi:schemaLocation="https://openhab.org/schemas/update-description/v1.0.0 https://openhab.org/schemas/update-description-1.0.0.xsd">
+ <thing-type uid="amplipi:zone">
+ <instruction-set targetVersion="1">
+ <add-channel id="power">
+ <type>system:power</type>
+ </add-channel>
+ </instruction-set>
+ </thing-type>
+ <thing-type uid="amplipi:group">
+ <instruction-set targetVersion="1">
+ <add-channel id="power">
+ <type>system:power</type>
+ </add-channel>
+ </instruction-set>
+ </thing-type>
+</update:update-descriptions>