{"id":18447,"library":"iobroker.sql","title":"ioBroker.sql","description":"ioBroker adapter to log state history into SQL databases. Current stable version is 3.0.1. Released under Apache-2.0, maintained by the ioBroker team. Supports MySQL, PostgreSQL, Microsoft SQL Server, and SQLite. Provides configurable debouncing, blocktime, change-only recording, minimum difference, and storage retention. Includes Sentry error reporting. Node.js >=16 required. Key differentiator: integration with ioBroker ecosystem for home automation, with flexible SQL backend and advanced filtering.","status":"active","version":"3.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/ioBroker/ioBroker.sql","tags":["javascript","ioBroker","log data","home automation"],"install":[{"cmd":"npm install iobroker.sql","lang":"bash","label":"npm"},{"cmd":"yarn add iobroker.sql","lang":"bash","label":"yarn"},{"cmd":"pnpm add iobroker.sql","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[],"quickstart":{"code":"const adapter = require('iobroker.sql');\n\nconst sqlAdapter = new adapter('sql', {\n    systemConfig: true,\n    // adapter config\n    'DB Type': 'sqlite',\n    'Host': 'localhost',\n    'Port': 0,\n    'Database name': 'iobroker',\n    'User': '',\n    'Password': '',\n    'Encrypt': false,\n    'Round real to': 2,\n    'Allow parallel requests': false,\n    'Do not create database': false,\n    'Debounce Time': 0,\n    'Blocktime': 0,\n    'Record changes only': false,\n    'still record the same values (seconds)': 0,\n    'Minimum difference from last value': 0,\n    'ignore 0 or null values (==0)': false,\n    'ignore values below zero (<0)': false,\n    'Disable charting optimized logging of skipped values': false,\n    'Alias-ID': '',\n    'Storage retention': 365,\n    'Maximal number of stored in RAM values': 1000\n});\n\nsqlAdapter.on('ready', () => {\n    // adapter is ready\n    console.log('Adapter ready');\n});\n\nsqlAdapter.on('objectChange', (id, obj) => {\n    // handle object change\n});\n\nsqlAdapter.on('stateChange', (id, state) => {\n    // handle state change\n});","lang":"javascript","description":"Basic instantiation and configuration of ioBroker.sql adapter with default options for SQLite."},"warnings":[{"fix":"Update to Admin 5 UI or stay on 1.x","message":"Configuration is only working in the new Admin 5 UI!","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Upgrade Node.js to >=14.x","message":"Node.js 14.x is now needed at minimum!","severity":"breaking","affected_versions":">=2.2.0"},{"fix":"Use ioBroker alias states instead","message":"Alias-ID option is deprecated; consider switching to real alias States.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Set debounce time appropriately or use blocktime","message":"Debounce time: if values change more often than the debounce time, no value will be logged.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Disable via plugin-sentry configuration","message":"Sentry error reporting is enabled by default starting with js-controller 3.0.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install iobroker.sql' in the ioBroker adapter directory","cause":"Package not installed correctly or node_modules missing","error":"Error: Cannot find module 'iobroker.sql'"},{"fix":"Check SQL server status and adapter connection settings","cause":"SQL server not running or wrong host/port","error":"Error: connect ECONNREFUSED ..."},{"fix":"Verify username and password, ensure database exists","cause":"Invalid SQL credentials or insufficient privileges","error":"Error: ER_ACCESS_DENIED_ERROR: Access denied for user ..."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}