UNPKG

tibber-api

Version:

Node.js module for connecting to Tibber API and extract data from your connected homes, including realtime data from Tibber Pulse.

82 lines (81 loc) 3.29 kB
import { IConfig } from '../models/IConfig'; import { IHome } from '../models/IHome'; import { IPrice } from '../models/IPrice'; import { EnergyResolution } from '../models/enums/EnergyResolution'; import { IConsumption } from '../models/IConsumption'; import { ISendPushNotification } from '../models/ISendPushNotification'; import { AppScreen } from '../models/enums/AppScreen'; import { TibberQueryBase } from './TibberQueryBase'; export declare class TibberQuery extends TibberQueryBase { /** * Constructor * Create an instace of TibberQuery class * @param {IConfig} config Config object * @param {number} requestTimeout Request timeout in milliseconds. * @see IConfig */ constructor(config: IConfig, requestTimeout?: number); /** * Get selected home with some selected properties, including address and owner. * @param homeId Tibber home ID * @return IHome object */ getHome(homeId: string): Promise<IHome>; /** * Get homes with all properties, including energy price, consumption and production. * @param homeId Tibber home ID * @return IHome object */ getHomeComplete(homeId: string): Promise<IHome>; /** * Get homes with some selected properties, including address and owner. * @return Array of IHome. */ getHomes(): Promise<IHome[]>; /** * Get homes with all properties, including energy price, consumption and production. * @return Array of IHome */ getHomesComplete(): Promise<IHome[]>; /** * Get current energy price for selected home. * @param homeId Tibber home ID * @return IPrice object */ getCurrentEnergyPrice(homeId: string): Promise<IPrice>; /** * Get current energy prices from all homes registered to current user * @return Array of IPrice */ getCurrentEnergyPrices(): Promise<IPrice[]>; /** * Get energy prices for today. * @param homeId Tibber home ID * @return Array of IPrice */ getTodaysEnergyPrices(homeId: string): Promise<IPrice[]>; /** * Get energy prices for tomorrow. These will only be available between 12:00 and 23:59 * @param homeId Tibber home ID * @return Array of IPrice */ getTomorrowsEnergyPrices(homeId: string): Promise<IPrice[]>; /** * Get energy consumption for one or more homes. * Returns an array of IConsumption * @param resolution EnergyResolution. Valid values: HOURLY, DAILY, WEEKLY, MONTHLY, ANNUAL * @param lastCount Return the last number of records * @param homeId Tibber home ID. Optional parameter. Empty parameter will return all registered homes. * @return Array of IConsumption */ getConsumption(resolution: EnergyResolution, lastCount: number, homeId?: string): Promise<IConsumption[]>; /** * Sends a push notification to the current user's tibber app. * Returns a ISendPushNotification Object * @param title: "The title of your message"; * @param message: "The message you want to send"; * @param screen: AppScreen Object, example: AppScreen.HOME ; * @return ISendPushNotification Object */ sendPushNotification(message: string, title: string, screen: AppScreen): Promise<ISendPushNotification>; }