# @robinrs/energy-storagejs

> Interaction with energy storage systems from popular brands (/cgi/ems_data.js)

Latest version **0.0.2** (published 2023-05-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @robinrs/energy-storagejs
pnpm add @robinrs/energy-storagejs
yarn add @robinrs/energy-storagejs
bun add @robinrs/energy-storagejs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2023-05-20 |
| First published | 2023-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Robin Schleser |
| Maintainers | robinrs |
| Keywords | energy, battery, storage, ems_data.js, ems_data.xml, energy storage |

## Links

- npm: https://www.npmjs.com/package/@robinrs/energy-storagejs
- Repository: https://github.com/robinrs/energy-storagejs
- Homepage: https://github.com/robinrs/energy-storagejs#readme
- Issues: https://github.com/robinrs/energy-storagejs/issues
- npm.io page: https://npm.io/package/@robinrs/energy-storagejs

## Dependencies (2)

- [xml-js](https://npm.io/package/xml-js.md) ^1.6.11
- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.11

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2023-05-20
- 0.0.1 — 2023-05-20

## README

# energy-storagejs

[![npm version](https://badge.fury.io/js/%40robinrs%2Fenergy-storagejs.svg)](https://badge.fury.io/js/%40robinrs%2Fenergy-storagejs)

`energy-storagejs` is a JavaScript library for accessing and retrieving data from energy storage systems. It provides an API for interacting with VARTA Storage Systems and retrieving battery-related information.

## Installation

You can install `energy-storagejs` via npm:

```shell
npm install @robinrs/energy-storagejs
```

## Usage

```javascript
// Access API Class Object
const battery = energyStorage({
  ip: '192.168.2.130',
  fullRequest: '/cgi/ems_data.js',
  simpleRequest: '/cgi/ems_data.xml',
  paramsRequest: '/cgi/ems_conf.js',
  type: 'v', // Type for VARTA Storage Systems
});

// Request the data from the Battery
await battery.requestSimple();

// Data can now be accessed in raw format, to use the provided methods, parse the data
battery.parse();
```

Once parsed, the following methods can be used to retrieve battery information:

- `getTimeStamp()`: Returns the timestamp of the data.
- `getState()`: Returns the state of the battery.
- `getPercentageF()`: Returns the battery percentage as a formatted value with the unit.
- `getPercentage()`: Returns the battery percentage.
- `...` Check out the docs to see all methods

## TODO

Please note that this package is still a work in progress. The following tasks are currently being worked on:

- [] Add comments to further explain the code.
- [] Implement the handler for more detailed requests.
- [] Implement an interval to keep the data fresh.
- [] Add support for more battery systems and companies.

Your contributions and feedback are welcome!

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

---
_Source: https://npm.io/package/@robinrs/energy-storagejs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
