Groov events from Node-Red

Is there a way to get the list of groov events from Node-Red?

The goal is to allow the operator to configure events through groov build and then have Node-Red pick up the event changes to send them out in something other than e-mail.

It looks like the current endpoint is using a session cookie, I would like to use an API key or nothing at all if localhost on port 3001 is workable.

The endpoints that are in active use doesn’t support API keys. However, there’s a set of API-key compatible endpoints that I never finished porting over to. So, with the caveats that:

  1. This isn’t in active use in groov View and may bit-rot at some point.
  2. This isn’t considered documented or stable so could change in any release.

You can get the list of all events in the system with their current states by using api/v0/events and you can target a particular event by using api/v0/events/:event-id where :event-id is an integer. You can get the event ids from that first endpoint.

So if you’re using groov Server for Windows, an AT1, or an AR1, you can use:

https://your-groov-address/api/v0/events?api_key=YOUR_API_KEY
https://your-groov-address/api/v0/events/:event-id?api_key=YOUR_API_KEY

And on EPIC, it’s:

https://your-epic-address/view/api/v0/events?api_key=YOUR_API_KEY
https://your-epic-address/view/api/v0/events/:event-id?api_key=YOUR_API_KEY

The output from the second form looks like this at the moment:

{
  "id": 92,
  "name": "Vegas 22010",
  "enabled": true,
  "condition": {
    "children": [
      {
        "children": [
          {
            "type": "compare",
            "comparator": ">=",
            "tag_id": 158,
            "tag_index": 0,
            "tag_count": 1,
            "bit_index": -1,
            "value": 75,
            "hysteresis": 0,
            "debounce_time": 1
          },
          {
            "type": "compare",
            "comparator": "<=",
            "tag_id": 158,
            "tag_index": 0,
            "tag_count": 1,
            "bit_index": -1,
            "value": 90,
            "hysteresis": 0,
            "debounce_time": 1
          }
        ],
        "type": "and"
      }
    ],
    "type": "or"
  },
  "sendEmailOnBegin": false,
  "sendEmailOnEnd": false,
  "beginEmail": {
    "subject": "Vegas, baby.",
    "body": "Seems like a nice day in Vegas, at {{tag(158,0,1)}}ºF."
  },
  "endEmail": {
    "subject": "Avoid Vegas, baby.",
    "body": "The weather's gross in Vegas now at {{tag(158,0,1)}}ºF."
  },
  "recipients": {
    "users": [],
    "groups": [],
    "everyone": false
  },
  "state": "INACTIVE",
  "errors": [
    {
      "tag": {
        "tagId": 158,
        "tableStart": 0,
        "tableCount": 1,
        "bit": -1
      },
      "errorCode": "CONTROLLER_CANNOT_CONNECT",
      "errorString": "Waiting 29.1 seconds until trying to reconnect to device ControlEngine-jfischer-lx.opto22.com:22010."
    }
  ]
}

The output from the first form (all events) will be an array of those entries.

3 Likes