A node/browser wrapper for the Tibber Pulse websocket API.
- Breaking change in 2.0.0: Options is now an object.
- Breaking change in 3.0.0: onData now required, exported class renamed (capitalized).
3.0.0 Changelog:
- Added phase voltage and phase current data.
- Internal changes
Parameters:
- token: Required, from the Tibber API
- homeId: Required, from the Tibber API. Either a string or an array of strings.
- onData: Required. On data received. Is called with two variables - (data, homeId)
- onError: Returns any errors from the subscription. Is called with two variables - (data, homeId)
Methods:
- start: Initiates the subscription. Nothing happens until you invoke this.
Example:
const tibber = ; // Test tokensconst token = `d1007ead2dc84a2b82f0de19451c5fb22112f7ae11d19bf2bedb224a003ff74a`;const homeId = `68e6938b-91a6-4199-a0d4-f24c22be87bb`; const connector = token homeId { console };connectorstart;
Multiple home IDs as an array of strings
const tibber = ; // Test tokensconst token = `d1007ead2dc84a2b82f0de19451c5fb22112f7ae11d19bf2bedb224a003ff74a`;const homeIds = `68e6938b-91a6-4199-a0d4-f24c22be87bb` `68e6938b-91a6-4199-a0d4-f24c22be87bb`; const connector = token homeId: homeIds { console };connectorstart;
Node, with custom WS implementation:
const tibber = ;const ws = ; // Remember to add this dependency, doh // Test tokensconst token = `d1007ead2dc84a2b82f0de19451c5fb22112f7ae11d19bf2bedb224a003ff74a`;const homeId = `68e6938b-91a6-4199-a0d4-f24c22be87bb`; const connector = token homeId ws { console };connectorstart;