Skip to content

Applying a color to all but one device

Jan W edited this page Feb 13, 2021 · 2 revisions

In this example a color is received as property of an object via MQTT (e.g. { "color": "FF0020" }, extracted from the object, and applied to all OpenRGB devices, but one.

Note the second transformation of the OpenRGB sink: { "Type": "Color" }. It is a color transformation without further parameters. It converts an input string to a Color if possible, which is the required type when applying a color via the OpenRGB sink. In general, transformations on a sink are applied before the sink consumes a value.

The sink also has an Overrides property, where devices can be completely ignored or their channel layout overriden (e.g. if for some reason the R & G channels are swapped). You can list connected devices that can be overridden via the command line flag --info. In this case, no color changes are applied to the Razer Copperhead.

// allmylightsrc.json

{
  "Sources": [
    {
      "Type": "Mqtt",
      "Server": "192.168.168.1",
      "Port": 1883,
      "Topics": {
        "Result": "stat/openrgb/color"
      }
    }
  ],
  "Sinks": [
    {
      "Type": "OpenRGB",
      "Server": "127.0.0.1",
      "Port": 6742,
      "Overrides": {
        "Razer Copperhead": {
          "Ignore": true
        }
      },
      "Transformations": [
        {
          "Type": "JsonPath",
          "Expression": "$.color"
        },
        {
          "Type": "Color"
        }
      ]
    }
  ]
}