OH3 und das Sonos Binding

Einrichtung der openHAB Umgebung und allgemeine Konfigurationsthemen.

Moderatoren: seppy, udo1toni

azzkikrboy
Beiträge: 50
Registriert: 18. Apr 2020 13:23
Answers: 1

Re: OH3 und das Sonos Binding

Beitrag von azzkikrboy »

Ja, ich arbeite mit Textdateien, da ich schon mit OH2.x damit gestartet bin.
Beim Umstieg habe ich lange hin-und-her getestet, habe mich aber dafür entschieden die Textdateien zu behalten, da ich keine Lust hatte meint 600+ Items per clicky-clicky neu einzurichten ...

Benutzeravatar
scotty
Beiträge: 676
Registriert: 28. Apr 2020 04:44
Answers: 0

Re: OH3 und das Sonos Binding

Beitrag von scotty »

Ich halte es genau so. Nur in einigen (wenigen) Fällen war es nicht sinnvoll, mit Textdateien zu arbeiten.
OH 3.4.5 im Docker auf Synology DS918+ mit USV, Reolink-RLC-511WA, Philips Hue, AVM Fritz!Box 6591C, Alexa, Logitech Harmony und diversen Shelly's

Benutzeravatar
scotty
Beiträge: 676
Registriert: 28. Apr 2020 04:44
Answers: 0

Re: OH3 und das Sonos Binding

Beitrag von scotty »

Derzeit versuche ich den Radio-Teil über OH3 zu bedienen. Speziell geht es mir da um die Senderauswahl. Hat das jemand von euch zum Laufen gebracht (nach Möglichkeit über ein Widget)?
OH 3.4.5 im Docker auf Synology DS918+ mit USV, Reolink-RLC-511WA, Philips Hue, AVM Fritz!Box 6591C, Alexa, Logitech Harmony und diversen Shelly's

Benutzeravatar
peter-pan
Beiträge: 2771
Registriert: 28. Nov 2018 12:03
Answers: 30
Wohnort: Schwäbisch Gmünd

Re: OH3 und das Sonos Binding

Beitrag von peter-pan »

Ich habe zwei Versionen im Angebot, die man benutzen kann.
1. Einfache Version:
einfach.jpg
Yaml-Code:

Code: Alles auswählen

component: oh-list-card
config:
  mediaList: true
  footer: "component: oh-list-card"
slots:
  default:
    - component: oh-player-item
      config:
        title: Sonos Arbeitszimmer
        icon: oh:sonos_play1
        item: AZ_Sonos_Control
        showRewindFFward: false
        artistItem: AZ_Sonos_CurrentArtist
        trackItem: AZ_Sonos_CurrentTitle
    - component: oh-stepper-item
      config:
        title: Lautstärke
        item: AZ_Sonos_Volume
        fill: false
        raised: true
        icon: oh:soundvolume
    - component: oh-toggle-item
      config:
        title: Mute
        item: AZ_Sonos_Mute
        iconUseState: true
        icon: oh:soundvolume_mute
        color: red
    - component: oh-label-item
      config:
        item: AZ_Sonos_CurrentTitle
        title: "Es läuft:"
    - component: oh-list-item
      config:
        title: Favoriten
        icon: oh:sonos_play1
        action: options
        actionItem: AZ_Sonos_Favorite
        listButton: true
    - component: oh-list-item
      config:
        title: Radio
        icon: oh:sonos_play1
        action: options
        actionItem: AZ_Sonos_Radio
        listButton: true
    - component: oh-list-item
      config:
        title: Playlists
        icon: oh:sonos_play1
        action: options
        actionItem: AZ_Sonos_PlayPlaylist
        listButton: true
2. Version mit Custom-Widget:
custom.jpg
Yaml-Code für Custom-Widget:

Code: Alles auswählen

