# mopiapi

> Interface to the MoPi battery power add-on board for the Raspberry Pi. (http://pi.gate.ac.uk/mopi)

Latest version **1.0.0** (published 2014-09-11) · GPL license · 0 weekly downloads

## Install

```sh
npm install mopiapi
pnpm add mopiapi
yarn add mopiapi
bun add mopiapi
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-09-11 |
| First published | 2014-09-11 |
| Weekly downloads | 0 |
| License | GPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 40 |
| Author | Mike Cardwell |
| Maintainers | grepular |

## Links

- npm: https://www.npmjs.com/package/mopiapi
- Repository: https://github.com/hamishcunningham/pi-tronics
- Issues: https://github.com/hamishcunningham/pi-tronics/issues
- npm.io page: https://npm.io/package/mopiapi

## Dependencies (1)

- [i2c](https://npm.io/package/i2c.md) ~0.1.4

## Recent versions

- 1.0.0 (latest) — 2014-09-11

## README

# mopiapi

NodeJS Interface to the MoPi battery power add-on board for the Raspberry Pi.
(http://pi.gate.ac.uk/mopi). This is a port of the python libary of the same
name.

I have tried to keep the API as close as possible to the python library version,
except that it uses callbacks instead of function return values.

Note: This module uses the nodejs i2c module, which does not work on some older
versions of nodejs. It definitely works on v0.10.24 and later though.

## Usage

```javascript

var mopiapi = require('mopiapi');

var mopi = new mopiapi.mopiapi();

mopi.connect(function(err){
    if (err) return console.log(err);

    mopi.getStatus(function (err, status){
        if (err) return console.log("Error", err);

        status = new mopiapi.status(status);

        status.StatusDetail(function(err, detail){
            if (err) return console.log("Error", err);
            console.log(detail);
        });
    });
});
````

It has all of the other methods that the Python version has as well. E.g to get the
voltage on source 2:

```javascript
mopi.getVoltage(2, function(err, voltage){ });
````

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