innoxel-soap
v1.0.0
Published
innoxel master soap api client
Downloads
134
Readme
innoxel-soap
Library to access Innoxel Master 3 SOAP API.
The current version has been tested against firmware 1.6.0.0, but most parts already worked against firmware 1.4.1.0 and 1.5.1.0 too.
Installation
npm install innoxel-soap
or
yarn add innoxel-soap
Usage
Getting started
import { InnoxelApi } from "innoxel-soap";
const api = new InnoxelApi({
user: "username",
password: "***",
ip: "192.168.0.100",
});
const [bootId, stateId] = await api.getBootAndStateIds();
Usage
InnoxelApi
The main export ist the InnoxelApi class. It provides the main functionality to send messages to innoxel master, and some convenience methods to retrieve/update certain data.
Constructor
The constructor of the InnoxelApi class acccepts the following configuration object:
{
user: "<user name>", // username for accessing innoxel master
password: "<password>", // required, password of the user
ip: "<ip address>", // required, ip address of innoxel master
port: 5001, // optional, defaults to 5001
}
Methods
Methods of the InnoxelApi class:
| method | description | parameters | | ------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | postMessage<T>(message: SoapMessage): Promise<T> | helper method for posting messages to innoxel master and parsing the returned xml (see SoapMessage below) | message: soap message objectreturns the parsed soap answer | | getBootAndStateIdXml(): Promise<string> | get current boot and state id response xml | | getBootAndStateIds(xml?: string): Promise<[bootId: string, stateId: string]> | get boot and state id, either by retrieving them from innoxel master, or by parsing the given xml | xml (optional) xml message to parse ids from | | getDeviceState(): Promise<IDeviceStatusResponse> | get current device state of innoxel master (requires administrator privileges) | | | getIdentities(): Promise<ModuleIdentityType[]> | get identity information for all modules | | | getWeather(): Promise<IModuleWeather> | get weather module data | | | getRoomClimate(moduleIds: number[]): Promise<IModuleRoomClimate[]> | get room climate data | moduleIds: array of module ids to query, or [-1] for all modules | | getModuleStates(): Promise<IModuleBase[]> | get module state data | | | triggerPushButton(moduleIndex: number, channel: number, event: ModuleInEvent = "autoImpulse"): Promise<void> | trigger a push button | moduleIndex: module index of the modulechannel: channel to triggerevent: how to "push" the button | | triggerOutModule(moduleIndex: number, channel: number, event: ModuleOutEvent = "toggle"): Promise<void> | trigger an Out module | moduleIndex: module index of the modulechannel: channel to triggerevent: how to trigger the channel | | setDimValue(moduleIndex: number, channel: number, dimValue: number, dimSpeed = 0): Promise<void> | set the value of a dimmer | moduleIndex: module index of the modulechannel: dimmer channeldimValue: value to set (0-100, 0: off)dimSpeed: dimming speed (0-15) | | setRoomClimate(moduleIndex: number, type: ModuleRoomClimateSetType, temperature: number) | set the temperature of a room climate module | moduleIndex: module index of the moduletype: type of temperature to settemperature: temperature to set |
SoapMessage
Class for building the soap message sent to innoxel master.
Limitations
- The library was designed to fit my needs for an ioBroker adapter. If additional functionality is required please open an issue.
- Innoxel Master needs to be polled to retrieve updates, there is no pushing or callback mechanism.
- Whenever the state of i.e. a switch or dimmer changes, the state id changes too. So for performance reasons, consider using getBootAndStateIds() or getBootAndStateIdXml(), and only if this changes actually load the desired state data.
- Switches can only be toggled, not set. So you can't set a switch off, but you can have it switch it's state from on=>off or off=>on.
Contributing
Running tests
npm test
There are two types of tests. Tests with mocks, and tests against an actual Innoxel Master, which are skipped by default. In order to run tests against Innoxel Master, copy .env.template
as .env
and adjust the required settings.