uid: widget_Sonos_Player
tags: []
props:
  parameters:
    - description: (optional) widget title
      label: (optional) widget title
      name: propWidgetTitle
      required: false
      type: TEXT
    - context: item
      description: item to display the title
      label: item title
      name: itemTitle
      required: true
      type: TEXT
    - context: item
      description: (optional) item to display the album
      label: (optional) item album
      name: itemAlbum
      required: false
      type: TEXT
    - context: item
      description: (optional) item to display the artist
      label: (optional) item artist
      name: itemArtist
      required: false
      type: TEXT
    - context: item
      description: (optional) item to display a cover image
      label: (optional) item cover image
      name: itemCover
      required: false
      type: TEXT
    - context: item
      description: (optional) item to control the player
      label: (optional) item player
      name: itemPlayer
      required: false
      type: TEXT
    - context: item
      description: (optional) item to control the volume
      label: (optional) item volume
      name: itemVolume
      required: false
      type: TEXT
    - context: item
      description: (optional) item for shuffle option
      label: (optional) item shuffle
      name: itemShuffle
      required: false
      type: TEXT
    - context: item
      description: (optional) item for repeat option
      label: (optional) item repeat
      name: itemRepeat
      required: false
      type: TEXT
    - description: (optional) Name of the zone player
      label: (optional) Zone name
      name: propZoneName
      required: false
      type: TEXT
      advanced: true
    - context: item
      description: (optional) item of the zone coordinator channel
      label: (optional) item coordinator
      name: itemCoordinator
      required: false
      type: TEXT
      advanced: true
    - description: (optional) speaker array like this -> ["<zoneName>", "<player>", "<volume>", "<coordinator>"]["<zoneName2>", "<player2>", "<volume2>", "<coordinator2>"]
      label: (optional) speaker array
      name: propZoneArray
      required: false
      type: TEXT
      advanced: true
    - context: item
      description: (optional) item for the sonos mulltiroom rule. e.g. Sonos_Multiroom_Control
      label: (optional) item to control the multiroom control rule
      name: itemSonosRule
      required: false
      type: TEXT
      advanced: true
  parameterGroups: []
timestamp: Jan 31, 2021, 7:40:26 PM
component: f7-card
config:
  title: =props.propWidgetTitle
