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.
- Access Token for Tibber Authorization. Aquire via the Tibber Developer site.
-
Build the model library and install in local Maven repo using
mvn install
-
Build the client library and install in local Maven repo using
mvn install
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);