Skip to content

CommanderRedYT/forecast-solar-ts

Repository files navigation

forecast-solar-ts

GitHub License GitHub issues NPM Version NPM Downloads Continuous Integration

This library is a typescript implementation of the forecast_solar library that is used in Home Assistant. It provides functionality to get solar power estimates from the API provided by forecast.solar.

Testing

The library has a reported 100% test coverage. You can find them in __tests__ and run them via the following command:

npm run test

Installation

# Using npm
npm i --save forecast-solar-ts

# Using yarn
yarn add forecast-solar-ts

# Using pnpm
pnpm add forecast-solar-ts

Usage

Usage in ESM

import ForecastSolar from 'forecast-solar-ts';

const forecast = new ForecastSolar({
  latitude: 48.21,
  longitude: 16.36,
  azimuth: 180,
  declination: 23.44,
  kwp: 5,
});

forecast.estimate().then((estimate) => {
  console.log(estimate);
});

Usage in CJS

const ForecastSolar = require('forecast-solar-ts');

const forecast = new ForecastSolar({
  latitude: 48.21,
  longitude: 16.36,
  azimuth: 180,
  declination: 23.44,
  kwp: 5,
});

forecast.estimate().then((estimate) => {
  console.log(estimate);
});

Issues

If you find any issues, please report them here.

License

This project is licensed under the MIT License - see the LICENSE file for details.