slots:
  default:
    - component: f7-card-content
      slots:
        default:
          - component: f7-row
            slots:
              default:
                - component: Label
                  config:
                    text: "Title: "
                    class:
                      - display-flex
          - component: f7-row
            config:
              style:
                position: relative
                top: -10px
                height: 30px
              class:
                - justify-content-center
            slots:
              default:
                - component: Label
                  config:
                    text: =items[props.itemTitle].displayState || items[props.itemTitle].state
                    style:
                      fontSize: 28px
                      white-space: nowrap
                      overflow: hidden
          - component: f7-row
            config:
              visible: "=(props.itemAlbum) ? true : false"
            slots:
              default:
                - component: Label
                  config:
                    text: "Album: "
                    class:
                      - display-flex
          - component: f7-row
            config:
              visible: "=(props.itemAlbum) ? true : false"
              style:
                position: relative
                top: -10px
                height: 30px
              class:
                - justify-content-center
            slots:
              default:
                - component: Label
                  config:
                    text: =items[props.itemAlbum].displayState || items[props.itemAlbum].state
                    style:
                      fontSize: 28px
                      white-space: nowrap
                      overflow: hidden
          - component: f7-row
            config:
              visible: "=(props.itemArtist) ? true : false"
            slots:
              default:
                - component: Label
                  config:
                    text: "Artist: "
                    class:
                      - display-flex
          - component: f7-row
            config:
              visible: "=(props.itemArtist) ? true : false"
              style:
                position: relative
                top: -10px
                height: 30px
              class:
                - justify-content-center
            slots:
              default:
                - component: Label
                  config:
                    text: =items[props.itemArtist].displayState || items[props.itemArtist].state
                    style:
                      fontSize: 28px
                      white-space: nowrap
                      overflow: hidden
          - component: f7-row
            config:
              visible: "=(props.itemCover) ? true : false"
              class:
                - margin-vertical
                - justify-content-center
            slots:
              default:
                - component: oh-image
                  config:
                    item: =props.itemCover
                    style:
                      width: 70%
          - component: f7-row
            config:
              visible: "=(props.itemPlayer) ? true : false"
              class:
                - justify-content-space-around
                - display-flex
                - align-items-center
                - align-content-stretch
                - margin-top
              style:
                position: relative
                top: +5px
            slots:
              default:
                - component: f7-icon
                  config:
                    f7: '=(props.itemShuffle) ? "shuffle" : ""'
                    size: 20
                    color: '=(items[props.itemShuffle].state === "ON") ? "green" : ""'
                    style:
                      position: relative
                      left: +7%
                  slots:
                    default:
                      - component: oh-button
                        config:
                          action: command
                          actionItem: =props.itemShuffle
                          actionCommand: '=(items[props.itemShuffle].state !== "ON") ? "ON" : "OFF"'
                          style:
                            position: absolute
                            width: 100%
                            height: 100%
                            top: 0px
                - component: oh-player-item
                  config:
                    style:
                      width: 150px
                    item: =props.itemPlayer
                    class:
                      - display-flex
                      - margin-
                      - align-content-stretch
                      - align-items-center
                      - justify-content-space-around
                - component: f7-icon
                  config:
                    f7: '=(props.itemRepeat) ? (items[props.itemRepeat].state === "ALL") ? "repeat" : (items[props.itemRepeat].state === "ONE") ? "repeat_1" : "repeat" : ""'
                    size: 20
                    color: '=(items[props.itemRepeat].state === "ALL") ? "green" : (items[props.itemRepeat].state === "ONE") ? "green" : ""'
                    style:
                      position: relative
                      left: -8%
                  slots:
                    default:
                      - component: oh-button
                        config:
                          action: command
                          actionItem: =props.itemRepeat
                          actionCommand: '=(items[props.itemRepeat].state === "ALL") ? "ONE" : (items[props.itemRepeat].state === "ONE") ? "OFF": "ALL"'
                          style:
                            position: absolute
                            width: 100%
                            height: 100%
                            top: 0px
          - component: f7-row
            config:
              visible: "=(props.itemVolume) ? true : false"
              class:
                - justify-content-space-around
                - display-flex
                - align-items-center
                - align-content-stretch
            slots:
              default:
                - component: f7-card
                  config:
                    noShadow: true
                    class: margin display-flex align-items-center
                    style:
                      fontSize: 20px
                      min-width: calc(100% - 20px)
                  slots:
                    default:
                      - component: f7-icon
                        config:
                          f7: speaker_3
                          class: margin-horizontal margin
                          size: 30
                      - component: oh-slider
                        config:
                          label: true
                          style:
                            height: +40px
                            width: calc(100% - 35px)
                          min: 0
                          item: =props.itemVolume
                          class:
                            - display-flex
                            - margin-horizontal
                            - align-content-stretch
                            - align-items-center
                            - justify-content-space-around
                      - component: f7-button
                        config:
                          class: '=(props.propZoneArray) ? "" : "display-none"'
                          style:
                            position: absolute
                            height: 100%
                            width: 100%
                            top: 0px
                          popoverOpen: .popoverVolume
                        slots:
                          default:
                            - component: f7-popover
                              config:
                                class: popoverVolume
                                style:
                                  min-width: 350px
                              slots:
                                default:
                                  - component: oh-repeater
                                    config:
                                      for: zoneVolume
                                      in: =props.propZoneArray.split("]")
                                      containerClasses:
                                        - display-flex
                                        - flex-direction-column
                                    slots:
                                      default:
                                        - component: f7-card
                                          config:
                                            class: '=(loop.zoneVolume.split("\"")[1] && items[loop.zoneVolume.split("\"")[7]].state === items[props.itemCoordinator].state) ? "display-flex flex-direction-row justify-content-flex-start align-items-center" : "display-none"'
                                            style:
                                              height: 40px
                                          slots:
                                            default:
                                              - component: Label
                                                config:
                                                  style:
                                                    fontSize: 20px
                                                  class:
                                                    - margin-left
                                                  text: =(loop.zoneVolume.split("\"")[1])
                                              - component: oh-slider
                                                config:
                                                  label: true
                                                  style:
                                                    height: +40px
                                                    width: calc(100% - 40%)
                                                  min: 0
                                                  item: =(loop.zoneVolume.split("\"")[5])
                                                  class:
                                                    - display-flex
                                                    - margin
                                                    - align-content-stretch
                                                    - align-items-center
          - component: f7-row
            config:
              class: '=(props.propZoneName && props.itemPlayer) ? "justify-content-space-around align-items-center align-content-stretch" : "display-none"'
              style:
                position: relative
                top: -26px
                height: 50px
            slots:
              default:
                - component: f7-card
                  config:
                    noShadow: true
                    class: display-flex align-items-center
                    style:
                      fontSize: 20px
                      min-width: 130px
                  slots:
                    default:
                      - component: f7-icon
                        config:
                          f7: hifispeaker
                          size: 30
                          class: margin
                      - component: Label
                        config:
                          class: margin-right
                          text: =props.propZoneName
                          style:
                            fontSize: 20px
                      - component: f7-icon
                        config:
                          f7: '=(items[props.itemPlayer].state === "PLAY") ? "chart_bar_alt_fill" : ""'
                          class: margin-right
                          size: 20
                      - component: f7-button
                        config:
                          class: '=(props.propZoneArray) ? "" : "display-none"'
                          style:
                            position: absolute
                            height: 100%
                            width: 100%
                            top: 0px
                          popoverOpen: .popoverPlayer
                        slots:
                          default:
                            - component: f7-popover
                              config:
                                class: popoverPlayer
                                style:
                                  min-width: 280px
                              slots:
                                default:
                                  - component: oh-repeater
                                    config:
                                      for: zoneSpeaker
                                      in: =props.propZoneArray.split("]")
                                      containerClasses:
                                        - display-flex
                                        - flex-direction-column
                                    slots:
                                      default:
                                        - component: f7-card
                                          config:
                                            class: '=(loop.zoneSpeaker.split("\"")[1]) ? "display-flex flex-direction-row align-items-center" : "display-none"'
                                            style:
                                              height: 40px
                                          slots:
                                            default:
                                              - component: oh-button
                                                config:
                                                  style:
                                                    position: absolute
                                                    top: 0px
                                                    width: 100%
                                                    height: 100%
                                                  action: command
                                                  actionItem: =props.itemSonosRule
                                                  actionCommand: '=(items[loop.zoneSpeaker.split("\"")[7]].state === items[props.itemCoordinator].state) ? "Remove:" + loop.zoneSpeaker.split("\"")[1] + "" : "Add:" + loop.zoneSpeaker.split("\"")[1] + "@" + props.propZoneName'
                                              - component: f7-col
                                                config:
                                                  class: margin display-flex flex-direction-row align-items-center
                                                slots:
                                                  default:
                                                    - component: f7-icon
                                                      config:
                                                        f7: '=(items[loop.zoneSpeaker.split("\"")[7]].state === items[props.itemCoordinator].state) ? "checkmark_alt_circle_fill" : "circle"'
                                                    - component: Label
                                                      config:
                                                        class: margin-left
                                                        text: =loop.zoneSpeaker.split("\"")[1]
                                                        style:
                                                          fontSize: 20px
                                              - component: f7-col
                                                config:
                                                  class: margin align-items-center
                                                slots:
                                                  default:
                                                    - component: f7-icon
                                                      config:
                                                        f7: '=(items[loop.zoneSpeaker.split("\"")[3]].state === "PLAY") ? "chart_bar_alt_fill" : ""'

