{"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,"search_vec":"'-2.0':19 '16':51 '3.0.1':15 'adapt':3 'advanc':67 'apach':18 'autom':61,74 'backend':65 'blocktim':36 'chang':38 'change-on':37 'configur':34 'current':11 'data':72 'databas':10 'debounc':35 'differ':42 'differenti':54 'ecosystem':58 'error':48 'filter':68 'flexibl':63 'histori':7 'home':60,73 'includ':46 'integr':55 'iobrok':2,23,57,70 'iobroker.sql':1 'javascript':69 'key':53 'log':5,71 'maintain':20 'microsoft':28 'minimum':41 'mysql':26 'node.js':50 'postgresql':27 'provid':33 'record':40 'releas':16 'report':49 'requir':52 'retent':45 'sentri':47 'server':30 'sql':9,29,64 'sqlite':32 'stabl':12 'state':6 'storag':44 'support':25 'team':24 'version':13","created_at":"2026-04-25T07:38:17.211591+00:00","updated_at":"2026-04-25T07:38:17.211591+00:00","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,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"iobroker","cli_version":null,"type":"library","homepage":"https://www.iobroker.net","github":"https://github.com/ioBroker/ioBroker.sql","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/iobroker.sql","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","data","observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-04-25","next_check":"2026-07-24","install_tag":null}}