Skip to content

Commit

Permalink
[sonos] Add support for Sonos Roam (openhab#10596)
Browse files Browse the repository at this point in the history
Fix openhab#10588

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo authored and computergeek1507 committed Jul 13, 2021
1 parent 455c0fd commit a3d3359
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class SonosBindingConstants {
public static final ThingTypeUID ARC_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "Arc");
public static final ThingTypeUID ARC_SL_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "ArcSL");
public static final ThingTypeUID MOVE_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "Move");
public static final ThingTypeUID ROAM_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "Roam");
public static final ThingTypeUID ZONEPLAYER_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "zoneplayer");

public static final Set<ThingTypeUID> WITH_LINEIN_THING_TYPES_UIDS = Stream.of(PLAY5_THING_TYPE_UID,
Expand All @@ -65,11 +66,11 @@ public class SonosBindingConstants {
public static final Set<ThingTypeUID> WITH_DIGITAL_LINEIN_THING_TYPES_UIDS = Stream.of(AMP_THING_TYPE_UID)
.collect(Collectors.toSet());

public static final Set<ThingTypeUID> SUPPORTED_KNOWN_THING_TYPES_UIDS = Stream
.of(ONE_THING_TYPE_UID, ONE_SL_THING_TYPE_UID, PLAY1_THING_TYPE_UID, PLAY3_THING_TYPE_UID,
PLAY5_THING_TYPE_UID, PLAYBAR_THING_TYPE_UID, PLAYBASE_THING_TYPE_UID, BEAM_THING_TYPE_UID,
CONNECT_THING_TYPE_UID, CONNECTAMP_THING_TYPE_UID, PORT_THING_TYPE_UID, AMP_THING_TYPE_UID,
SYMFONISK_THING_TYPE_UID, ARC_THING_TYPE_UID, ARC_SL_THING_TYPE_UID, MOVE_THING_TYPE_UID)
public static final Set<ThingTypeUID> SUPPORTED_KNOWN_THING_TYPES_UIDS = Stream.of(ONE_THING_TYPE_UID,
ONE_SL_THING_TYPE_UID, PLAY1_THING_TYPE_UID, PLAY3_THING_TYPE_UID, PLAY5_THING_TYPE_UID,
PLAYBAR_THING_TYPE_UID, PLAYBASE_THING_TYPE_UID, BEAM_THING_TYPE_UID, CONNECT_THING_TYPE_UID,
CONNECTAMP_THING_TYPE_UID, PORT_THING_TYPE_UID, AMP_THING_TYPE_UID, SYMFONISK_THING_TYPE_UID,
ARC_THING_TYPE_UID, ARC_SL_THING_TYPE_UID, MOVE_THING_TYPE_UID, ROAM_THING_TYPE_UID)
.collect(Collectors.toSet());

public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = new HashSet<>(SUPPORTED_KNOWN_THING_TYPES_UIDS);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="sonos"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">

<!-- Sonos Roam Thing Type -->
<thing-type id="Roam" listed="false">
<label>Roam</label>
<description>Represents SONOS Roam speaker</description>

<channels>
<channel id="add" typeId="add"/>
<channel id="alarm" typeId="alarm"/>
<channel id="alarmproperties" typeId="alarmproperties"/>
<channel id="alarmrunning" typeId="alarmrunning"/>
<channel id="control" typeId="system.media-control"/>
<channel id="currentalbum" typeId="currentalbum"/>
<channel id="currentalbumart" typeId="currentalbumart"/>
<channel id="currentalbumarturl" typeId="currentalbumarturl"/>
<channel id="currentartist" typeId="system.media-artist"/>
<channel id="currenttitle" typeId="system.media-title"/>
<channel id="currenttrack" typeId="currenttrack"/>
<channel id="shuffle" typeId="shuffle"/>
<channel id="repeat" typeId="repeat"/>
<channel id="favorite" typeId="favorite"/>
<channel id="led" typeId="led"/>
<channel id="localcoordinator" typeId="localcoordinator"/>
<channel id="mute" typeId="system.mute"/>
<channel id="notificationsound" typeId="notificationsound"/>
<channel id="playlist" typeId="playlist"/>
<channel id="clearqueue" typeId="clearqueue"/>
<channel id="playlinein" typeId="playlinein"/>
<channel id="playqueue" typeId="playqueue"/>
<channel id="playtrack" typeId="playtrack"/>
<channel id="playuri" typeId="playuri"/>
<channel id="radio" typeId="radio"/>
<channel id="remove" typeId="remove"/>
<channel id="restore" typeId="restore"/>
<channel id="restoreall" typeId="restoreall"/>
<channel id="save" typeId="save"/>
<channel id="saveall" typeId="saveall"/>
<channel id="snooze" typeId="snooze"/>
<channel id="standalone" typeId="standalone"/>
<channel id="state" typeId="state"/>
<channel id="stop" typeId="stop"/>
<channel id="tuneinstationid" typeId="tuneinstationid"/>
<channel id="volume" typeId="system.volume"/>
<channel id="zonegroupid" typeId="zonegroupid"/>
<channel id="zonename" typeId="zonename"/>
<channel id="coordinator" typeId="coordinator"/>
<channel id="sleeptimer" typeId="sleeptimer"/>
<channel id="currenttransporturi" typeId="currenttransporturi"/>
<channel id="currenttrackuri" typeId="currenttrackuri"/>
<!-- Extended SONOS channels -->
<channel id="batterycharging" typeId="batterycharging"/>
<channel id="batterylevel" typeId="system.battery-level"/>
<channel id="microphone" typeId="microphone"/>
</channels>

<properties>
<property name="vendor">SONOS</property>
<property name="modelId">Roam</property>
</properties>

<representation-property>udn</representation-property>

<config-description-ref uri="thing-type:sonos:zoneplayer"/>
</thing-type>
</thing:thing-descriptions>

0 comments on commit a3d3359

Please sign in to comment.