@iobroker/adapter-core
- Version 3.2.2
- Published
- 99.2 kB
- No dependencies
- MIT license
Install
npm i @iobroker/adapter-core
yarn add @iobroker/adapter-core
pnpm add @iobroker/adapter-core
Overview
Core module to be used in ioBroker adapters. Acts as the bridge to js-controller.
Index
Variables
Functions
Interfaces
Type Aliases
Namespaces
Variables
variable adapter
const adapter: AdapterConstructor;
Creates a new adapter instance
variable Adapter
const Adapter: AdapterConstructor;
Creates a new adapter instance
variable commonTools
const commonTools: { pattern2RegEx: typeof pattern2RegEx; getAdapterDir: typeof getAdapterDir; getInstalledInfo: typeof getInstalledInfo; isDocker: typeof isDocker; getLocalAddress: typeof getLocalAddress; getListenAllAddress: typeof getListenAllAddress; isLocalAddress: typeof isLocalAddress; isListenAllAddress: typeof isListenAllAddress; password: any; session: any; zipFiles: any;};
variable controllerDir
const controllerDir: string;
The root directory of JS-Controller
variable EXIT_CODES
const EXIT_CODES: Readonly<{ NO_ERROR: number; JS_CONTROLLER_STOPPED: number; INVALID_ADAPTER_CONFIG: number; NO_ADAPTER_CONFIG_FOUND: number; INVALID_CONFIG_OBJECT: number; INVALID_ADAPTER_ID: number; UNCAUGHT_EXCEPTION: number; ADAPTER_ALREADY_RUNNING: number; INSTANCE_IS_DISABLED: number; CANNOT_GZIP_DIRECTORY: number; CANNOT_FIND_ADAPTER_DIR: number; ADAPTER_REQUESTED_TERMINATION: number; UNKNOWN_PACKET_NAME: number; ADAPTER_REQUESTED_REBUILD: number; CANNOT_READ_INSTANCES: number; NO_MULTIPLE_INSTANCES_ALLOWED: number; NO_MULTIPLE_INSTANCES_ALLOWED_ON_HOST: number; NO_CONNECTION_TO_OBJ_DB: number; NO_CONNECTION_TO_STATES_DB: number; INSTANCE_ALREADY_EXISTS: number; CANNOT_INSTALL_NPM_PACKET: number; CANNOT_EXTRACT_FROM_ZIP: number; INVALID_IO_PACKAGE_JSON: number; CANNOT_COPY_DIR: number; MISSING_ADAPTER_FILES: number; INVALID_NPM_VERSION: number; INVALID_NODE_VERSION: number; INVALID_OS: number; INVALID_DEPENDENCY_VERSION: number; INVALID_ARGUMENTS: number; INVALID_PASSWORD: number; MISSING_CONFIG_JSON: number; CANNOT_DELETE_NON_DELETABLE: number; CANNOT_GET_STATES: number; CANNOT_GET_REPO_LIST: number; START_IMMEDIATELY_AFTER_STOP: number;}>;
Functions
function getAbsoluteDefaultDataDir
getAbsoluteDefaultDataDir: () => string;
Returns the absolute path of the data directory for the current host. On linux, this is usually
/opt/iobroker/iobroker-data
.
function getAbsoluteInstanceDataDir
getAbsoluteInstanceDataDir: (adapterObject: ioBroker.Adapter) => string;
Returns the absolute path of the data directory for the current adapter instance. On linux, this is usually
/opt/iobroker/iobroker-data/<adapterName>.<instanceNr>
Parameter adapterObject
The adapter instance
function getConfig
getConfig: () => Record<string, any>;
Reads the configuration file of JS-Controller
Interfaces
interface AdapterInstance
interface AdapterInstance< HasObjectsCache extends boolean | undefined = undefined, HasStatesCache extends boolean | undefined = undefined> extends ioBroker.Adapter {}
This type is used to include and exclude the states and objects cache from the adapter's type definition depending on the creation options
Type Aliases
type AdapterOptions
type AdapterOptions< HasObjectsCache extends boolean | undefined = undefined, HasStatesCache extends boolean | undefined = undefined> = Omit<ioBroker.AdapterOptions, 'objects' | 'states'> & (true extends HasObjectsCache ? { objects: true; } : { objects?: HasObjectsCache; }) & (true extends HasStatesCache ? { states: true; } : { states?: HasStatesCache; });
This type augments the ioBroker Adapter options to accept two generics for the objects and states cache
Namespaces
namespace I18n
module 'build/esm/i18n.d.ts' {}
Init internationalization
Parameter rootDir
The path, where i18n directory is located
Parameter languageOrAdapter
The adapter instance or the language to use
function getTranslatedObject
getTranslatedObject: ( key: string, ...args: (string | number | boolean | null)[]) => ioBroker.Translated;
Get translation as ioBroker.Translated object
Parameter key
Word to translate
Parameter args
Optional parameters to replace %s
function init
init: ( rootDir: string, languageOrAdapter: ioBroker.Adapter | ioBroker.Languages) => Promise<void>;
Init internationalization
Parameter rootDir
The path, where i18n directory is located
Parameter languageOrAdapter
The adapter instance or the language to use
function translate
translate: ( key: string, ...args: (string | number | boolean | null)[]) => string;
Get translation as one string
Parameter key
Word to translate
Parameter args
Optional parameters to replace %s
Package Files (4)
Dependencies (0)
No dependencies.
Dev Dependencies (23)
- @alcalzone/esm2cjs
- @alcalzone/release-script
- @alcalzone/release-script-plugin-license
- @iobroker/eslint-config
- @types/chai
- @types/chai-as-promised
- @types/mocha
- @types/node
- @types/proxyquire
- @types/sinon
- @types/sinon-chai
- chai
- chai-as-promised
- cpy-cli
- mocha
- prettier
- proxyquire
- rimraf
- sinon
- sinon-chai
- source-map-support
- ts-node
- typescript
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@iobroker/adapter-core
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@iobroker/adapter-core)
- HTML<a href="https://www.jsdocs.io/package/@iobroker/adapter-core"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3008 ms. - Missing or incorrect documentation? Open an issue for this package.