Skip to content

Instantly share code, notes, and snippets.

@freaktechnik
Last active April 26, 2024 22:07
Show Gist options
  • Save freaktechnik/53e8bf5d80fcf3ab44361cc240acdbd6 to your computer and use it in GitHub Desktop.
Save freaktechnik/53e8bf5d80fcf3ab44361cc240acdbd6 to your computer and use it in GitHub Desktop.

This is the extension of the extension of the extended protocol guide for the Logitech Harmony XMPP protocol, so here goes:

(the first protocol guide )

Get Hue Lights

<iq type="get" id="YourRequestID">
  <oa xmlns="connect.logitech.com" mime="vnd.logitech.harmony/vnd.logitech.harmony.automation?getState"/>
</iq>

Optional params: deviceIds as an array of device ID strings.

returns json!

{
  "device-id": {
    "color": {
      "xy": {
        "y": 0.7106,
        "x": 0.2152
      },
      "mode": "hs", // or ct (temperature) or xy, depending on what was last used to set
      "temp": 300,
      "hueSat": {
        "hue": 25597,
        "sat": 254
      }
    },
    "brightness: 198, // 0-255
    "on": false,
    "status": 0
  }
}

Set Hue Light state

hamrony.automation?setState
{"deviceId": {"on": true}}

Hue light state update

automation.state?notify

Contents is a JSON object with the new (full) state.

Get Sonos metadata

<iq type="get" id="someUniqueId">
  <oa xmlns="connect.logitech.com" mime="vnd.logitech.setup/vnd.logitech.setup.content?getAllMetadata">
    deviceId=theHarmonyDeviceId:all=true
  </oa>
</iq>

When omitting the all param, only an object with the state of the given device is returned as musicMeta.

response is json:

{
  "musicMeta": [
    {
      "muteState": false,
      "activity": false,
      "group": [{
        "id": "34596878",
        "mute": false,
        "vol": 31
      }],
      "service": "",
      "conStatus": "ok",
      "status": "pause",
      "volumeLevel": 31,
      "type": "sonos",
      "groupId": "RINCON_000E58AF6A3401400:10",
      "imageUrl": "",
      "artist": "",
      "coord": true,
      "album": "",
      "title": "",
      "apiLevel": 1,
      "shuffle": true,
      "repeat": false,
      "crossfade": false,
      "deviceId": "34596878"
    },
    {
      "muteState": false,
      "activity": false,
      "group": [{
        "id": "53730463",
        "mute": false,
        "vol": 38
      }],
      "service": "",
      "conStatus": "ok",
      "status": "pause",
      "volumeLevel": 38,
      "type": "sonos",
      "groupId": "RINCON_B8E93738C2AC01400:39",
      "imageUrl": "",
      "artist": "",
      "coord": true,
      "album": "",
      "title": "",
      "apiLevel": 1,
      "shuffle": false,
      "repeat": false,
      "crossfade": false,
      "deviceId": "53730463"
    },
    {
      "muteState": false,
      "activity": true,
      "group": [{
        "id": "53730464",
        "mute": false,
        "vol": 20
      }],
      "service": "",
      "conStatus": "ok",
      "crossfade": false,
      "volumeLevel": 20,
      "type": "sonos",
      "groupId": "RINCON_B8E93738C2AC01400:37",
      "imageUrl": "",
      "artist": "",
      "coord": true,
      "album": "",
      "title": "",
      "apiLevel": 1,
      "shuffle": false,
      "repeat": false,
      "status": "pause",
      "deviceId": "53730464"
    }
  ]
}

Sonos metadata change events

Stanza of type message, which contains an event of type harmonyengine.metadata?notify. Contains an array of JSON strings with a musicMeta property. The property contains an object with the deviceId nd the changed properties (like crossfade).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment