homespot-api
v1.0.5
Published
An API for the o2 HomeSpot
Downloads
9
Readme
An API for the o2 HomeSpot
I won't continue this, because I no longer own a o2 Homespot, since they destroyed the Firmware with the "DE_g34.0_RTL0080.D112.DE.21.13.115 [2020-10-15 12:14:02]" Update.
Does not support all functions yet. Feel free to contribute. This package uses node-fetch for requests.
CORS PROXY IS REQUIRED
This API probably won't work, if you don't use a proxy. CORS errors will occur.
Use for example local-cors-proxy.
Start it like this lcp --proxyUrl http://192.168.1.1
(http://192.168.1.1 should be the ip of the router)
Then call the constructor with the url provided from lcp as the base url.
Like const api = new HomeSpotApi("http://localhost:8010/proxy");
Installation
$ npm install homespot-api --save
Usage
const { HomespotApi } = require("homespot-api");
// import { HomespotApi } from "homespot-api"; ES6 import
const api = new HomespotApi("http://192.168.1.1");
api.login("Password").then((result) =>
{
if (result)
{
console.log("Login successful");
}
});
Methods
login(password: string): Promise<boolean>
getMainStatus(): Promise<HomespotMainInfo>
getSystemInformation(): Promise<HomespotSystemInformation>
getWifiInformation(): Promise<HomespotWifiResult>
getWifiPlusInformation(): Promise<HomespotWifiPlusResult>
getPreferedConnectionType(): Promise<HomespotPreferedConnectionType>
setPreferedConnectionType(value: HomespotPreferedConnectionType): Promise<boolean>
getLocalNetworkInformation(): Promise<HomespotLocalNetworkInfo>
login(password: string): Promise<boolean>
Logs you into the homespot. The Password is the same you would use on the default router page (e.g "o2.spot" or "192.168.1.1")
api.login("Password").then((result) =>
{
if (result)
{
console.log("Login successful");
}
});
getMainStatus(): Promise<HomespotMainInfo>
Returns a Promise with HomespotMainInfo
:
export class HomespotMainInfo
{
public CellInfo: HomespotCellInfo;
public RadioStatus: HomespotRadioStatus;
}
interface HomespotCellInfo
{
RSRP: string;
RSRQ: string;
RSSI: string;
TAC: string;
PCI: string;
CellId: string;
EARFCN: string;
}
interface HomespotRadioStatus
{
Provider: string;
RadioStation: string;
SignalStrength: string;
}
getSystemInformation(): Promise<HomespotSystemInformation>
Returns a Promise with HomespotSystemInformation
{
FirmwareName: string;
FirmwareUpdateTime: string;
HwVersion: string;
DevManufacturer: string;
Imei: string;
SerialNumber: string;
Uptime: string;
}
getWifiInformation(): Promise<HomespotWifiResult>
Returns a Promise with HomespotWifiResult
{
Active: boolean;
SSID: string;
Mac: string;
Encryption: string;
BroadcastSSID: boolean;
Channel: number | string; // just returns a string when the number conversion returns NaN
ConnectedDevices: number | string; // just returns a string when the number conversion returns NaN
}
getWifiPlusInformation(): Promise<HomespotWifiPlusResult>
Returns a Promise with HomespotWifiPlusResult
{
Active: boolean;
SSID: string;
Mac: string;
Mode: string;
Encryption: string;
Channel: number | string; // just returns a string when the number conversion returns NaN
ConnectedDevices: number | string; // just returns a string when the number conversion returns NaN
}
getPreferedConnectionType(): Promise<HomespotPreferedConnectionType>
Returns a Promise with HomespotPreferedConnectionType
(enum)
export enum HomespotPreferedConnectionType
{
Both = 0,
LTE,
ThirdGeneration
}
setPreferedConnectionType(value: HomespotPreferedConnectionType): Promise<boolean>
Returns a boolean Promise. true
if the action was successful.
Parameters: value: HomespotPreferedConnectionType
const { HomespotPreferedConnectionType } = require("homespot-api")
// import { HomespotPreferedConnectionType } from "homespot-api" ES6 import
api.setPreferedConnectionType(HomespotPreferedConnectionType.LTE).then((result) =>
{
if (result)
{
console.log("action successful");
}
});
getLocalNetworkInformation(): Promise<HomespotLocalNetworkInfo>
Returns a Promise with HomespotLocalNetworkInfo
{
LanIpAddress: string;
Netmask: string;
DHCPLeaseTime: string;
DHCPStart: string;
DHCPEnd: string;
DHCPServerEnabled: boolean;
EthernetMacAddress: string;
}
restart(): void
Reboots the router. Returns nothing.