From dea24b3dd82b06ce4395bddf0769c50a1e0861cd Mon Sep 17 00:00:00 2001 From: lolodomo Date: Fri, 5 May 2023 23:08:57 +0200 Subject: [PATCH] [sonos] Add support for Era 100 and Era 300 (#14920) Closes #14802 Signed-off-by: Laurent Garnier --- bundles/org.openhab.binding.sonos/README.md | 24 +++--- .../sonos/internal/SonosBindingConstants.java | 6 +- .../resources/OH-INF/i18n/sonos.properties | 4 + .../main/resources/OH-INF/thing/Era100.xml | 73 +++++++++++++++++++ .../main/resources/OH-INF/thing/Era300.xml | 73 +++++++++++++++++++ 5 files changed, 166 insertions(+), 14 deletions(-) create mode 100644 bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era100.xml create mode 100644 bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era300.xml diff --git a/bundles/org.openhab.binding.sonos/README.md b/bundles/org.openhab.binding.sonos/README.md index 5694d5a72..80a8b3f47 100644 --- a/bundles/org.openhab.binding.sonos/README.md +++ b/bundles/org.openhab.binding.sonos/README.md @@ -11,11 +11,11 @@ This happens because of a TTL=1 for ALIVE packets send by Sonos devices, resulti ## Supported Things All available Sonos (playback) devices are supported by this binding. -This includes the One, One SL, Move, Roam, Roam SL, Play:1, Play:3, Play:5, Five, Connect, Connect:Amp, Port, Amp, SYMFONISK, Playbar, Playbase, Beam, Arc, Arc SL and Sub. +This includes the One, One SL, Move, Roam, Roam SL, Play:1, Play:3, Play:5, Five, Era 100, Era 300, Connect, Connect:Amp, Port, Amp, SYMFONISK, Playbar, Playbase, Beam, Arc, Arc SL and Sub. The Bridge and Boost are not supported, but these devices do only have an auxiliary role in the Sonos network and do not have any playback capability. All supported Sonos devices are registered as an audio sink in the framework. -When being defined in a \*.things file, the specific thing types One, OneSL, Move, Roam, RoamSL, PLAY1, PLAY3, PLAY5, Five, SYMFONISK, PLAYBAR, PLAYBASE, Beam, Arc, ArcSL, CONNECT, CONNECTAMP, Port and Amp should be used. +When being defined in a \*.things file, the specific thing types One, OneSL, Move, Roam, RoamSL, PLAY1, PLAY3, PLAY5, Five, Era100, Era300, SYMFONISK, PLAYBAR, PLAYBASE, Beam, Arc, ArcSL, CONNECT, CONNECTAMP, Port and Amp should be used. Please note that these thing types are case sensitive (you need to define them **exactly as stated above**). @@ -58,7 +58,7 @@ The devices support the following channels: | batterycharging | Switch | R | Indicator set to ON when the battery is charging | Move, Roam, RoamSL | | batterylevel | Number | R | Current battery level | Move, Roam, RoamSL | | clearqueue | Switch | W | Suppress all songs from the current queue | all | -| codec | String | R | Name of codec currently being decoded | Arc, Arc SL, PLAYBAR, PLAYBASE, Beam, Amp | +| codec | String | R | Name of codec currently being decoded | Arc, ArcSL, PLAYBAR, PLAYBASE, Beam, Amp | | control | Player | RW | Control the Zone Player, e.g. PLAY/PAUSE/NEXT/PREVIOUS | all | | coordinator | String | R | UDN of the coordinator for the current group | all | | currentalbum | String | R | Name of the album currently playing | all | @@ -70,14 +70,14 @@ The devices support the following channels: | currenttrackuri | String | R | URI of the current track | all | | currenttransporturi | String | R | URI of the current AV transport | all | | favorite | String | W | Play the given favorite entry. The favorite entry has to be predefined in the Sonos Controller app | all | -| heightlevel | Number | RW | Set or get the height level adjustment (value in range -10 / 10) | Arc, Arc SL | +| heightlevel | Number | RW | Set or get the height level adjustment (value in range -10 / 10) | Arc, ArcSL | | led | Switch | RW | Set or get the status of the white LED on the front of the Zone Player | all | -| linein | Switch | R | Indicator set to ON when the line-in of the Zone Player is connected | PLAY5, Five, CONNECT, CONNECTAMP, PLAYBAR, PLAYBASE, Beam, Port | +| linein | Switch | R | Indicator set to ON when the line-in of the Zone Player is connected | PLAY5, Five, Era100, Era300, CONNECT, CONNECTAMP, PLAYBAR, PLAYBASE, Beam, Port | | analoglinein | Switch | R | Indicator set to ON when the analog line-in of the Zone Player is connected | Amp | | digitallinein | Switch | R | Indicator set to ON when the digital line-in of the Zone Player is connected | Amp | | localcoordinator | Switch | R | Indicator set to ON if the this Zone Player is the Zone Group Coordinator | all | | loudness | Switch | RW | Enable or disable the loudness | all | -| microphone | Switch | R | Indicator set to ON when the microphone is enabled | Arc, Beam, Move, One, Roam | +| microphone | Switch | R | Indicator set to ON when the microphone is enabled | Arc, Beam, Move, One, Roam, Era100, Era300 | | mute | Switch | RW | Set or get the mute state of the master volume of the Zone Player | all | | nightmode | Switch | RW | Enable or disable the night mode feature | PLAYBAR, PLAYBASE, Beam, Amp | | notificationsound | String | W | Play a notification sound by a given URI | all | @@ -104,12 +104,12 @@ The devices support the following channels: | state | String | R | The State channel contains state of the Zone Player, e.g. PLAYING, STOPPED, ... | all | | stop | Switch | W | Write `ON` to this channel: Stops the Zone Player player. | all | | treble | Number | RW | Set or get the treble level adjustment (value in range -10 / 10) | all | -| subwoofer | Switch | RW | Enable or disable the subwoofer | Arc, Arc SL | -| subwoofergain | Number | RW | Set or get the subwoofer gain adjustment (value in range -15 / 15) | Arc, Arc SL | -| surround | Switch | RW | Enable or disable the surround audio | Arc, Arc SL | -| surroundmusicmode | String | RW | Set or get the surround playback mode for music, either 0 for Ambient or 1 for full | Arc, Arc SL | -| surroundmusiclevel | Number | RW | Set or get the surround level adjustment for music (value in range -15 / 15) | Arc, Arc SL | -| surroundtvlevel | Number | RW | Set or get the surround level adjustment for TV (value in range -15 / 15) | Arc, Arc SL | +| subwoofer | Switch | RW | Enable or disable the subwoofer | Arc, ArcSL | +| subwoofergain | Number | RW | Set or get the subwoofer gain adjustment (value in range -15 / 15) | Arc, ArcSL | +| surround | Switch | RW | Enable or disable the surround audio | Arc, ArcSL | +| surroundmusicmode | String | RW | Set or get the surround playback mode for music, either 0 for Ambient or 1 for full | Arc, ArcSL | +| surroundmusiclevel | Number | RW | Set or get the surround level adjustment for music (value in range -15 / 15) | Arc, ArcSL | +| surroundtvlevel | Number | RW | Set or get the surround level adjustment for TV (value in range -15 / 15) | Arc, ArcSL | | tuneinstationid | String | RW | Provide the current TuneIn station id or play the TuneIn radio given by its station id | all | | volume | Dimmer | RW | Set or get the master volume of the Zone Player | all | | zonegroupid | String | R | Id of the Zone Group the Zone Player belongs to | all | diff --git a/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosBindingConstants.java b/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosBindingConstants.java index d85df0da2..226042eb1 100644 --- a/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosBindingConstants.java +++ b/bundles/org.openhab.binding.sonos/src/main/java/org/openhab/binding/sonos/internal/SonosBindingConstants.java @@ -53,12 +53,14 @@ public class SonosBindingConstants { 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 ROAM_SL_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "RoamSL"); + public static final ThingTypeUID ERA_100_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "Era100"); + public static final ThingTypeUID ERA_300_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "Era300"); public static final ThingTypeUID ZONEPLAYER_THING_TYPE_UID = new ThingTypeUID(BINDING_ID, "zoneplayer"); public static final Set WITH_LINEIN_THING_TYPES_UIDS = Set.of(PLAY5_THING_TYPE_UID, FIVE_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, ARC_THING_TYPE_UID, - ARC_SL_THING_TYPE_UID); + ARC_SL_THING_TYPE_UID, ERA_100_THING_TYPE_UID, ERA_300_THING_TYPE_UID); public static final Set WITH_ANALOG_LINEIN_THING_TYPES_UIDS = Set.of(AMP_THING_TYPE_UID); @@ -69,7 +71,7 @@ public class SonosBindingConstants { FIVE_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, ROAM_SL_THING_TYPE_UID); + ROAM_THING_TYPE_UID, ROAM_SL_THING_TYPE_UID, ERA_100_THING_TYPE_UID, ERA_300_THING_TYPE_UID); public static final Set SUPPORTED_THING_TYPES_UIDS = new HashSet<>(SUPPORTED_KNOWN_THING_TYPES_UIDS); static { diff --git a/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/i18n/sonos.properties b/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/i18n/sonos.properties index 97429e562..b30363615 100644 --- a/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/i18n/sonos.properties +++ b/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/i18n/sonos.properties @@ -24,6 +24,10 @@ thing-type.sonos.CONNECT.label = CONNECT thing-type.sonos.CONNECT.description = Represents SONOS CONNECT connector thing-type.sonos.CONNECTAMP.label = CONNECT AMP thing-type.sonos.CONNECTAMP.description = Represents SONOS CONNECT:AMP amplifier +thing-type.sonos.Era100.label = Era 100 +thing-type.sonos.Era100.description = Represents SONOS Era 100 speaker +thing-type.sonos.Era300.label = Era 300 +thing-type.sonos.Era300.description = Represents SONOS Era 300 speaker thing-type.sonos.Five.label = Five thing-type.sonos.Five.description = Represents SONOS Five speaker thing-type.sonos.Move.label = Move diff --git a/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era100.xml b/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era100.xml new file mode 100644 index 000000000..94060fe8f --- /dev/null +++ b/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era100.xml @@ -0,0 +1,73 @@ + + + + + + + Represents SONOS Era 100 speaker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SONOS + Era 100 + + + udn + + + + diff --git a/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era300.xml b/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era300.xml new file mode 100644 index 000000000..a2c5cdb32 --- /dev/null +++ b/bundles/org.openhab.binding.sonos/src/main/resources/OH-INF/thing/Era300.xml @@ -0,0 +1,73 @@ + + + + + + + Represents SONOS Era 300 speaker + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SONOS + Era 300 + + + udn + + + +