[WIP] Support GraphQL endpoint #10
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here' s a draft of API v2 support. Currently supports read-only queries. There will be definitely breaking changes (at least in authentication). When using GraphQL API we might add support for multiple controllers.
Example usage:
customer():{ "id": 123, # controller id "customerId": 99999, "name": "John Doe ", "email": "john@example.com", "validated": true, "controllers": [ { "id": 11111, "name": "Garden", "deviceId": 123456 } ] }controllers():[ { "id": 123, # controller id "name": "Garden", "online": true, "deviceId": 777, "wizardComplete": true, "hardware": { "serialNumber": "a3egafe1", "version": "hydrawise116", "status": "Linked", "installationDate": "Fri, 16 Jul 21 17:34:11 +0000" }, "softwareVersion": "6.26", "boc": false, "lastAction": { "value": "Fri, 01 Apr 22 11:26:44 +0200", "timestamp": 1648805204 } } ]sensors():[ { "id": 123, # controller id "name": "Garden", "sensors": [ { "id": 789456, "name": "Rainfall", "model": { "id": 4444, "name": "Rain Sensor (normally closed wire)", "modeType": "STOP", "active": true, "offLevel": 1, "offTimer": 0, "delay": 0, "divisor": 0, "flowRate": 0, "customerId": 0, "sensorType": "LEVEL_CLOSED", "category": { "name": "Hunter Clik" } } } ] } ]zones():[ { "id": 123, "name": "Garden", "zones": [ { "id": 100, "name": "Zone 1" }, { "id": 101, "name": "Zone 2" } ] } ]TODO:
This PR adds dependency on
gqllibrary, which seems to be a minimalistic GraphQL client, but Python 2 is no longer supported.@ptcryan Is it ok to continue with implementation this way? The responses should be Python dict or JSON is preferred?