@@ -190,19 +190,19 @@ that topic.
190
190
191
191
``` json5
192
192
{
193
- " Type" : " Mqtt" ,
194
- " Server" : " 192.168.1.20" ,
195
- " Port" : 1883 ,
196
- " Topics" : {
197
- // optional command topic that is used to request the current color on startup
198
- " Command" : " cmnd/sonoff-1144-dimmer-5/color" ,
199
- " Result" : " stat/sonoff-1144-dimmer-5/RESULT"
200
- },
201
- // transformations are applied in order on any received message
202
- " Transformations" : [
203
- // ... see section transformations for options
204
- ]
205
- }
193
+ " Type" : " Mqtt" ,
194
+ " Server" : " 192.168.1.20" ,
195
+ " Port" : 1883 ,
196
+ " Topics" : {
197
+ // optional command topic that is used to request the current color on startup
198
+ " Command" : " cmnd/sonoff-1144-dimmer-5/color" ,
199
+ " Result" : " stat/sonoff-1144-dimmer-5/RESULT"
200
+ },
201
+ // transformations are applied in order on any received message
202
+ " Transformations" : [
203
+ // ... see section transformations for options
204
+ ]
205
+ }
206
206
```
207
207
208
208
@@ -212,36 +212,35 @@ a json that contains the colors per device if any device state changed.
212
212
213
213
``` json5
214
214
{
215
- " Type" : " OpenRGB" ,
216
- " Server" : " 127.0.0.1" ,
217
- " Port" : 6742 ,
218
- // controls how often OpenRGB is asked for changes, default is 1000ms
219
- " PollingInterval" : 1000 ,
220
- // transformations are applied in order on any received message
221
- " Transformations" : [
222
- // ... see section transformations for options
223
- ]
224
- }
215
+ " Type" : " OpenRGB" ,
216
+ " Server" : " 127.0.0.1" ,
217
+ " Port" : 6742 ,
218
+ // controls how often OpenRGB is asked for changes, default is 1000ms
219
+ " PollingInterval" : 1000 ,
220
+ // transformations are applied in order on any received message
221
+ " Transformations" : [
222
+ // ... see section transformations for options
223
+ ]
224
+ }
225
225
```
226
226
227
- The returned json looks as follows, where for each LED on your device
228
- one color is returned:
227
+ The produced value is of type ` Dictionary<string, DeviceState>() ` where the
228
+ key is the name of your OpenRGB device and ` DeviceState ` is a struct that
229
+ has the following properties:
229
230
230
- ``` json5
231
+ ``` csharp
232
+ public struct DeviceState
231
233
{
232
- " Corsair H150" : {
233
- " Colors" : [ " #FF0000" , " #00FF00" ]
234
- }
234
+ public IEnumerable <Color > Colors ;
235
235
}
236
236
```
237
237
238
- To extract a single color value from that payload, you could use a
239
- [ ` JsonPath ` ] ( #jsonpath ) transformation such as
238
+ To extract values from it, use the [ ` Expression ` ] ( #expression ) transformation such as
240
239
241
240
``` json5
242
241
{
243
- " Type" : " JsonPath " ,
244
- " Expression" : " $[' Corsair H150i PRO RGB' ].Colors[0] "
242
+ " Type" : " Expression " ,
243
+ " Expression" : " value[ \" Corsair H150i PRO RGB\" ].Colors.Cast().First().ToCommaSeparatedRgbString() "
245
244
}
246
245
```
247
246
0 commit comments