UNPKG

homebridge-enlighten-power

Version:

Homebridge dynamic platform plugin that exposes Enphase Envoy solar production and consumption as HomeKit sensors. Supports local HTTPS access (firmware D8+, Bearer token) and the Enphase Cloud API v4 (OAuth 2.0 refresh_token). Multiple accessories share

261 lines (260 loc) 7.61 kB
{ "pluginAlias": "EnlightenPower", "pluginType": "platform", "singular": true, "headerDisplay": "Expose your Enphase Envoy solar system to HomeKit as one or more sensors.", "footerDisplay": "See the [README](https://github.com/LeJeko/homebridge-enlighten-power#readme) for setup instructions and the migration guide from v2.", "schema": { "type": "object", "properties": { "name": { "title": "Platform name", "type": "string", "default": "Enlighten Power" }, "connection": { "title": "Connection", "type": "string", "default": "bonjour", "required": true, "oneOf": [ { "title": "Local — Bonjour (envoy.localdomain)", "enum": ["bonjour"] }, { "title": "Local — Custom URL", "enum": ["url"] }, { "title": "Cloud API v4 (OAuth 2.0)", "enum": ["api"] } ] }, "url": { "title": "Envoy base URL", "type": "string", "placeholder": "https://192.168.1.x", "condition": { "functionBody": "return model.connection === 'url';" }, "description": "Base URL of the Envoy. The plugin appends /ivp/meters and /ivp/meters/readings automatically." }, "auth_method": { "title": "Authentication method", "type": "string", "default": "static_token", "condition": { "functionBody": "return model.connection === 'bonjour' || model.connection === 'url';" }, "oneOf": [ { "title": "Static token — generate once at entrez.enphaseenergy.com", "enum": ["static_token"] }, { "title": "Auto-refresh — plugin renews the token using your Enlighten credentials", "enum": ["auto_refresh"] } ] }, "token": { "title": "Bearer token", "type": "string", "placeholder": "eyJraWQiOiI…", "condition": { "functionBody": "return (model.connection === 'bonjour' || model.connection === 'url') && model.auth_method !== 'auto_refresh';" }, "description": "Long-lived JWT from entrez.enphaseenergy.com. Expires after ~1 year." }, "enlighten_user": { "title": "Enlighten email", "type": "string", "placeholder": "you@example.com", "format": "email", "condition": { "functionBody": "return (model.connection === 'bonjour' || model.connection === 'url') && model.auth_method === 'auto_refresh';" } }, "enlighten_pass": { "title": "Enlighten password", "type": "string", "condition": { "functionBody": "return (model.connection === 'bonjour' || model.connection === 'url') && model.auth_method === 'auto_refresh';" } }, "envoy_serial": { "title": "Envoy serial number", "type": "string", "placeholder": "1234XXXXXXXX", "condition": { "functionBody": "return (model.connection === 'bonjour' || model.connection === 'url') && model.auth_method === 'auto_refresh';" }, "description": "Visible on the device or in Enlighten under Devices." }, "system_id": { "title": "System ID", "type": "string", "placeholder": "1234567", "condition": { "functionBody": "return model.connection === 'api';" }, "required": true, "description": "Numeric Enphase system ID (formerly site_id)." }, "api_key": { "title": "API Key", "type": "string", "condition": { "functionBody": "return model.connection === 'api';" }, "required": true, "description": "From your application page on developer-v4.enphase.com" }, "client_id": { "title": "Client ID", "type": "string", "condition": { "functionBody": "return model.connection === 'api';" }, "required": true }, "client_secret": { "title": "Client Secret", "type": "string", "condition": { "functionBody": "return model.connection === 'api';" }, "required": true }, "refresh_token": { "title": "Refresh token", "type": "string", "condition": { "functionBody": "return model.connection === 'api';" }, "required": true, "description": "Valid ~1 month. The plugin renews the access token automatically. See README for how to obtain it." }, "update_interval": { "title": "Update interval (minutes)", "type": "integer", "default": 60, "minimum": 1, "description": "Cloud API: use 60 min (1 req/hour = 720/month, quota 1 000/month). Local: 1 min is fine." }, "accessories": { "title": "Accessories", "type": "array", "items": { "title": "Accessory", "type": "object", "properties": { "name": { "title": "Name", "type": "string", "required": true, "placeholder": "Solar > 6000 W", "description": "Display name in HomeKit — must be unique." }, "measurement": { "title": "Measurement", "type": "string", "default": "production", "oneOf": [ { "title": "Production — solar generation (W)", "enum": ["production"] }, { "title": "Consumption — net grid exchange (W)", "enum": ["consumption"] } ], "description": "Consumption = net grid exchange: negative = exporting surplus. Available for all connection types." }, "power_threshold": { "title": "Threshold (W)", "type": "integer", "default": 1000, "minimum": 1, "description": "Production: triggers when ≥ threshold. Consumption: triggers when export ≥ threshold; resets when importing." }, "accessory_type": { "title": "HomeKit type", "type": "string", "default": "co2sensor", "oneOf": [ { "title": "CO2 sensor — power in ppm + Detected flag", "enum": ["co2sensor"] }, { "title": "Motion sensor", "enum": ["motion"] }, { "title": "Occupancy sensor", "enum": ["occupancy"] }, { "title": "Contact sensor — Open when triggered", "enum": ["contact"] }, { "title": "Light sensor — power in lux", "enum": ["lightsensor"] } ] } } } } } }, "layout": [ "name", { "type": "fieldset", "title": "Connection", "items": [ "connection", "url" ] }, { "type": "fieldset", "title": "Local authentication", "condition": { "functionBody": "return model.connection === 'bonjour' || model.connection === 'url';" }, "items": [ "auth_method", "token", "enlighten_user", { "type": "flex", "flex-flow": "row wrap", "items": [ { "key": "enlighten_pass", "type": "password", "flex": "1 1 200px" }, { "key": "envoy_serial", "flex": "1 1 200px" } ] } ] }, { "type": "fieldset", "title": "Cloud API credentials", "condition": { "functionBody": "return model.connection === 'api';" }, "items": [ { "type": "flex", "flex-flow": "row wrap", "items": [ { "key": "system_id", "flex": "1 1 150px" }, { "key": "api_key", "flex": "2 1 250px" } ] }, { "type": "flex", "flex-flow": "row wrap", "items": [ { "key": "client_id", "flex": "1 1 200px" }, { "key": "client_secret", "flex": "1 1 200px" } ] }, "refresh_token" ] }, "update_interval", { "key": "accessories", "type": "array", "title": "Accessories", "items": [ { "type": "div", "items": [ "accessories[].name", { "type": "flex", "flex-flow": "row wrap", "items": [ { "key": "accessories[].measurement", "flex": "2 1 180px" }, { "key": "accessories[].power_threshold", "flex": "1 1 120px" } ] }, "accessories[].accessory_type" ] } ] } ] }