npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gondalez/homebridge-solaredge-power-flow

v0.0.10

Published

Expose SolarEdge site power-flow data as Matter switches and a battery accessory.

Readme

@gondalez/homebridge-solaredge-power-flow

A Homebridge plugin that exposes your SolarEdge site power flow as Matter switches and a battery level fader — surfaced in the iOS 27+ Home app energy view.

What you get

Up to six Matter accessories, depending on what your SolarEdge site reports:

| Accessory | Device type | When shown | |---|---|---| | Grid | OnOffOutlet | GRID key present in the power flow response | | Load | OnOffOutlet | LOAD key present | | PV | OnOffOutlet | PV key present | | Battery Charge | OnOffOutlet | STORAGE key present | | Battery Discharge | OnOffOutlet | STORAGE key present | | Battery (state of charge) | DimmableLight | STORAGE.chargeLevel present |

Plus one small HomeKit (HAP) switch — the refresh canary (default name SolarEdge Refresh) — that keeps the values fresh; see How updates work.

Each switch is on when its status is "Active" (or "Charging" / "Discharging" for the battery), off otherwise. Power flow direction is inferred from the API's connections[] array: importing from the grid is positive watts, exporting is negative; the battery's charge and discharge directions are reported on separate switches. The Battery Charge and Battery Discharge switches report a positive kW value regardless of direction.

The battery accessory is exposed to the iOS Home app as a DimmableLight: the fader position mirrors STORAGE.chargeLevel (0% = bottom, 100% = top). User changes to the fader are ignored — the next poll reverts the slider to the actual state of charge.

Requirements

  • Homebridge v2.2.0 or later (the plugin uses the Matter electricalPowerMeasurement / electricalEnergyMeasurement cluster support added in homebridge/homebridge@c2d9d7d)
  • Node 22+
  • A SolarEdge API key (admin account → my.solaredge.com → Admin → API Access)
  • A Matter-enabled bridge — either the main bridge or a dedicated child bridge

Installation

Once published:

npm install -g @gondalez/homebridge-solaredge-power-flow

Then add a platform block to your Homebridge config.json:

{
  "platforms": [
    {
      "name": "SolarEdge",
      "apiKey": "YOUR_API_KEY",
      "siteId": 12345,
      "platform": "SolarEdgePowerFlow",
      "_bridge": {
        "name": "SolarEdge Power Flow",
        "matter": { "enabled": true }
      }
    }
  ]
}

Restart Homebridge. The plugin fires a single SolarEdge API request during startup to register the switch and battery accessories that match your site; after that, fetches are triggered by the refresh canary (see below).

Pairing: Matter and HomeKit

The Matter accessories appear once the bridge is commissioned via Matter. For values to keep updating after startup, also pair the same bridge with Apple Home over HomeKit (HAP): Home app → Add Accessory → choose the bridge → enter the HAP setup code shown in Homebridge. This is a separate pairing from the Matter commissioning and is what makes the refresh canary visible to the Home app.

How updates work

Homebridge's Matter API documents a per-accessory getState read hook, but no released Homebridge version (2.2.x) actually calls it — so reads of the Matter accessories alone can never trigger a fetch. The plugin works around this with a refresh canary: a small HAP switch that the iOS Home app does read.

  • The plugin fetches once at startup so accessories register and show initial values.
  • Every time the Home app reads the canary — opening the app, or viewing the room the canary tile is in — a fetch is triggered, and fresh values are pushed to the Matter accessories a moment later.
  • Tap the canary switch to force a refresh. It flips itself back off after a second.
  • Repeated reads are throttled by onDemandCacheSeconds (default 30 s), so rapid re-opens cost at most one API call per window.

Keep the canary tile somewhere the Home app renders often (e.g. the same room as the energy tiles, or your default room). If it's buried in a room you never open, refreshes only happen when you open the app — iOS reads visible accessories. Set refreshCanary: false to disable the canary entirely; the plugin then only fetches once at startup.

Configuration

| Field | Type | Default | Description | |---|---|---|---| | name | string | "SolarEdge" | Platform name shown in Homebridge | | apiKey | string | — | SolarEdge API key (required) | | siteId | integer | — | SolarEdge site ID (required) | | onDemandCacheSeconds | integer | 30 | How long to reuse a fetched response before refetching. Throttles canary-triggered fetches. 0 = refetch on every read. Range 0–3600. | | refreshCanary | boolean | true | Register the HAP refresh-canary switch. false = only fetch once at startup. | | accessoryNames.grid | string | "Grid" | Custom display name | | accessoryNames.load | string | "Load" | | | accessoryNames.pv | string | "PV" | | | accessoryNames.batteryCharge | string | "Battery Charge" | | | accessoryNames.batteryDischarge | string | "Battery Discharge" | | | accessoryNames.battery | string | "Battery" | | | accessoryNames.refreshCanary | string | "SolarEdge Refresh" | | | _bridge.matter.enabled | boolean | true | Required for the plugin to work |

Migration note: refreshIntervalSeconds from earlier versions is no longer used. The plugin no longer polls; it fetches on demand. A stale refreshIntervalSeconds value in your config.json is ignored with a one-time info log.

Behaviour notes

  • On-demand reads — the plugin does not poll the SolarEdge API. It fires one SolarEdge request during startup so the switches and battery accessory are registered and visible under the bridge shortly after Homebridge boots, then only fetches again when the iOS Home app reads the refresh canary (see How updates work). Concurrent triggers are deduplicated into a single SolarEdge call, and the result is cached for onDemandCacheSeconds (default 30 s) so repeated reads within that window cost no API call. If the startup request fails, the accessories still register on the first canary-triggered fetch.
  • API rate limit — the SolarEdge API limit is 300 requests per API key per day. Fetches only happen when the Home app reads the canary (app opens / room views / taps), throttled by onDemandCacheSeconds. With typical use — a handful of app opens an hour — that's a few dozen requests a day at most. Keep the cache at or above the default unless you have a higher-tier API key.
  • Authentication failures (401 / 403) — polling stops, the plugin logs an error, and you'll need to fix the API key and restart Homebridge.
  • Rate limiting (429) — the plugin honours the Retry-After header and immediately fails the request (no retry storm against a rate-limited endpoint).
  • Transient 5xx — three retries with 1 s / 3 s / 9 s backoff before giving up for that cycle.
  • Missing metric in API response — the accessory is unregistered after two consecutive polls where its key is absent, so a brief inverter blip doesn't take down an accessory.
  • Storage direction switches — Battery Charge and Battery Discharge switches are always registered as soon as STORAGE is present in the response. Only the active direction is on; the other is off, and the live kW is shown as a positive value on whichever switch is on. Live power is read from electricalPowerMeasurement.activePower (mW); no lifetime energy is tracked.
  • Power units — currentPower values are normalised to watts using the top-level unit field in the SolarEdge response (W / kW / MW). Unknown units log a one-time warning and are treated as watts.
  • API request/response logging — every HTTP attempt to the SolarEdge API logs a line at info level before the fetch (verb + URL) and another after the response (verb + URL + status + full body). The SolarEdge API key is included in the URL.

Development

npm install
npm test         # runs all tests (vitest)
npm run lint     # eslint
npm run watch    # not used; the plugin has no build step

The project is pure untyped ESM JavaScript — no TypeScript, no JSDoc, no // @ts-check. Tests use vitest and MSW for the HTTP client layer.

License

Apache 2.0