Skip to content

Commit

Permalink
object attributes updating when needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
nobl committed Apr 30, 2021
1 parent 2fff337 commit 3ca26f3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ Here you can find a description of the states and how to use them. All states of
*Read-only number, which designates the number of wallbox [0..3]. This is only available on systems with configured wallboxes.*

## Changelog
### 1.1.1 (NoBl)
* Object attributes are updated to what they are expected to be: unit, description, datatype (this will break anything that still relies on datapoints being STRING that aren't meant to be string)

### 1.1.0 (NoBl)
* Updated to current adapter template
* Integrated GitHub Testing and auto npm publishing
Expand Down
14 changes: 13 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"common": {
"name": "senec",
"version": "1.1.0",
"version": "1.1.1",
"news": {
"1.1.1": {
"en": "* Object attributes are updated to what they are expected to be: unit, description, datatype (this will break anything that still relies on datapoints being STRING that aren't meant to be string)",
"de": "* Objektattribute werden bei Bedarf korrigiert: Einheit, Beschreibung, Datentyp (Es ist jetzt nicht mehr alles STRING).",
"ru": "* Атрибуты объекта обновляются до ожидаемых значений: единица измерения, описание, тип данных (это нарушит все, что все еще зависит от точек данных, являющихся STRING, а не строками)",
"pt": "* Os atributos do objeto são atualizados para o que se espera que sejam: unidade, descrição, tipo de dados (isso quebrará qualquer coisa que ainda dependa de pontos de dados sendo STRING que não deveriam ser strings)",
"nl": "* Objectkenmerken worden bijgewerkt naar wat ze worden verwacht: eenheid, beschrijving, datatype (dit zal alles verbreken dat nog steeds afhankelijk is van datapunten die STRING zijn en die niet bedoeld zijn als tekenreeks)",
"fr": "* Les attributs d'objet sont mis à jour pour ce qu'ils devraient être: unité, description, type de données (cela cassera tout ce qui repose encore sur des points de données STRING qui ne sont pas censés être une chaîne)",
"it": "* Gli attributi degli oggetti vengono aggiornati a quello che dovrebbero essere: unità, descrizione, tipo di dati (questo interromperà tutto ciò che si basa ancora sul fatto che i punti dati siano STRINGA che non devono essere stringa)",
"es": "* Los atributos de objeto se actualizan a lo que se espera que sean: unidad, descripción, tipo de datos (esto romperá cualquier cosa que todavía dependa de que los puntos de datos sean STRING y que no estén destinados a ser cadenas)",
"pl": "* Atrybuty obiektów są aktualizowane zgodnie z oczekiwaniami: jednostka, opis, typ danych (to zepsuje wszystko, co nadal zależy od punktów danych będących STRING, które nie mają być ciągiem)",
"zh-cn": "*对象属性已更新为预期的值:单位,描述,数据类型(这将破坏仍然依赖于数据点为STRING而不是字符串的任何内容)"
},
"1.1.0": {
"en": "(NoBl) Updated to current adapter template, Integrated GitHub Testing and auto npm publishing, Some other administrative updates",
"de": "(NoBl) Aktualisierung auf aktuelles Adaptertemplate, GitHub Testing und auto npm-Publish übernommen, zzgl. administrativer Aenderungen",
Expand Down
16 changes: 16 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,22 @@ class Senec extends utils.Adapter {
},
native: {}
});

// Check object for changes:
var obj = await this.getObjectAsync(name);
if (obj.common.name != description) {
this.log.debug("Updating object: " + name + " (desc): " + obj.common.name + " -> " + description);
await this.extendObject(name, {common: {name: description}});
}
if (obj.common.type != typeof(value)) {
this.log.debug("Updating object: " + name + " (type): " + obj.common.type + " -> " + typeof(value));
await this.extendObject(name, {common: {type: typeof(value)}});
}
if (obj.common.unit != unit) {
this.log.debug("Updating object: " + name + " (unit): " + obj.common.unit + " -> " + unit);
await this.extendObject(name, {common: {unit: unit}});
}

var oldState = await this.getStateAsync(name);
if (oldState) {
if (oldState.val === value)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.senec",
"version": "1.1.0",
"version": "1.1.1",
"description": "Senec Home",
"author": {
"name": "NoBl",
Expand Down

0 comments on commit 3ca26f3

Please sign in to comment.