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

@smartplant/energy

v3.0.5

Published

Budgets a battery and a solar panel against what the plant needs.

Readme

🔋 @smartplant/energy

HEADER

Solar and battery budgeting: what runs, what sleeps, and how long the charge lasts.

A plugin for smartplant — a bridge between AI and plants.

Install

npm install smartplant @smartplant/energy

Use

import { createPlant } from 'smartplant'
import energy from '@smartplant/energy'

const plant = await createPlant( {
  name    : 'Ivy',
  species : 'Ficus lyrata',
  sensor  : 'mock',
  ai      : { provider : 'ollama' },
  power   : {
    capacityWh : 100,
    solar      : { wattsPeak : 20 },
  },
} )

await plant.use( energy )
plant.plugin( 'energy' ).charge( 0.42 )

console.log( plant.plugin( 'energy' ).forecast().why )

On mains, none of this exists — leave power out and everything measures as often as it likes.

The decisions that are not about power

The lamp goes off at night whatever the charge. Irradiating through the dark period destroys the circadian signal the rest of the library reads, and spare charge does not make that a good trade.

A CAM plant keeps its electrode on at low charge. Its stomata open at night and everything worth measuring happens then — the one plant it would be most tempting to light up is the one where lighting it does the most harm.

Travel is costed there and back. A plant that spends its last charge arriving somewhere is stranded there.

Moving pauses measurement. The motors take more than everything else combined, and an electrode reading taken while the pot is rolling is measuring the journey.

Modes

full, measuring, frugal, survival — chosen by state of charge. Survival still logs: enough to know what is happening and to write it down.

The panel figure is arithmetic until it isn't

Without a current sensor, harvest is a rating multiplied by an efficiency and a number of daylight hours, and it says so every single time. Real yield depends on angle, temperature, dust and shade, and a light sensor pointed at a plant cannot tell you any of them.

plant.plugin( 'energy' ).produced( 4.2 )   // watts, from a current sensor

Twelve of those and the estimate becomes a measurement.

API

charge( fraction )

0 to 1. A percentage passed as 85 is refused — it would read as a battery eighty-five times full and unlock everything forever.

plan( { night, moving } )

{ mode, running, asleep, drawW, why }.

forecast( opts )

{ hours, sustainable, harvest, dailyNeedWh, why }.

canTravel( metres )

{ afford, costWh, why } — one way in, return leg included in the cost.

report( opts )

A line for a panel.

Test

npm test

Runs against the mock sensor and mock AI provider — no hardware, no API key, no network.

📜 License

MIT — see LICENSE.