Skip to content

API For huawei LAN/WAN LTE Modems written in TypeScript

License

Notifications You must be signed in to change notification settings

grawsom/huawei-lte-api-ts

 
 

Repository files navigation

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 E5186s-22a
  • Huawei B528s
  • Huawei E5577Cs-321

3G/LTE USB sticks:

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

  • Huawei E3131
  • Huawei E3531

(probably will work for other Huawei LTE devices too)

Will NOT work on:

LTE Routers:

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

Installation

npm

$ npm i huawei-lte-api --save

Usage

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

const connection = Connection('http://admin:MY_SUPER_TRUPER_PASSWORD@192.168.8.1/')
connection.ready.then(() => {
    //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:password@192.168.8.1/');

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);
    });
});

About

API For huawei LAN/WAN LTE Modems written in TypeScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%