Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/commanderredyt/forecast-solar-ts
A typescript implementation of https://github.com/home-assistant-libs/forecast_solar.
https://github.com/commanderredyt/forecast-solar-ts
Last synced: 26 days ago
JSON representation
A typescript implementation of https://github.com/home-assistant-libs/forecast_solar.
- Host: GitHub
- URL: https://github.com/commanderredyt/forecast-solar-ts
- Owner: CommanderRedYT
- License: mit
- Created: 2024-05-27T07:06:00.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-10-08T16:20:00.000Z (30 days ago)
- Last Synced: 2024-10-08T19:10:44.657Z (29 days ago)
- Language: TypeScript
- Size: 813 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# forecast-solar-ts
![GitHub License](https://img.shields.io/github/license/CommanderRedYT/forecast-solar-ts)
![GitHub issues](https://img.shields.io/github/issues/CommanderRedYT/forecast-solar-ts)
![NPM Version](https://img.shields.io/npm/v/forecast-solar-ts)
![NPM Downloads](https://img.shields.io/npm/dt/forecast-solar-ts)
[![Continuous Integration](https://github.com/CommanderRedYT/forecast-solar-ts/actions/workflows/testing.yml/badge.svg)](https://github.com/CommanderRedYT/forecast-solar-ts/actions/workflows/testing.yml)This library is a typescript implementation of the [forecast_solar](https://github.com/home-assistant-libs/forecast_solar) library that is used in Home Assistant.
It provides functionality to get solar power estimates from the API provided by [forecast.solar](https://forecast.solar/).## Testing
The library has a reported 100% test coverage. You can find them in [`__tests__`](https://github.com/CommanderRedYT/forecast-solar-ts/tree/main/__tests__) and run them via the following command:
```bash
npm run test
```## Installation
```bash
# 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
```typescript
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
```javascript
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](https://github.com/CommanderRedYT/forecast-solar-ts/issues).
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.