Skip to content

Commit

Permalink
* prepare initial 3.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Apollon77 committed May 11, 2022
1 parent 6d52e9c commit dc0866b
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 5 deletions.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,36 @@ The given ids are not checked against the ioBroker database and do not need to b

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
* array of multiple IDs with 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
## delete state
If you want to delete entry from the Database you can use the build in system function **delete**:

Expand Down Expand Up @@ -420,6 +447,10 @@ sendTo('influxdb.0', 'getEnabledDPs', {}, function (result) {
## Changelog

### __WORK IN PROGRESS__
* (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.

### 3.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
Expand Down
53 changes: 52 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,57 @@
"agree",
"cancel"
]
},
{
"condition": {
"operand": "and",
"rules": [
"oldVersion<3.0.0",
"newVersion>=3.0.0"
]
},
"title": {
"en": "Important notice!",
"de": "Wichtiger Hinweis!",
"ru": "Важное замечание!",
"pt": "Notícia importante!",
"nl": "Belangrijke mededeling!",
"fr": "Avis important!",
"it": "Avviso IMPORTANTE!",
"es": "Noticia importante!",
"pl": "Ważna uwaga!",
"zh-cn": "重要通知!"
},
"text": {
"en": "This new version introduces several changes how values are logged because we fixed several issues and added new features. Please especially check the defined \"debounce\" and \"block time\" settings in your datapoints if values are not logged as expected and make sure the settings make sense. For more details please refer to the changelog and Readme.",
"de": "Diese neue Version führt mehrere Änderungen ein, wie Werte protokolliert werden, da wir mehrere Probleme behoben und neue Funktionen hinzugefügt haben. Bitte überprüfen Sie insbesondere die definierten „Entprellen“- und „Sperrzeit“-Einstellungen in Ihren Datenpunkten, wenn Werte nicht wie erwartet protokolliert werden, und stellen Sie sicher, dass die Einstellungen sinnvoll sind. Weitere Details finden Sie im Changelog und in der Readme.",
"ru": "В этой новой версии внесено несколько изменений в регистрацию значений, поскольку мы исправили несколько проблем и добавили новые функции. Пожалуйста, особенно проверьте определенные настройки «debounce» и «block time» в ваших точках данных, если значения не регистрируются должным образом, и убедитесь, что настройки имеют смысл. Для получения более подробной информации, пожалуйста, обратитесь к журналу изменений и Readme.",
"pt": "Esta nova versão apresenta várias alterações na forma como os valores são registrados, pois corrigimos vários problemas e adicionamos novos recursos. Verifique especialmente as configurações definidas de \"debounce\" e \"block time\" em seus pontos de dados se os valores não forem registrados conforme o esperado e verifique se as configurações fazem sentido. Para obter mais detalhes, consulte o log de alterações e o Leiame.",
"nl": "Deze nieuwe versie introduceert verschillende wijzigingen in de manier waarop waarden worden geregistreerd, omdat we verschillende problemen hebben opgelost en nieuwe functies hebben toegevoegd. Controleer vooral de gedefinieerde \"debounce\" en \"block time\" instellingen in uw datapunten als de waarden niet zijn vastgelegd zoals verwacht en zorg ervoor dat de instellingen kloppen. Raadpleeg de changelog en Readme voor meer informatie.",
"fr": "Cette nouvelle version introduit plusieurs changements dans la journalisation des valeurs car nous avons corrigé plusieurs problèmes et ajouté de nouvelles fonctionnalités. Veuillez vérifier en particulier les paramètres \"anti-rebond\" et \"temps de blocage\" définis dans vos points de données si les valeurs ne sont pas enregistrées comme prévu et assurez-vous que les paramètres ont un sens. Pour plus de détails, veuillez consulter le journal des modifications et le fichier Lisez-moi.",
"it": "Questa nuova versione introduce diverse modifiche al modo in cui i valori vengono registrati perché abbiamo risolto diversi problemi e aggiunto nuove funzionalità. Controllare in particolare le impostazioni definite \"debounce\" e \"block time\" nei propri datapoint se i valori non sono registrati come previsto e assicurarsi che le impostazioni abbiano un senso. Per maggiori dettagli, fare riferimento al log delle modifiche e al Leggimi.",
"es": "Esta nueva versión introduce varios cambios en la forma en que se registran los valores porque solucionamos varios problemas y agregamos nuevas funciones. Verifique especialmente la configuración definida de \"antirrebote\" y \"tiempo de bloqueo\" en sus puntos de datos si los valores no se registran como se esperaba y asegúrese de que la configuración tenga sentido. Para obtener más detalles, consulte el registro de cambios y el archivo Léame.",
"pl": "Ta nowa wersja wprowadza kilka zmian w sposobie rejestrowania wartości, ponieważ naprawiliśmy kilka problemów i dodaliśmy nowe funkcje. W szczególności sprawdź zdefiniowane ustawienia „odbicia” i „czasu blokowania” w punktach danych, jeśli wartości nie są rejestrowane zgodnie z oczekiwaniami i upewnij się, że ustawienia mają sens. Aby uzyskać więcej informacji, zapoznaj się z dziennikiem zmian i Readme.",
"zh-cn": "这个新版本引入了一些更改值的记录方式,因为我们修复了几个问题并添加了新功能。如果未按预期记录值,请特别检查数据点中定义的“去抖动”和“阻塞时间”设置,并确保设置有意义。有关更多详细信息,请参阅更改日志和自述文件。"
},
"link": "https://github.com/ioBroker/ioBroker.sql/blob/master/docs/en/README.md#settings",
"level": "warn",
"linkText": {
"en": "Readme",
"de": "Liesmich",
"ru": "Прочти меня",
"pt": "Leia-me",
"nl": "Leesmij",
"fr": "Lisez-moi",
"it": "Leggimi",
"es": "Léame",
"pl": "Readme",
"zh-cn": "自述文件"
},
"buttons": [
"agree",
"cancel"
]
}
]
},
Expand Down Expand Up @@ -271,4 +322,4 @@
}
],
"objects": []
}
}
11 changes: 8 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1709,13 +1709,18 @@ function storeState(adapter, msg) {
}, msg.callback);
}

