@iobroker/adapter-core

  • Version 3.1.4
  • Published
  • 78.7 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

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>

      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 adaptert type definition depending on the creation options

      property oObjects

      oObjects: HasObjectsCache extends true
      ? Exclude<ioBroker.Adapter['oObjects'], undefined>
      : undefined;

        property oStates

        oStates: HasStatesCache extends true
        ? Exclude<ioBroker.Adapter['oStates'], undefined>
        : undefined;

          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

          Package Files (3)

          Dependencies (0)

          No dependencies.

          Dev Dependencies (28)

          Peer Dependencies (1)

          Badge

          To add a badge like this onejsDocs.io badgeto 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>