GraphQL API Support [Alpha]

GraphQL for OpenHAB

This add-on aims to bring GraphQL support to OpenHAB.

After deployment, the system will respond with GraphQL playgrounds on /graphql, and accept queries and subscription requests at that URI.

Contributions welcome! I expect that I will try and eventually submit this as an addon to live in the openhab-addons project, but it needs some more work before then.

Please don’t rely on the shape of this API yet - there may be changes to come (esp. based on feedback)

There is a simple react project that you can use as a basis for your own experiments here:

Current Status

Querying

  • Querying mostly works for items and things. There are a few fields that are still nulled out (mostly around Commands and State) which will come soon.

Mutations

  • First mutation for sendCommand to an individual item.

Subscriptions

  • You can subscribe at an item, items (with a filter) or to everything within a group.
    NB: This is working, but there seems to be an issue with playgrounds not being able to subscribe correctly.

Changelog

Version 0.2

  • Lots of updates - filtering in items, optional querying through groups. First mutation (SendCommand). State now returned. Event subscriptions can also be to filters or to groups.

Version 0.0.1

  • initial work in progress

Current Binary: https://github.com/magnayn/openhab-graphql/releases/download/0.2/org.openhab.io.graphql-4.1.0-SNAPSHOT.jar

Source: GitHub - magnayn/openhab-graphql: GraphQL Support for OpenHAB

1 Like