Closed ekarak closed 4 years ago
the value.index is always '0' for all three instances, hence the following code now overwrites the values...:
zwave.on('value added', function(nodeid, comclass, value) {
if (!nodes[nodeid]['classes'][comclass])
nodes[nodeid]['classes'][comclass] = {};
console.log(value);
nodes[nodeid]['classes'][comclass][value.index] = value;
});
uint16 OpenZWave::ValueID::GetIndex ( ) const | uint16 Get the value index. The index is used to identify one of multiple values created and managed by a command class. In the case of configurable parameters (handled by the configuration command class), the index is the same as the parameter ID. Knowledge of command classes is not required to use OpenZWave, but this information is exposed in case it is of interest. Returns the value index within the command class.
Did the wrapper break when this transitioned to 16-bit integer?
To uniquely identify a value - a combination of Node/Instance/CommandClass and Index is required.
Or just use the ValueID key if your looking for a unique identifier.
(If you support multiple sticks (networks) then include HomeID above).
Thanks @Fishwaldo ! The index used to be unique amongst ValueIDs under a command class. If I understand correctly that has changed and it is the instance+index combination that must be unique?
Nope. It was never unique. 2 instances with same command class would always have same index.
@ekarak In my case for node values I use an object and I use the valueid as key
I upgraded my base OZW library to 1.6.1004 and I found out my multi-instance device only has one single ValueID mapped for the 2nd switch, I have no control over the 1st switch:
This really should be at least two ValueIDs here, one for each instance. Investigating...