Hello,

I woul like to create a REST custom sensor to monitor a JSON return value.

The return value looks like this:

[
{
"playerId": "5ba4c379fd806fb029653ba2",
"status": "UP",
"details": ""
},
{
"playerId": "5bc84622f584a05053a928b0",
"status": "UP",
"details": ""
},
{
"playerId": "5bd6dd1827baca48474f1cc4",
"status": "DOWN",
"details": "Player 3 status not playing"
},
{
"playerId": "5c6ce2cf278668f445548f2d",
"status": "DOWN",
"details": "Player 4 has no campaigns published"
},
{
"playerId": "5c6cea3bf7a4f9341509bce7",
"status": "DOWN",
"details": "Player 5 last screenshot are long ago"
},
{
"playerId": "5c6e8a71961e25a43eb6e109",
"status": "UP",
"details": ""
},
{
"playerId": "5cb6df5743b5be4c1ba601b2",
"status": "UP",
"details": ""
}
]


I tried:

 {
        "channel": "playerId",
        "value": $.sensorxref[].playerId
      },
      {
        "channel": "status",
        "value": $.sensorxref[].status
      },
      {
        "channel": "details",
        "value": $.sensorxref[].details
   }

but I get an error:

"result": [ { "channel": "playerId", "value": $.sensorxref[].playerId }, { "channel": "status", "value": $.sensorxref[].status }, { "channel": "details", "value": $.sensorxref[].details } ] } } :5:139 - 5:140 unexpected "=" while scanning extensions.

Article Comments