Yaml-Code für List-Card zur Steuerung:

Code: Alles auswählen

component: oh-list-card
config: {}
slots:
  default:
    - component: oh-list-item
      config:
        title: Favoriten
        icon: oh:sonos_play1
        action: options
        actionItem: AZ_Sonos_Favorite
        listButton: true
    - component: oh-list-item
      config:
        title: Radio
        icon: oh:sonos_play1
        action: options
        actionItem: AZ_Sonos_Radio
        listButton: true
    - component: oh-list-item
      config:
        title: Playlists
        icon: oh:sonos_play1
        action: options
        actionItem: AZ_Sonos_PlayPlaylist
        listButton: true

Yaml-Code für Custom-Widget-Einstellungen (Sonos-Player):

Code: Alles auswählen

component: widget:widget_Sonos_Player
config:
  itemTitle: AZ_Sonos_CurrentTitle
  itemAlbum: AZ_Sonos_CurrentAlbum
  itemArtist: AZ_Sonos_CurrentArtist
  itemCover: AZ_Sonos_CoverAlbum
  itemPlayer: AZ_Sonos_Control
  itemVolume: AZ_Sonos_Volume
  itemShuffle: AZ_Sonos_Shuffle
  itemRepeat: AZ_Sonos_Repeat
  propZoneName: Arbeitszimmer
  