let pushFunc = pushHelper;
if (msg.message.rules) {
pushFunc = pushHistory;
}

let id;
if (Array.isArray(msg.message)) {
adapter.log.debug(`storeState ${msg.message.length} items`);
for (let i = 0; i < msg.message.length; i++) {
id = adapter._aliasMap[msg.message[i].id] ? adapter._aliasMap[msg.message[i].id] : msg.message[i].id;
if (msg.message[i].state && typeof msg.message[i].state === 'object') {
pushValueIntoDB(adapter, id, msg.message[i].state);
pushFunc(adapter, id, msg.message[i].state);
} else {
adapter.log.warn(`Invalid state for ${JSON.stringify(msg.message[i])}`);
}
Expand All @@ -1725,15 +1730,15 @@ function storeState(adapter, msg) {
id = adapter._aliasMap[msg.message.id] ? adapter._aliasMap[msg.message.id] : msg.message.id;
for (let j = 0; j < msg.message.state.length; j++) {
if (msg.message.state[j] && typeof msg.message.state[j] === 'object') {
pushValueIntoDB(adapter, id, msg.message.state[j]);
pushFunc(adapter, id, msg.message.state[j]);
} else {
adapter.log.warn(`Invalid state for ${JSON.stringify(msg.message.state[j])}`);
}
}
} else if (msg.message.id && msg.message.state && typeof msg.message.state === 'object') {
adapter.log.debug('storeState 1 item');
id = adapter._aliasMap[msg.message.id] ? adapter._aliasMap[msg.message.id] : msg.message.id;
pushValueIntoDB(adapter, id, msg.message.state);
pushFunc(adapter, id, msg.message.state);
} else {
adapter.log.error('storeState called with invalid data');
return adapter.sendTo(msg.from, msg.command, {
Expand Down

0 comments on commit dc0866b

Please sign in to comment.