Giter Club home page Giter Club logo

huawei-lte-api-ts's Introduction

huawei-lte-api-ts

API For huawei LAN/WAN LTE Modems rewritten from original Python library into TypeScript you can use this to simply send SMS, get information about your internet usage, signal, and tons of other stuff

Tested on:

3G/LTE Routers:

  • Huawei B310s-22
  • Huawei B315s-22
  • Huawei B525s-23a
  • Huawei B525s-65a
  • Huawei B715s-23c
  • Huawei B528s
  • Huawei B535-232
  • Huawei B628-265
  • Huawei B818-263
  • Huawei E5186s-22a
  • Huawei E5576-320
  • Huawei E5577Cs-321

3G/LTE USB sticks:

(Device must support NETWork mode aka. "HiLink" version, it wont work with serial mode)

  • Huawei E3131
  • Huawei E3372
  • Huawei E3531

5G Routers:

  • Huawei 5G CPE Pro 2 (H122-373)

(probably will work for other Huawei LTE devices too)

Will NOT work on:

LTE Routers:

  • Huawei B2368-22 (Incompatible firmware, testing device needed!)
  • Huawei B593s-22 (Incompatible firmware, testing device needed!)

Installation

npm

$ npm i huawei-lte-api --save

Usage

import { Connection, Device } from 'huawei-lte-api';

const connection = new Connection('http://admin:[email protected]/');

connection.ready.then(() => {
    const device = new Device(connection);

    //Can be accessed without authorization
    device.signal().then((result) => {
        console.log(result);
    }).catch((error) => {
        console.log(error);
    });

    //Needs valid authorization, will throw exception if invalid credentials are passed in URL
    device.information().then((result) => {
        console.log(result);
    }).catch((error) => {
        console.log(error);
    });
});
# For more API calls just look on code in the src/api folder, there is no separate DOC yet

Result object

{'DeviceName': 'B310s-22', 'SerialNumber': 'MY_SERIAL_NUMBER', 'Imei': 'MY_IMEI', 'Imsi': 'MY_IMSI', 'Iccid': 'MY_ICCID', 'Msisdn': None, 'HardwareVersion': 'WL1B310FM03', 'SoftwareVersion': '21.311.06.03.55', 'WebUIVersion': '17.100.09.00.03', 'MacAddress1': 'EHM:MY:MAC', 'MacAddress2': None, 'ProductFamily': 'LTE', 'Classify': 'cpe', 'supportmode': None, 'workmode': 'LTE'}
const huaweiLteApi = require('huawei-lte-api');

const connection = new huaweiLteApi.Connection('http://admin:[email protected]/');

connection.ready.then(function() {
    console.log('Ready');


    const device = new huaweiLteApi.Device(connection);
    device.signal().then(function(result) {
        console.log(result);
    }).catch(function(error) {
        console.log(error);
    });


    device.information().then(function(result) {
        console.log(result);
    }).catch(function(error) {
        console.log(error);
    });

    const dialUp = new huaweiLteApi.DialUp(connection);
    dialUp.setMobileDataswitch(1).then(function(result) {
        console.log(result);
    }).catch(function(error) {
        console.log(error);
    });
});

huawei-lte-api-ts's People

Contributors

famtrungkien avatar icetee avatar ioull avatar pezhvak avatar salamek avatar zinen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.