Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rluvaton/electra-smart-js-client
Electra Smart Javascript Client
https://github.com/rluvaton/electra-smart-js-client
Last synced: 23 days ago
JSON representation
Electra Smart Javascript Client
- Host: GitHub
- URL: https://github.com/rluvaton/electra-smart-js-client
- Owner: rluvaton
- License: mit
- Created: 2022-08-20T21:15:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-08-20T22:18:15.000Z (over 2 years ago)
- Last Synced: 2024-04-16T13:53:43.389Z (9 months ago)
- Language: TypeScript
- Size: 335 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-opensource-israel - electra-smart-js-client - Electra Smart js client ![GitHub stars](https://img.shields.io/github/stars/rluvaton/electra-smart-js-client?style=flat-square "GitHub stars") ![GitHub last commit](https://img.shields.io/github/last-commit/rluvaton/electra-smart-js-client?style=flat-square) ![GitHub top language](https://img.shields.io/github/languages/top/rluvaton/electra-smart-js-client?style=flat-square) (Projects by main language / typescript)
README
# Electra Smart JS client
[![npm](https://img.shields.io/npm/v/electra-smart-js-client?style=plastic)](https://www.npmjs.com/package/electra-smart-js-client)Port of [`yonatanp/electrasmart`](https://github.com/yonatanp/electrasmart) in JS
## Usage
**Get the authentication data**
```bash
npx electra-smart-js-client# This will log { "imei": "", "token": "" }
# Save it for later use
```**Use it from Node.js code**
```js
import { Client } from 'electra-smart-js-client';async function run() {
const client = await new Client({
imei: '', // This is the imei value from the previous step
token: '', // This is the token value from the previous step
});const devices = await client.getDevices();
// Choose the device you want to control
const deviceId = devices[0].id;// Control it 🔥
await client.setMode(deviceId, 'HEAT');
}run().then(console.log).catch(console.error);
```