Skip to content

Applying a color to Chroma devices

Jan W edited this page Feb 17, 2021 · 1 revision

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 a Chroma devices of type mouse.

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

// allmylightsrc.json

{
  "Sources": [
    {
      "Type": "Mqtt",
      "Server": "192.168.168.1",
      "Port": 1883,
      "Topics": {
        "Result": "stat/openrgb/color"
      }
    }
  ],
  "Sinks": [
    {
      "Type": "Chroma",
      "SupportedDevices": [ "mouse" ],
      "Transformations": [
        {
          "Type": "JsonPath",
          "Expression": "$.color"
        },
        {
          "Type": "Color"
        }
      ]
    }
  ]
}