The current DDF implementation partially assumes the wrong data type for incoming data This e.g. leads to the need to treat integer values as strings.
As an example serves the windowopen state of a Danfoss Ally thermostat. On zigbee level, that data is represented as enum8 with values from 0 - 4. Using the below JS Code, the result will always be "Unknown".
switch (Attr.val) {
case 0:
Item.val = "Quarantine";
break;
case 1:
Item.val = "Closed";
break;
case 2:
Item.val = "Hold";
break;
case 3:
Item.val = "Open";
break;
case 4:
Item.val = "Open (external), closed (internal)";
break;
default:
Item.val = "Unknown";
break;
}
Presumably, the root cause is that the data type defined in resource.cpp for the respective resource item is string. However, this should be considered as the output data type only for consistency.
Steps to reproduce the behavior
See above. Changing the case values to strings results in the expected behavior.
Expected behavior
Enforce the defined data type for a resource item as output data type and leave the input data type untouched.
Screenshots
Environment
Host system: Any
Running method: Any
Firmware version: 26720700 and below
deCONZ version: 2.13.1 and 2.13.0
Device: ConBee I / ConBee II / RaspBee I / RaspBee II
Do you use an USB extension cable: Not relevant
Is there any other USB or serial devices connected to the host system? If so: Which? Not relevant
Describe the bug
The current DDF implementation partially assumes the wrong data type for incoming data This e.g. leads to the need to treat integer values as strings.
As an example serves the
windowopen
state of a Danfoss Ally thermostat. On zigbee level, that data is represented asenum8
with values from 0 - 4. Using the below JS Code, the result will always be "Unknown".Presumably, the root cause is that the data type defined in
resource.cpp
for the respective resource item isstring
. However, this should be considered as the output data type only for consistency.Steps to reproduce the behavior
See above. Changing the case values to strings results in the expected behavior.
Expected behavior
Enforce the defined data type for a resource item as output data type and leave the input data type untouched.
Screenshots
Environment
deCONZ Logs
N/A
Additional context
N/A