Ninja Pumpkin Mutants

    iobroker.sql

    2.2.0 • Public • Published

    Logo

    ioBroker.sql

    Number of Installations Number of Installations NPM version Downloads Tests

    NPM

    This adapter saves state history into SQL DB.

    Supports PostgreSQL, mysql, Microsoft SQL Server and sqlite. You can leave port 0 if default port is desired.

    This adapter uses Sentry libraries to automatically report exceptions and code errors to the developers. For more details and for information how to disable the error reporting see Sentry-Plugin Documentation! Sentry reporting is used starting with js-controller 3.0.

    Settings

    Connection Settings

    • DB Type: Type of the SQL DB: MySQL, PostgreSQL, MS-SQL or SQLite3
    • Host: IP address or host name with SQL Server
    • Port: Port of SQL Server (leave blank if not sure)
    • Database name: Database name. Default iobroker
    • User: Username for SQL. Must exist in the DB.
    • Password: Password for SQL.
    • Password confirm: Just repeat password here.
    • Encrypt: Some DBs support encryption.
    • Round real to: Number of digits after the comma.
    • Allow parallel requests: Allow simultaneous SQL requests to DB.
    • Do not create database: Activate this option if database already created (e.g. by administrator) and the ioBroker-user does not have enough rights to create a DB.

    Default Settings

    • Debounce Time - Protection against unstable values to make sure that only stable values are logged when the value did not change in the defined amount of Milliseconds. ATTENTION: If values change more often then this setting effectively no value will be logged (because any value is unstable)
    • Blocktime - Defines for how long after storing the last value no further value is stored. When the given time in Milliseconds is over then the next value that fulfills all other checks is logged.
    • Record changes only - This function make sure that only changed values are logged if they fulfill other checks (see below). Same values will not be logged.
    • still record the same values (seconds) - When using "Record changes only" you can set a time interval in seconds here after which also unchanged values will be re-logged into the DB. You can detect the values re-logged by the adapter with the "from" field.
    • Minimum difference from last value - When using "Record changes only" you can define the required minimum difference between the new value and the last value. If this is not reached the value is not recorded.
    • ignore 0 or null values (==0) - You can define if 0 or null values should be ignored.
    • ignore values below zero (<0) - You can define if values below zero should be ignored.
    • Disable charting optimized logging of skipped values - By default the adapter tries to record the values for optimized charting. This can mean that additional values (that e.g. not fulfilled all checks above) are logged automatically. If this is not wanted, you can disable this feature.
    • Alias-ID - You can define an alias for the ID. This is useful if you have changed a device and want to have continuous data logging. Please consider switching to real alias States in teh future!
    • Storage retention - How many values in the past will be stored on disk. Data are deleted when the time is reached as soon as new data should be stored for a datapoint.
    • Maximal number of stored in RAM values - Define how many number of values will be hold in RAM before persisting them on disk. You can control how much I/O is done.
    • Enable enhanced debug logs for the datapoint - If you want to see more detailed logs for this datapoint, you can enable this option. You still need to enable "debug" loglevel for these additional values to be visible! This helps in debugging issues or understanding why the adapter is logging a value (or not).

    Most of these values can be pre-defined in the instance settings and are then pre-filled or used for the datapoint.

    Database installation tips

    MS-SQL:

    Use localhost\instance for the host and check TCP/IP connections enabled. https://msdn.microsoft.com/en-us/library/bb909712(v=vs.90).aspx

    SQLite:

    is "file"-DB and cannot manage too many events. If you have a big amount of data use the real DB, like PostgreSQL and co.

    SQLite DB must not be installed extra. It is just a file on disk, but to install it you require build tools on your system. For linux, just write:

    sudo apt-get install build-essential
    

    For windows:

    c:\>npm install --global --production windows-build-tools
    

    and then reinstall the adapter, e.g:

    cd /opt/iobroker
    iobroker stop sql
    npm install iobroker.sql --production
    iobroker start sql
    

    MySQL:

    You can install mysql on linux systems as following:

    apt-get install mysql-server mysql-client
    
    mysql -u root -p
    
    CREATE USER 'iobroker'@'%' IDENTIFIED BY 'iobroker';
    GRANT ALL PRIVILEGES ON * . * TO 'iobroker'@'%';
    FLUSH PRIVILEGES;
    

    If required edit /etc/mysql/my.cnf to set bind to IP-Address for remote connect.

    Warning: iobroker user is "admin". If required give limited rights to iobroker user.

    On the "windows" it can be easily installed via installer: https://dev.mysql.com/downloads/installer/.

    Pay attention for authentication method. The new encryption algorithm in MySQL 8.0 is not yet supported by node.js and you must select legacy authentication method.

    Windows

    Structure of the DBs

    Default Database name is "iobroker", but it can be changed in the configuration.

    Sources

    This table is a list of adapter's instances, that wrote the entries. (state.from)

    DB Name in query
    MS-SQL iobroker.dbo.sources
    MySQL iobroker.sources
    PostgreSQL sources
    SQLite sources

    Structure:

    Field Type Description
    id INTEGER NOT NULL PRIMARY KEY IDENTITY(1,1) unique ID
    name varchar(255) / TEXT instance of adapter, that wrote the entry

    Note: MS-SQL uses varchar(255), and others use TEXT

    Data points

    This table is a list of data points. (IDs)

    DB Name in query
    MS-SQL iobroker.dbo.datapoints
    MySQL iobroker.datapoints
    PostgreSQL datapoints
    SQLite datapoints

    Structure:

    Field Type Description
    id INTEGER NOT NULL PRIMARY KEY IDENTITY(1,1) unique ID
    name varchar(255) / TEXT ID of variable, e.g. hm-rpc.0.JEQ283747.1.STATE
    type INTEGER 0 - number, 1 - string, 2 - boolean

    Note: MS-SQL uses varchar(255), and others use TEXT

    Numbers

    Values for states with type "number". ts means "time series".

    DB Name in query
    MS-SQL iobroker.dbo.ts_number
    MySQL iobroker.ts_number
    PostgreSQL ts_number
    SQLite ts_number

    Structure:

    Field Type Description
    id INTEGER ID of state from "Data points" table
    ts BIGINT / INTEGER Time in ms till epoch. Can be converted to time with "new Date(ts)"
    val REAL Value
    ack BIT/BOOLEAN Is acknowledged: 0 - not ack, 1 - ack
    _from INTEGER ID of source from "Sources" table
    q INTEGER Quality as number. You can find description here

    Note: MS-SQL uses BIT, and others use BOOLEAN. SQLite uses for ts INTEGER and all others BIGINT.

    The user can define additional to type number the functionality of "counters". For this purpose following table is created:

    DB Name in the query
    MS-SQL iobroker.dbo.ts_counter
    MySQL iobroker.ts_counter
    PostgreSQL ts_counter
    SQLite ts_counter

    Structure:

    Field Type Description
    id INTEGER ID of state from "Data points" table
    ts BIGINT / INTEGER Time in ms till epoch. Can be converted to time with "new Date(ts)"
    val REAL Value

    This table stores the values when the counter was exchanged and the value does not increase, but failed to zero or lower value.

    Strings

    Values for states with type "string".

    DB Name in query
    MS-SQL iobroker.dbo.ts_string
    MySQL iobroker.ts_string
    PostgreSQL ts_string
    SQLite ts_string

    Structure:

    Field Type Description
    id INTEGER ID of state from "Data points" table
    ts BIGINT Time in ms till epoch. Can be converted to time with "new Date(ts)"
    val TEXT Value
    ack BIT/BOOLEAN Is acknowledged: 0 - not ack, 1 - ack
    _from INTEGER ID of source from "Sources" table
    q INTEGER Quality as number. You can find description here

    Note: MS-SQL uses BIT, and others use BOOLEAN. SQLite uses for ts INTEGER and all others BIGINT.

    Booleans

    Values for states with type "boolean".

    DB Name in query
    MS-SQL iobroker.dbo.ts_bool
    MySQL iobroker.ts_bool
    PostgreSQL ts_bool
    SQLite ts_bool

    Structure:

    Field Type Description
    id INTEGER ID of state from "Data points" table
    ts BIGINT Time in ms till epoch. Can be converted to time with "new Date(ts)"
    val BIT/BOOLEAN Value
    ack BIT/BOOLEAN Is acknowledged: 0 - not ack, 1 - ack
    _from INTEGER ID of source from "Sources" table
    q INTEGER Quality as number. You can find description here

    Note: MS-SQL uses BIT, and others use BOOLEAN. SQLite uses for ts INTEGER and all others BIGINT.

    Access values from Javascript adapter

    The sorted values can be accessed from Javascript adapter.

    • Get 50 last stored events for all IDs
    sendTo('sql.0', 'getHistory', {
        id: '*',
        options: {
            end:       Date.now(),
            count:     50,
            aggregate: 'onchange',
            addId: true
        }
    }, function (result) {
        for (var i = 0; i < result.result.length; i++) {
            console.log(result.result[i].id + ' ' + new Date(result.result[i].ts).toISOString());
        }
    });
    
    • Get stored values for "system.adapter.admin.0.memRss" in last hour
    var end = Date.now();
    sendTo('sql.0', 'getHistory', {
        id: 'system.adapter.admin.0.memRss',
        options: {
            start:      end - 3600000,
            end:        end,
            aggregate: 'onchange',
            addId: true
        }
    }, function (result) {
        for (var i = 0; i < result.result.length; i++) {
            console.log(result.result[i].id + ' ' + new Date(result.result[i].ts).toISOString());
        }
    });
    

    Possible options:

    • start - (optional) time in ms - Date.now()'
    • end - (optional) time in ms - Date.now()', by default is (now + 5000 seconds)
    • step - (optional) used in aggregate (max, min, average, total, ...) step in ms of intervals
    • count - number of values if aggregate is 'onchange' or number of intervals if other aggregate method. Count will be ignored if step is set, else default is 500 if not set
    • from - if from field should be included in answer
    • ack - if ack field should be included in answer
    • q - if q field should be included in answer
    • addId - if id field should be included in answer
    • limit - do not return more entries than limit
    • round - round result to number of digits after decimal point
    • ignoreNull - if null values should be included (false), replaced by last not null value (true) or replaced with 0 (0)
    • removeBorderValues - By default additional border values are returned to optimize charting. Set this option to true if this is not wanted (e.g. for script data processing)
    • returnNewestEntries - The returned data are always sorted by timestamp ascending. When using aggregate "none" and also providing "count" or "limit" this means that normally the oldest entries are returned (unless no start data is provided). Set this option to true to get the newest entries instead.
    • aggregate - aggregate method (Default: 'average'):
      • minmax - used special algorithm. Splice the whole time range in small intervals and find for every interval max, min, start and end values.
      • max - Splice the whole time range in small intervals and find for every interval max value and use it for this interval (nulls will be ignored).
      • min - Same as max, but take minimal value.
      • average - Same as max, but take average value.
      • total - Same as max, but calculate total value.
      • count - Same as max, but calculate number of values (nulls will be calculated).
      • percentile - Calculate n-th percentile (n is given in options.percentile or defaults to 50 if not provided).
      • quantile - Calculate n quantile (n is given in options.quantile or defaults to 0.5 if not provided).
      • integral - Calculate integral (additional parameters see below).
      • none - No aggregation at all. Only raw values in given period.
    • percentile - (optional) when using aggregate method "percentile" defines the percentile level (0..100)(defaults to 50)
    • quantile - (optional) when using aggregate method "quantile" defines the quantile level (0..1)(defaults to 0.5)
    • integralUnit - (optional) when using aggregate method "integral" defines the unit in seconds (defaults to 60s). e.g. to get integral in hours for Wh or such, set to 3600.
    • integralInterpolation - (optional) when using aggregate method "integral" defines the interpolation method (defaults to "none").
      • linear - linear interpolation
      • none - no/stepwise interpolation

    The first and last points will be calculated for aggregations, except aggregation "none". If you manually request some aggregation you should ignore first and last values, because they are calculated from values outside of period.

    Get counter

    User can ask the value of some counter (type=number, counter=true) for specific period.

    var now = Date.now();
    // get consumption value for last 30 days
    sendTo('sql.0', 'getCounter', {
        id: 'system.adapter.admin.0.memRss',
        options: {
            start:      now - 3600000 * 24 * 30,
            end:        now,
        }
    }, result => {
        console.log(`In last 30 days the consumption was ${result.result} kWh`);    
    });
    

    If the counter device will be replaced it will be calculated too.

    Custom queries

    The user can execute custom queries on tables from javascript adapter:

    sendTo('sql.0', 'query', 'SELECT * FROM datapoints', function (result) {
        if (result.error) {
            console.error(result.error);
        } else {
            // show result
             console.log('Rows: ' + JSON.stringify(result.result));
        }
    });
    

    Or get entries for the last hour for ID=system.adapter.admin.0.memRss

    sendTo('sql.0', 'query', 'SELECT id FROM datapoints WHERE name="system.adapter.admin.0.memRss"', function (result) {
        if (result.error) {
            console.error(result.error);
        } else {
            // show result
            console.log('Rows: ' + JSON.stringify(result.result));
            var now = new Date();
            now.setHours(-1);
            sendTo('sql.0', 'query', 'SELECT * FROM ts_number WHERE ts >= ' + now.getTime() + ' AND id=' + result.result[0].id, function (result) {
                console.log('Rows: ' + JSON.stringify(result.result));
            });
        }
    });
    

    Note:

    Depending on the database, the database name or database name + schema must be inserted before the table name - see boxes above under 'Structure of the DBs'.

    Example if your database is called 'iobroker':

    DB Name in query
    MS-SQL SELECT * FROM iobroker.dbo.datapoints ...
    MySQL SELECT * FROM iobroker.datapoints ...

    storeState

    If you want to write other data into the InfluxDB/SQL you can use the build in system function storeState. This function can also be used to convert data from other History adapters like History or SQL.

    A successful response do not mean that the data are really written out to the disk. It just means that they were processed.

    The given ids are not checked against the ioBroker database and do not need to be set up or enabled there. If own IDs are used without settings then the "rules" parameter is not supported and will result in an error. The default "Maximal number of stored in RAM values" is used for such IDs.

    The Message can have one of the following three formats:

    • one ID and one state object
    sendTo('history.0', 'storeState', [
        id: 'mbus.0.counter.xxx',
        state: {ts: 1589458809352, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}
    ], result => console.log('added'));
    
    • one ID and array of state objects
    sendTo('history.0', 'storeState', {
        id: 'mbus.0.counter.xxx',
        state: [
          {ts: 1589458809352, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}, 
          {ts: 1589458809353, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}
        ]
    }, result => console.log('added'));
    
    • array of multiple IDs with one state object each
    sendTo('history.0', 'storeState', [
        {id: 'mbus.0.counter.xxx', state: {ts: 1589458809352, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}}, 
        {id: 'mbus.0.counter.yyy', state: {ts: 1589458809353, val: 123, ack: false, from: 'system.adapter.whatever.0', ...}}
    ], result => console.log('added'));
    

    Additionally, you can add attribute rules: true in message to activate all rules, like counter, changesOnly, de-bounce and so on.

    In case of errors an array with all single error messages is returned and also a successCount to see how many entries were stored successfully.

    delete state

    If you want to delete entry from the Database you can use the build in system function delete:

    sendTo('sql.0', 'delete', [
        {id: 'mbus.0.counter.xxx', state: {ts: 1589458809352}, 
        {id: 'mbus.0.counter.yyy', state: {ts: 1589458809353}
    ], result => console.log('deleted'));
    

    To delete ALL history data for some data point execute:

    sendTo('sql.0', 'deleteAll', [
        {id: 'mbus.0.counter.xxx'} 
        {id: 'mbus.0.counter.yyy'}
    ], result => console.log('deleted'));
    

    To delete history data for some data point and for some range, execute:

    sendTo('sql.0', 'deleteRange', [
        {id: 'mbus.0.counter.xxx', start: '2019-01-01T00:00:00.000Z', end: '2019-12-31T23:59:59.999'}, 
        {id: 'mbus.0.counter.yyy', start: 1589458809352, end: 1589458809353}
    ], result => console.log('deleted'));
    

    Time could be ms since epoch or ans string, that could be converted by javascript Date object.

    Values will be deleted including defined limits. ts >= start AND ts <= end

    change state

    If you want to change entry's value, quality or acknowledge flag in the database you can use the build in system function update:

    sendTo('sql.0', 'update', [
        {id: 'mbus.0.counter.xxx', state: {ts: 1589458809352, val: 15, ack: true, q: 0}, 
        {id: 'mbus.0.counter.yyy', state: {ts: 1589458809353, val: 16, ack: true, q: 0}
    ], result => console.log('deleted'));
    

    ts is mandatory. At least one other flags must be included in state object.

    Be careful with counters. The counters in DB will not be reset, and you must handle it yourself.

    History Logging Management via Javascript

    The adapter supports enabling and disabling of history logging via JavaScript and also retrieving the list of enabled data points with their settings.

    enable

    The message requires to have the "id" of the data point. Additionally, optional "options" to define the data point specific settings:

    sendTo('sql.0', 'enableHistory', {
        id: 'system.adapter.sql.0.memRss',
        options: {
            changesOnly:  true,
            debounce:     0,
            retention:    31536000,
            maxLength:    3,
            changesMinDelta: 0.5,
            aliasId: ''
        }
    }, function (result) {
        if (result.error) {
            console.log(result.error);
        }
        if (result.success) {
            //successful enabled
        }
    });
    

    disable

    The message requires to have the "id" of the data point.

    sendTo('sql.0', 'disableHistory', {
        id: 'system.adapter.sql.0.memRss',
    }, function (result) {
        if (result.error) {
            console.log(result.error);
        }
        if (result.success) {
            // successful enabled
        }
    });
    

    get List

    The message has no parameters.

    sendTo('sql.0', 'getEnabledDPs', {}, function (result) {
        //result is object like:
        {
            "system.adapter.sql.0.memRss": {
                "changesOnly":true,
                "debounce":0,
                "retention":31536000,
                "maxLength":3,
                "changesMinDelta":0.5,
                "enabled":true,
                "changesRelogInterval":0,
                "aliasId": ""
            }
            ...
        }
    });
    

    Changelog

    2.2.0 (2022-09-19)

    • IMPORTANT: Node.js 14.x is now needed at minimum!
    • (Apollon77) Fix potential crash cases with upcoming js-controller versions

    2.1.8 (2022-08-13)

    • (riversource/Apollon77) Optimize getHistory query by using "UNION ALL"
    • (Apollon77) Fix crash cases reported by Sentry

    2.1.7 (2022-06-30)

    • (Apollon77) Fix crash cases reported by Sentry

    2.1.6 (2022-06-27)

    • (Apollon77) Allow to remove a configuration value for "round" in config again

    2.1.5 (2022-06-27)

    • (Apollon77) When no count is provided for aggregate "none" or "onchange" then the limit (default 2000) is used as count to define the number of data to return.
    • (Apollon77) Fix the initialization of types and IDs for some cases.

    2.1.3 (2022-06-12)

    • (Apollon77) Make sure debug log is active according to the settings

    2.1.2 (2022-06-08)

    • (Apollon77) Huge performance optimizations for GetHistory calls

    2.1.1 (2022-05-30)

    • (Apollon77) Fix crash cases reported by Sentry

    2.1.0 (2022-05-27)

    • (Apollon77) Fix crash cases reported by Sentry
    • (Apollon77) Fix several places where pooled connections might have not been returned to pool correctly and add logging for it
    • (Apollon77) Work around an issue in used Pooling library that potentially gave out too many connections
    • (Apollon77) Optimize retention check to better spread the first checks over time
    • (Apollon77) Default to not use datapoint buffering as in 1.x when set to 0
    • (Apollon77) Make sure disabling "Log changes only" also really do not log the changes anymore
    • (Apollon77) Allow storeState and GetHistory also to be called for "unknown ids"
    • (Apollon77) Adjust the fallback logic for type detection to use the type of the state value to log as last fallback
    • (Apollon77) Fix storing booleans on MSSQL

    2.0.2 (2022-05-11)

    • (Apollon77) BREAKING: Configuration is only working in the new Admin 5 UI!
    • (Apollon77) Did bigger adjustments to the recording logic and added a lot of new Features. Please refer to Changelog and Forum post for details.

    2.0.0 (2022-05-11)

    • (Apollon77) Breaking: Configuration is only working in the new Admin 5 UI!
    • (Apollon77) Breaking! Did bigger adjustments to the recording logic. Debounce is refined and blockTime is added to differentiate between the two checks
    • (Apollon77) Breaking! GetHistory requests now need to deliver the ts in milliseconds! Make sure to use up to date scripts and Charting UIs
    • (Apollon77) Add RAM buffering and mass inserts for logging
    • (Apollon77) New setting added to disable the "logging of additional values for charting optimization" - then only the expected data are logged
    • (Apollon77) Add flag returnNewestEntries for GetHistory to determine which records to return when more entries as "count" are existing for aggregate "none"
    • (Apollon77) Add support for addId getHistory flag for GetHistory
    • (Apollon77) Add new Debug flag to enable/disable debug logging on datapoint level (default is false) to optimize performance
    • (Apollon77) Add aggregate method "percentile" to calculate the percentile (0..100) of the values (requires options.percentile with the percentile level, defaults to 50 if not provided). Basically same as Quantile just different levels are used
    • (Apollon77) Add aggregate method "quantile" to calculate the quantile (0..1) of the values (requires options.quantile with the quantile level, defaults to 0.5 if not provided). Basically same as Percentile just different levels are used
    • (Apollon77) Add (experimental) method "integral" to calculate the integral of the values. Requires options.integralUnit with the time duration of the integral in seconds, defaults to 60s if not provided. Optionally a linear interpolation can be done by setting options.integralInterpolation to "linear"
    • (Apollon77) When request contains flag removeBorderValues: true, the result then cut the additional pre and post border values out of the results
    • (Apollon77) Enhance the former "Ignore below 0" feature and now allow specifying to ignore below or above specified values. The old setting is converted to the new one
    • (Apollon77) Upgrade MSSQL and MySQL drivers incl. Support for MySQL 8
    • (Apollon77) Make sure that min change delta allows numbers entered with comma (german notation) in all cases
    • (Apollon77) Add support to specify how to round numbers on query per datapoint
    • (Apollon77) Do not log passwords for Postgres connections
    • (Apollon77) Optimize SSL support for database connections including option to allow self signed certificates
    • (Apollon77) Allow to specify custom retention duration in days
    • (winnyschuster) Fix Insert statement for MSSQL ts_counter
    • (winnyschuster) type of ts in user queries corrected

    1.16.2 (2022-02-16)

    • (bluefox) Marked interpolated data with i=true

    1.16.1 (2021-12-19)

    • (Excodibur) Hide settings not relevant when "log changes only" is not used
    • (Apollon77) Allow all number values for debounce again

    1.16.0 (2021-12-14)

    • (bluefox) Support only js-controller >= 3.3.x
    • (bluefox) Used system/custom view for collecting the objects
    • (bluefox) Implemented option to ignore zero- or/and below zero- values

    1.15.7 (2021-04-28)

    • (bluefox) fixed the support of Admin5

    1.15.6 (2021-04-19)

    • (bluefox) added support of Admin5

    1.15.5 (2021-01-22)

    • (Apollon77) make sure message query is a string (Sentry)

    1.15.4 (2021-01-17)

    • (Apollon77) Optimize stop handling

    1.15.3 (2020-08-29)

    • (bluefox) Added the option "Do not create database". E.g. if DB was created and it does not required to do that, because the user does not have enough rights.

    1.15.2 (2020-07-26)

    • (Apollon77) prevent wrong errors that realId is missing

    1.15.1 (2020-07-20)

    • (Apollon77) implement a workaround for postgres problem

    1.15.0 (2020-07-19)

    BREAKING This version only accepts Node.js 10.x+ (because sqlite3 was upgraded)

    • (Apollon77) Prevent crash case (Sentry IOBROKER-SQL-16, IOBROKER-SQL-15, IOBROKER-SQL-1K)

    1.14.2 (2020-06-23)

    • (bluefox) Fixed error for data storage

    1.14.1 (2020-06-17)

    • (bluefox) Corrected error for objects with mixed type

    1.14.0 (2020-05-20)

    • (bluefox) added the range deletion and the delete all operations

    1.13.1 (2020-05-20)

    • (bluefox) added changed and delete operations

    1.12.6 (2020-05-08)

    • (bluefox) set default history if not yet set

    1.12.5 (2020-05-05)

    • (Apollon77) Crash prevented for invalid objects (Sentry IOBROKER-SQL-X)

    1.12.4 (2020-05-04)

    • (Apollon77) Potential crash fixed when disabling data points too fast (Sentry IOBROKER-SQL-W)
    • (Apollon77) Always set "encrypt" flag, even if false because else might en in default true (see https://github.com/tediousjs/tedious/issues/931)

    1.12.3 (2020-04-30)

    • (Apollon77) Try to create indexes on MSSQL to speed up things. Infos are shown if not possible to be able for the user to do it themself. Timeout is 15s

    1.12.2 (2020-04-30)

    • (Apollon77) MSSQL works again

    1.12.1 (2020-04-26)

    • (Apollon77) Fix potential crash (Sentry)

    1.12.0 (2020-04-23)

    • (Apollon77) Implement max Connections setting and respect it, now allows to control how many concurrent connections to database are used (default 100) and others wait up to 10s for a free connection before failing)
    • (Apollon77) Change dependencies to admin to a global dependency
    • (Apollon77) Update connection status also in between
    • (Apollon77) fix some potential crash cases (Sentry reported)
    • (Omega236) Add id to error message for queries
    • (Apollon77) update pg to stay compatible with nodejs 14
    • (Apollon77) Start clearly ending timeouts on unload ... still some cases left!

    1.11.1 (2020-04-19)

    • Requires js-controller >= 2.0.0
    • (Apollon77) removed usage of adapter.objects
    • (Apollon77) check if objects have changed and ignore unchanged
    • (Apollon77) Add Sentry for Error Reporting with js-controller 3.0
    • (Apollon77) Make sure value undefined is ignored

    1.10.1 (2020-04-12)

    • (bluefox) Converted to ES6
    • (bluefox) The counter functionality was implemented.

    1.9.5 (2019-05-15)

    • (Apollon77) Add support for nodejs 12

    1.9.4 (2019-02-24)

    • (Apollon77) Fix several smaller issues and topics
    • (Apollon77) Optimize Texts (for Admin v3 UI)

    1.9.0 (2018-06-19)

    • (Apollon77) Add option to log datapoints as other ID (alias) to easier migrate devices and such

    1.8.0 (2018-04-29)

    • (Apollon77) Update sqlite3, nodejs 10 compatible
    • (BuZZy1337) Admin fix

    1.7.4 (2018-04-15)

    • (Apollon77) Fix getHistory

    1.7.3 (2018-03-28)

    • (Apollon77) Respect 'keep forever' setting for retention from data point configuration

    1.7.2 (2018-03-24)

    • (Apollon77) Disable to write NULLs for SQLite

    1.7.1 (2018-02-10)

    • (Apollon77) Make option to write NULL values on start/stop boundaries configurable

    1.6.9 (2018-02-07)

    • (bondrogeen) Admin3 Fixes
    • (Apollon77) optimize relog feature and other things

    1.6.7 (2018-01-31)

    • (Bluefox) Admin3 Fixes
    • (Apollon77) Relog and null log fixes

    1.6.2 (2018-01-30)

    • (Apollon77) Admin3 Fixes

    1.6.0 (2018-01-14)

    • (bluefox) Ready for Admin3

    1.5.8 (2017-10-05)

    • (Apollon77) fix relog value feature

    1.5.7 (2017-08-10)

    • (bluefox) add "save last value" option

    1.5.6 (2017-08-02)

    • (Apollon77) fix behaviour of log interval to always log the current value

    1.5.4 (2017-06-12)

    • (Apollon77) fix dependency to other library

    1.5.3 (2017-04-07)

    • (Apollon77) fix in datatype conversions

    1.5.0 (2017-03-02)

    • (Apollon77) Add option to define storage datatype per datapoint inclusing converting the value if needed

    1.4.6 (2017-02-25)

    • (Apollon77) Fix typo with PostgrSQL

    1.4.5 (2017-02-18)

    • (Apollon77) Small fix again for older configurations
    • (Apollon77) fix for DBConverter Analyze function

    1.4.3 (2017-02-11)

    • (Apollon77) Small fix for older configurations

    1.4.2 (2017-01-16)

    • (bluefox) Fix handling of float values in Adapter config and Datapoint config.

    1.4.1

    • (Apollon77) Rollback to sql-client 0.7 to get rid of the mmagic dependecy that brings problems on older systems

    1.4.0 (2016-12-02)

    • (Apollon77) Add messages enableHistory/disableHistory
    • (Apollon77) add support to log changes only if value differs a minimum value for numbers

    1.3.4 (2016-11)

    • (Apollon77) Allow database names with '-' for MySQL

    1.3.3 (2016-11)

    • (Apollon77) Update dependecies

    1.3.2 (2016-11-21)

    • (bluefox) Fix insert of string with '

    1.3.0 (2016-10-29)

    • (Apollon77) add option to re-log unchanged values to make it easier for visualization

    1.2.1 (2016-08-30)

    • (bluefox) Fix selector for SQL objects

    1.2.0 (2016-08-30)

    • (bluefox) сompatible only with new admin

    1.0.10 (2016-08-27)

    • (bluefox) change name of object from "history" to "custom"

    1.0.10 (2016-07-31)

    • (bluefox) fix multi requests if sqlite

    1.0.9 (2016-06-14)

    • (bluefox) allow settings for parallel requests

    1.0.7 (2016-05-31)

    • (bluefox) draw line to the end if ignore null

    1.0.6 (2016-05-30)

    • (bluefox) allow setup DB name for mysql and mssql

    1.0.5 (2016-05-29)

    • (bluefox) switch max and min with each other

    1.0.4 (2016-05-29)

    • (bluefox) check retention of data if set "never"

    1.0.3 (2016-05-28)

    • (bluefox) try to calculate old timestamps

    1.0.2 (2016-05-24)

    • (bluefox) fix error with io-package

    1.0.1 (2016-05-24)

    • (bluefox) fix error with SQLite

    1.0.0 (2016-05-20)

    • (bluefox) change default aggregation name

    0.3.3 (2016-05-18)

    • (bluefox) fix postgres

    0.3.2 (2016-05-13)

    • (bluefox) queue select if IDs and FROMs queries for sqlite

    0.3.1 (2016-05-12)

    • (bluefox) queue delete queries too for sqlite

    0.3.0 (2016-05-08)

    • (bluefox) support of custom queries
    • (bluefox) only one request simultaneously for sqlite
    • (bluefox) add tests (primitive and only sql)

    0.2.0 (2016-04-30)

    • (bluefox) support of milliseconds
    • (bluefox) fix sqlite

    0.1.4 (2016-04-25)

    • (bluefox) fix deletion of old entries

    0.1.3 (2016-03-08)

    • (bluefox) do not print errors twice

    0.1.2 (2015-12-22)

    • (bluefox) fix MS-SQL port settings

    0.1.1 (2015-12-19)

    • (bluefox) fix error with double entries

    0.1.0 (2015-12-14)

    • (bluefox) support of strings

    0.0.3 (2015-12-06)

    • (smiling_Jack) Add demo Data ( todo: faster insert to db )
    • (smiling_Jack) change aggregation (now same as history Adapter)
    • (bluefox) bug fixing

    0.0.2 (2015-12-06)

    • (bluefox) allow only 1 client for SQLite

    0.0.1 (2015-11-19)

    • (bluefox) initial commit

    License

    The MIT License (MIT)

    Copyright (c) 2015-2022 bluefox dogafox@gmail.com, Apollon77

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Install

    npm i iobroker.sql

    DownloadsWeekly Downloads

    430

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    595 kB

    Total Files

    30

    Last publish

    Collaborators

    • foxriver76
    • iobluefox
    • bluefox
    • apollon77
    • ldittmar
    • alcalzone