Skip to content

mkalen/tibber-graphql-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tibber GraphQL Java Client

A Java-client for the Tibber energy company's API.

The client is a Java GraphQL client for the Tibber GraphQL API and is built using the Nodes GraphQL library.

Depends on the Tibber GraphQL Model library.

Uses the Tibber GraphQL v1 beta API endpoint.

Pre-Requisites

  1. Access Token for Tibber Authorization. Aquire via the Tibber Developer site.

Building

  1. Build the model library and install in local Maven repo using mvn install

  2. Build the client library and install in local Maven repo using mvn install

Usage

Simple example usage without dynamic configuration:

private static final String AUTH_TOKEN = "(your Tibber authorization Access Token)";
private static final String HOME_ID = "(Primary home id)";
private TibberClient client;

...

        client = new TibberClient(AUTH_TOKEN);

	# Get homes
        List<Home> homes = client.getHomes();
        for (Home home : homes) {
            logger.info("Homes.Home: {}", home);
        }


	# Get consumption for specific time period for a certain home id
        OffsetDateTime since = OffsetDateTime.of(2018, 12, 01, 0, 0, 0, 0, ZoneOffset.of("+01:00"));
        OffsetDateTime until = OffsetDateTime.of(2019, 02, 16, 0, 0, 0, 0, ZoneOffset.of("+01:00"));
        List<Consumption> consumptions = client.getConsumptionSince(HOME_ID, ConsumptionResolution.HOURLY, since, until);

About

Java GraphQL client for Tibber energy company API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages