UNPKG

homebridge-epex

Version:

Monitor EPEX energy prices using the ENTSO-E transparency platform API.

54 lines (53 loc) 1.76 kB
import type { API, Characteristic, DynamicPlatformPlugin, Logging, PlatformAccessory, PlatformConfig, Service } from 'homebridge'; /** * HomebridgePlatform * This class is the main constructor for your plugin, this is where you should * parse the user config and discover/register accessories with Homebridge. */ export declare class EPEXMonitor implements DynamicPlatformPlugin { readonly log: Logging; readonly config: PlatformConfig; readonly api: API; readonly Service: typeof Service; readonly Characteristic: typeof Characteristic; readonly accessories: Map<string, PlatformAccessory>; readonly discoveredCacheUUIDs: string[]; private allSlots; private currentPrice; private lastSlotHour; private timer?; getCurrentPrice(): number | null; private setCurrentPrice; constructor(log: Logging, config: PlatformConfig, api: API); /** * Poll the ENTSO-E API periodically for energy price data. */ private startPolling; /** * Fetch price data from the ENTSO-E API. */ private pollEPEXPrice; private getEntsoeWindowFor48h; /** * Convert a date to the ENTSO-E required format (YYYYMMDDHHmm). */ private toEntsoeDateString; /** * Parse the ENTSO-E XML response for a full set of day-ahead timeslots. * Returns an array of { start: Date, price: number } for each timeslot. */ private parseAllTimeslots; /** * Notify accessories of the updated price. */ private readonly accessoryHandlers; private updateAccessories; /** * Restore cached accessories. */ configureAccessory(accessory: PlatformAccessory): void; /** * Discover and register accessories. */ private discoverDevices; }