ioBroker / ioBroker.sql

Store history data in SQL Database: MySQL, PostgreSQL or SQLite
MIT License
45 stars 24 forks source link

Entries are not inserted in the newer version than 1.4.6 if value=== null at start iobroker. #36

Closed Andrey2509 closed 6 years ago

Andrey2509 commented 6 years ago

Some entries are not inserted to DB in the newer version than 1.4.6. If in the properties of objects (owfs, javacript) to remove and put the activator on the record - the entries are inserted to DB. But after restart iobroker history of objects are not inserted. In the debug mode, there are no errors and there are no records in log with "INSERT...".

Andrey2509 commented 6 years ago

Addition. Probably if at iobroker start the values of objects === null then values are not stored in the database. Even if after start the values of the objects are normal (not null) .

Apollon77 commented 6 years ago

Please try with the current 1.5.8 version ... install from github if needed. same probems there?

Apollon77 commented 6 years ago

WHat exactly means "some"`? Debug log could help including info about affected datapoints

Andrey2509 commented 6 years ago

Debug log if installed sql.history ver. 1.4.6 (without problem to store to DB):

sql.0   2017-12-01 08:19:41.108 debug   DELETE FROM `iobroker`.ts_number WHERE id=1 AND ts < 1480562340107;
sql.0   2017-12-01 08:19:41.098 debug   INSERT INTO `iobroker`.ts_number (id, ts, val, ack, _from, q) VALUES(1, 1512098354042, 4.875, 1, 16, 0);

id = 1 in DB table "datapoints" has object: owfs.0.wires.Балкон raw settings for owfs.0.wires.Балкон: { "type": "state", "common": { "name": "Балкон", "type": "number", "read": true, "write": false, "role": "level.temperature", "desc": "1wire sensor", "unit": "°C", "custom": { "sql.0": { "enabled": true, "changesOnly": false, "debounce": 60000, "retention": 31536000, "changesRelogInterval": 60, "changesMinDelta": 0, "storageType": "Number" } } }, "native": { "id": "28.B2BEA4050000", "property": "temperature" }, "from": "system.adapter.owfs.0", "ts": 1511540970141, "_id": "owfs.0.wires.Балкон", "acl": { "object": 1636, "state": 1636, "owner": "system.user.admin", "ownerGroup": "system.group.administrator" } }

After restart restart iobroker all history for objects with id=1 stored successfully, every about 1 minutes.

If update to any version above 1.4.6 (Bellow example for version 1.5.8 from github):

And after restart iobroker:

sql.0   2017-12-01 08:46:19.331 info    Do not store value "null" for owfs.0.wires.Балкон because no number
sql.0   2017-12-01 08:46:19.331 debug   Do Automatic Datatype conversion for owfs.0.wires.Балкон
sql.0   2017-12-01 08:46:19.331 debug   Datatype owfs.0.wires.Балкон: Currently: string, StorageType: Number

Object owfs.0.wires.Балкон has value === null only first 1 minutes after start. After about 1 minutes it has normal "number" values. But sql.history driver now do not try check new values and do not store it to DB.

If change "storage as" to "Automatic" I have only 1 record and nothing more:

sql.0 2017-12-01 08:59:05.841 debug INSERT INTOiobroker.ts_string (id, ts, val, ack, _from, q) VALUES(1, 1512100745455, 'null', 1, 17, 64);

masterki commented 6 years ago

in version 1.60 new entrys are NULL by new createt logs, old datapoint-logs will collect as normal and have Values. the History Adapter collects some entry as null but they collect Values. The History adapter i have install for compare. Flot shows the sql data correct but in Admin all is null - confused

Apollon77 commented 6 years ago

Can you please send a full debug log for the sql lines of the start ... need to see that in its complete.

masterki commented 6 years ago

Wie mach ich davon ein debug log?

viele Grüße

Thorsten

Ingo Fischer notifications@github.com schrieb am So., 28. Jan. 2018 um 17:06 Uhr:

Can you please send a full debug log for the sql lines of the start ... need to see that in its complete.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ioBroker/ioBroker.sql/issues/36#issuecomment-361073834, or mute the thread https://github.com/notifications/unsubscribe-auth/APFQoJVT2gYDtsvNn_-I5_3oDSuTZ8rZks5tPJsNgaJpZM4QwN_B .

Apollon77 commented 6 years ago

Instanzen -> Expertenmodus Dann in der Spalte "Loglevel" bei deiner sql Instanz von info auf debug stellen. Dann am besten direkt aus dem Logfile /opt/iobroker/log/iobroker... |grep sql machen

masterki commented 6 years ago

Ok

also nach der Adapter umstellungen auf debug die ausgabe ausm log - so wie im Aanhang?

Ich hatte ja den comment noch mal editiert auf GitHub - im Admin 3 zeigt er 'null' und im Flot zeigt er zum Teil daten zum teil ausetzer. Der History adapter zeigt bei neustart von Broker auch 1-2 zwei mal 'null' zeichnet dann aber normal auf, zeigt sie auch an und hat im flot auch keine ausetzer.

Ingo Fischer notifications@github.com schrieb am So., 28. Jan. 2018 um 22:49 Uhr:

Instanzen -> Expertenmodus Dann in der Spalte "Loglevel" bei deiner sql Instanz von info auf debug stellen. Dann am besten direkt aus dem Logfile /opt/iobroker/log/iobroker... |grep sql machen

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ioBroker/ioBroker.sql/issues/36#issuecomment-361099223, or mute the thread https://github.com/notifications/unsubscribe-auth/APFQoLLm91n6qtkO1ICBFjWqUSPsQ9jfks5tPOuDgaJpZM4QwN_B .

Apollon77 commented 6 years ago

Hast Du Anhang vergessen?

Apollon77 commented 6 years ago

@Andrey2509 YOu have set the "debounce to 60seconds ... when you say the value is updates every minute then this debounce is too high and could mean that no values are logged at al. "debounce"can be used to make sure the value is stable, so normally it is <1s ...

Andrey2509 commented 6 years ago

 I can answer to you 6 feb 2018.3:26, 30 января 2018 г., Ingo Fischer notifications@github.com:@Andrey2509 YOu have set the "debounce to 60seconds ... when you say the value is updates every minute then this debounce is too high and could mean that no values are logged at al. "debounce"can be used to make sure the value is stable, so normally it is <1s ...

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

-- Отправлено из мобильного приложения Яндекс.Почты

Apollon77 commented 6 years ago

Please all test 1.6.3 from Github.

Andrey2509 commented 6 years ago

sql.0 | 2018-02-05 22:10:33.422 | debug | Type (from Def) for owfs.0.wires.Балкон: 0
sql.0 | 2018-02-05 22:10:33.422 | debug | Type set in Def for owfs.0.wires.Балкон: Number
sql.0 | 2018-02-05 22:10:33.422 | debug | Datatype owfs.0.wires.Балкон: Currently: null
Apollon77 commented 6 years ago

More details please ... The part of the log without any context is not tell me anything :-) What exactly isthe problem? The part of the code looks good for himself ... no type at the beginning, after it type is Number/0 ...

Apollon77 commented 6 years ago

Plus: WHich version? 1.6.7? Github version?

Andrey2509 commented 6 years ago

Github version, 1.6.7. After ~1 minutes after start owfs.0.wires.Балкон has normal number values (I can see updated values in "objects"), but new values are not inserted to DB (not logegd and no new records in DB). If to restart sql.0 driver (object owfs.0.wires.Балкон already has normal number values, not null) - they are inserted to DB normally (I can see it in log and in DB).

Apollon77 commented 6 years ago

Could you set adapter to Debug log and do a restart till that error/effect happens?! And send to me. Need to dig into it

Andrey2509 commented 6 years ago

06.02.2018, 12:19, "Ingo Fischer" notifications@github.com:Could you set adapter to Debug log and do a restart till that error/effect happens?! And send to me. Need to dig into it

—You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub, or mute the thread.

Andrey2509 commented 6 years ago

Debug log file: debug.txt

sql

Apollon77 commented 6 years ago

Very intersting ... what is set for these DPs as "debouce" value?! Please install version from github and send new log ... I added some logs. I don't understand it :-( Normally it should work and nothing was changed on this part

Andrey2509 commented 6 years ago

Latest version from 07 feb 2018 from github: New debug log: debug02.txt

{
  "from": "system.adapter.owfs.0",
  "ts": 1511540970141,
  "common": {
    "name": "Балкон",
    "type": "number",
    "role": "level.temperature",
    "desc": "1wire sensor",
    "unit": "°C",
    "read": true,
    "write": false,
    "custom": {
      "sql.0": {
        "enabled": true,
        "changesOnly": false,
        "debounce": 60000,
        "retention": 31536000,
        "changesRelogInterval": 60,
        "changesMinDelta": 0,
        "storageType": "Number"
      }
    }
  },

sql02

Apollon77 commented 6 years ago

As thought (and this is nothing new): Your Debounce value is way too high You can see in log that new data come in every 30seconds but you defined (debounce) that a value need to be unchanged for at least 60s before he is considered stable. So in your case all data are discarded because "Unstable". Lower the debouce to a meaningfull value and topic should be fixed But as said: This should had been that way all the time before too

Andrey2509 commented 6 years ago

Thank you. I did not think about this setting, becase It works normally on old version 1.4.6.

Apollon77 commented 6 years ago

yes ... 1.4 had different meaning which did not mached with the name of the setting :-)) Great to see that its fixed for you!

There is a new "release Candidate" 1.6.8 on Github ... hope we now figured out anything ...