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

homebridge-sun-facade

v0.2.1

Published

Homebridge plugin exposing one HomeKit contact sensor per facade based on the sun's azimuth and altitude.

Readme

homebridge-sun-facade

A Homebridge platform plugin that exposes one HomeKit contact sensor per facade. A sensor reports open while the sun illuminates that facade — determined purely from your location and the time of day (azimuth range + minimum altitude). An optional season gate keeps every facade closed outside the warm months. No network, no weather service, no API key.

Use the sensors as triggers in the iOS Home app: map each facade sensor to a scene or shutter automation yourself. Whether it is actually worth shading right now — cloud cover, outdoor temperature — is deliberately left to a separate sensor; the companion plugin homebridge-metar-cloud provides exactly that (see Combining with cloud cover).

Installation

Requires Homebridge (1.8 or 2.x) running on Node.js 18 or newer.

Homebridge Config UI X (recommended)

In the Plugins tab, search for Sun Facade (homebridge-sun-facade), click Install, then fill in the settings form (see Configuration).

Command line

sudo npm install -g homebridge-sun-facade
sudo hb-service restart

From source (latest / unreleased build)

git clone https://github.com/cduvenhorst/homebridge-sun-facade.git
cd homebridge-sun-facade
npm install          # compiles dist/ via the prepare hook
sudo npm install -g .
sudo hb-service restart

After installation, add the SunFacade platform to your Homebridge config and restart.

Configuration

| Field | Meaning | | --- | --- | | latitude / longitude | Your location in decimal degrees. In Google Maps a place's coordinates appear as latitude, longitude (in that order). Latitude is −90…90 (positive = north); longitude is −180…180 (positive = east). | | updateIntervalSeconds | Evaluation interval (default 60). | | updateMode | onChange (default) writes only on state change; always writes every tick. | | noonAltitudeMin | Optional season gate: facades are only active on days when the sun reaches at least this altitude at solar noon. Leave out to disable. | | facades[] | name, azimuthMin, azimuthMax (0=N, 90=E, 180=S, 270=W; may overlap and wrap across 0/360), altitudeMin (degrees above horizon, default 0). |

Example

{
  "platform": "SunFacade",
  "latitude": 52.37,
  "longitude": 9.74,
  "updateIntervalSeconds": 60,
  "updateMode": "onChange",
  "noonAltitudeMin": 45,
  "facades": [
    { "name": "East", "azimuthMin": 60, "azimuthMax": 135, "altitudeMin": 10 },
    { "name": "South", "azimuthMin": 135, "azimuthMax": 225, "altitudeMin": 5 }
  ]
}

Overlapping ranges mean several sensors are open at once (e.g. around noon both East and South). Wire East/South to your shading scenes in the Home app.

Shading season

You usually want shading only in the warm months and the low winter sun for warmth. Rather than picking calendar dates, set a minimum noon altitude: on any day the sun does not climb that high at solar noon, every facade stays closed. The threshold depends on the date and your latitude only, so it adapts to wherever you live and leaves altitudeMin free to control the time of day.

"noonAltitudeMin": 45

Reference for Hannover (52 N): the noon sun reaches about 14° in mid-winter, 38° at the equinox and 61° in mid-summer, so 45 covers roughly late April to late August.

Wrap-around ranges

When azimuthMin > azimuthMax the range wraps across the 0°/360° boundary, which is useful for north-facing facades:

{ "name": "North", "azimuthMin": 315, "azimuthMax": 45, "altitudeMin": 0 }

This matches azimuths from 315° (NW) through 0° (N) to 45° (NE).

Worldwide use

Sun position is computed for any location and date, in both hemispheres — no time-zone setting is needed (the plugin works from your coordinates and the current time). Azimuth is always measured clockwise from true north (0°=N, 90°=E, 180°=S, 270°=W), so the configuration is identical everywhere; only the ranges you choose differ. Note that in the southern hemisphere the midday sun stands in the north, so a sun-facing facade there uses a range around 0°/360° — e.g. a sun-facing (north) window: azimuthMin: 315, azimuthMax: 45.

Combining with cloud cover

This plugin only answers where the sun is. Whether shading is worth it right now is a different question — on an overcast day, or on a clear but cool spring morning, you want the sun in. homebridge-metar-cloud answers that with a single occupancy sensor that reads detected when it is cloudy or too cool, from free airport weather data.

Put the two together in one automation:

When the facade sensor opens (the sun reaches that wall) and the METAR Cloud sensor is not detected (clear and warm enough) then run the shading scene for that facade.

The two plugins are kept separate on purpose: sun position is pure geometry and never needs the network, while cloud cover is a weather observation. Each stays simple, and you can use either one on its own.

Note that the native Home app only supports a second sensor as a condition to a limited degree. For a reliable "and" across two sensors, build the automation in the Eve app or as a Shortcuts automation.

How it works

Every updateIntervalSeconds the plugin computes the sun's compass azimuth and altitude for your coordinates and the current time (using the suncalc library — no network). A facade's contact sensor is open when all of the following hold:

  • the azimuth lies within the facade's azimuthMin…azimuthMax range (wrapping across 0°/360° if azimuthMin > azimuthMax),
  • the altitude is at or above the facade's altitudeMin, and
  • if noonAltitudeMin is set, today's noon altitude reaches it (the season gate).

Otherwise the sensor is closed. In HomeKit terms, open is CONTACT_NOT_DETECTED and closed is CONTACT_DETECTED. With updateMode: "onChange" (the default) a sensor is only written when its state actually changes; "always" rewrites it every tick.

There is no hysteresis and none is needed: the sun's path is smooth and monotonic, so each threshold is crossed once on the way in and once on the way out — nothing to flap.