Das Custom-Widget habe ich im internationalen Forum gefunden, weiss aber nicht mehr genau wo. Es gibt aber mehrere Varianten für so einen Player.
Pi5/8GB(PiOS Lite 64-bit(bookworm)/SSD 120GB - OH4.3.5 openhabian

Benutzeravatar
scotty
Beiträge: 676
Registriert: 28. Apr 2020 04:44
Answers: 0

Re: OH3 und das Sonos Binding

Beitrag von scotty »

vielen Dank. Ich habe mir daraus jetzt ein reines Radio gestrickt. Teure Lösung - ich weiß. Allerdings funktioniert die Verbindung Sono -> Synology nur noch über SMBv1, wie ich gelesen habe. Diese stellt jedoch eine erhebliche Sicherheitsgefährdung dar.
Sono bietet immer noch keine perfekte Lösung an, oder ist euch etwas anderes bekannt?
OH 3.4.5 im Docker auf Synology DS918+ mit USV, Reolink-RLC-511WA, Philips Hue, AVM Fritz!Box 6591C, Alexa, Logitech Harmony und diversen Shelly's

BOP
Beiträge: 197
Registriert: 23. Sep 2018 19:43
Answers: 1

Re: OH3 und das Sonos Binding

Beitrag von BOP »

Ich habe neulich in der c't einen interessanten Artikel überflogen. Dort wird beschrieben, wie man einen Raspberry als Brücke zwischen SMB V1 Geräten und neueren SMB Versionen aufbaut.
Leider noch hinter eine Paywall:
Upcycling: Raspberry Pi als Brücke zu Altgeräten mit SMBv1-Protokoll nutzen

Benutzeravatar
scotty
Beiträge: 676
Registriert: 28. Apr 2020 04:44
Answers: 0

Re: OH3 und das Sonos Binding

Beitrag von scotty »

Vielen Dank @BOP. Allerdings bin ich vor geraumer Zeit von einem Raspberry auf eine Synology-NAS umgestiegen. Hinzu kommt, dass mein OH3 dort im Docker läuft. Da gibt es doch einige Unterschiede zum Raspbi.
OH 3.4.5 im Docker auf Synology DS918+ mit USV, Reolink-RLC-511WA, Philips Hue, AVM Fritz!Box 6591C, Alexa, Logitech Harmony und diversen Shelly's

BOP
Beiträge: 197
Registriert: 23. Sep 2018 19:43
Answers: 1

Re: OH3 und das Sonos Binding

Beitrag von BOP »

Hi!
Ist doch eigentlich noch besser. Dann müsstest du ja einen Raspberry über haben.
Der (zusätzliche) Raspberry wird als Brücke benutzt. Er fungiert dabei als ein Übersetzer. Liest/Schreibt also die Daten mittels SMBv2/3 vom Server und reicht diese über SMBv1 an das Endgerät weiter.

Die SONOS sehen also über SMBv1 vom Raspberry das Verzeichnis, welches über SMBv2/3 auf dem Server liegt. Firewall-Regeln sorgen dafür, dass nur die SONOS über SMBv1 zugreifen darf. Und kein anderes Geräte im Netz.

Benutzeravatar
scotty
Beiträge: 676
Registriert: 28. Apr 2020 04:44
Answers: 0

Re: OH3 und das Sonos Binding

Beitrag von scotty »

Den Raspbi habe ich in der Zwischenzeit abgegeben. Trotzdem noch einmal Danke für deine Hilfsbereitschaft.
OH 3.4.5 im Docker auf Synology DS918+ mit USV, Reolink-RLC-511WA, Philips Hue, AVM Fritz!Box 6591C, Alexa, Logitech Harmony und diversen Shelly's

Benutzeravatar
udo1toni
Beiträge: 15265
Registriert: 11. Apr 2018 18:05
Answers: 245
Wohnort: Darmstadt

Re: OH3 und das Sonos Binding

Beitrag von udo1toni »

Natürlich kannst Du eine "Übersetzung" genauso über Docker erreichen, der Raspberry ist ja auch nur eine Plattform, auf der samba läuft. Auf der Synology kannst Du sogar bequem direkt die Verzeichnisse mappen (natürlich read only...)

Es ist halt extrem lästig, dass es notwendig ist, einen separaten SMBv1 Dienst laufen zu lassen, nur weil Sonos es seit Jahren nicht gebacken bekommt, aktuelle Pakete zu verwenden. In meinen Augen ist das ein Armutszeugnis.
openHAB4.3.5 stable in einem Debian-Container (bookworm) (Proxmox 8.4.1, LXC), mit openHABian eingerichtet

Antworten