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 🙏

© 2025 – Pkg Stats / Ryan Hefner

sunnyadapter

v0.0.8

Published

A small service that creates a simple (limited, unofficial) API for SunnyPortal.com.

Readme

Sunny Adapter

A small service that creates a simple (limited, unofficial) API for SunnyPortal.com.

It uses a chromium browser in the background to login, press buttons, fill in forms, etc. For now it has a single feature, setting the Time window control for charging the battery-storage system

How to use

You can run this as a NPM package or as Docker.

npm install -g sunnyadapter
AUTH=apiAccessPassword PORT=3000 USER=myUser PASSWORD=myPassword sunnyadapter
docker run -it ghcr.io/mikabytes/sunnyadapter -e AUTH=apiAccessPassword -e USER=myUser -e PASSWORD=myPassword -p 3000:3000

Then, a service will run on the chosen port.

API

As of now there is a single endpoint:

PUT /plants/:plant/battery/time-window

[{"start": STARTSTR, "stop": STOPSTR, "power": WATTAGE}, {...}, {...}]

Where :plant should be replaced with the value of the first column in this table https://sunnyportal.com/Plants

Where objects should be formatted as following:

| type | description | examples | | ---------- | ------------------------------------------------------------------------------------------- | -------------------------------------- | | STARTSTR | 24-hour formatted time | 00:00 05:30 5:30 23:30 12:34 | | STOPSTR | 24-hour formatted time OR an offset starting with plus (+) sign ending with unit (h or m) | 00:00 23:30 +3h +15m +127m | | WATTAGE | An integer number (no decimals allowed), can be formatted as string if needed |

Note 1: SunnyPortal has a known bug where 00:00 as start or stop time leads to a bug. Therefor, the adapter will automatically change 00:00 into 00:15

Note 2: This API allows any minute in the range 0 to 59, however SunnyPortal requires full quarters, so your input will be changed into the earlier full quarter time. Example 0 becomes 0, 4 becomes 0, 29 becomes 15.

Note 3: Offsets are relative to the start time and periods that spans several days or hours are handled appropriately, see table for examples:

| start | stop | actual stop time | | ------- | ------ | ---------------- | | 00:00 | +2h | 02:00 | | 00:00 | +90m | 01:30 | | 23:30 | +3h | 02:30 |

Example curl usage

Setting a schedule with three periods

curl -X PUT http://localhost:3000/plants/granstugan/battery/time-window -H 'Authorization: Bearer apiAccessPassword' -H 'Content-Type: application/json' -d '[{ "start": "11:00", "stop": "12:00", "power": 20 }, { "start": "13:00", "stop": "+5h", "power": "21"}, {"start":"19:00", "stop":"00:00", "power": 22 }]'

Removing a schedule

curl -X PUT http://localhost:3000/plants/granstugan/battery/time-window -H 'Authorization: Bearer apiAccessPassword' -H 'Content-Type: application/json' -d '[]'