Skip to content

Commit

Permalink
compatibility for boolean values and old Wiffi versions
Browse files Browse the repository at this point in the history
  • Loading branch information
t4qjXH8N committed Jun 27, 2019
1 parent ea2f90b commit f14adfb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ If any error occurs, please set the adapter loglevel to debug and send me the da
If this project helped you to reduce developing time, you can give me a cup of coffee or a bottle of beer via PayPal([email protected]) :-)

## Changelog
#### 2.1.3 (27-Jun-2019)
- compatibility for boolean values and old Wiffi versions

#### 2.1.2 (21-Jun-2019)
- changed behaviour: if states are missing in the datagram, but present in the database, they are not removed from the database
- boolean and numeric values are correctly stored
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": "wiffi-wz",
"version": "2.1.2",
"version": "2.1.3",
"news": {
"2.1.3": {
"en": "compatibility for boolean values and old Wiffi versions",
"de": "Kompatibilität für Boolesche Werte und alte Wiffi-Versionen",
"ru": "совместимость для логических значений и старых версий Wiffi",
"pt": "compatibilidade para valores booleanos e versões antigas do Wiffi",
"nl": "compatibiliteit voor booleaanse waarden en oude Wiffi-versies",
"fr": "Compatibilité pour les valeurs booléennes et les anciennes versions de Wiffi",
"it": "compatibilità per valori booleani e vecchie versioni di Wiffi",
"es": "Compatibilidad con valores booleanos y versiones anteriores de Wiffi.",
"pl": "zgodność dla wartości logicznych i starych wersji Wiffi",
"zh-cn": "兼容布尔值和旧Wiffi版本"
},
"2.1.2": {
"en": "boolean values are correctly saved",
"de": "Boolesche Werte werden korrekt gespeichert",
Expand Down
6 changes: 5 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,11 @@ function cast_wiffi_value(wiffi_val, wiffi_type) {
let val;
switch (wiffi_type) {
case 'boolean':
val = ((wiffi_val === 'true') ? true : false);
if(typeof wiffi_val === 'boolean') {
val = wiffi_val;
} else {
val = (wiffi_val === 'true');
}
break;
case 'number':
val = Number(wiffi_val);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.wiffi-wz",
"version": "2.1.2",
"version": "2.1.3",
"description": "Wiffi-wz Adapter",
"author": {
"name": "Christian Vorholt",
Expand Down

0 comments on commit f14adfb

Please sign in to comment.