Add utility function to bulk set partial config parameters#176
Conversation
|
One thing to note is that Al has stated that he'd like to add native support for this type of action in |
|
FYI |
|
Results from the test if anyone wants them. Test device Test Results{ type: 'result',
success: true,
messageId: 'set-parameter',
result: { success: true } }
{ type: 'event',
event:
{ source: 'node',
event: 'value updated',
nodeId: 27,
args:
{ commandClassName: 'Configuration',
commandClass: 112,
property: 8,
propertyKey: 255,
newValue: 190,
prevValue: 21,
propertyName: 'LED Effect Color' } } }
{ type: 'event',
event:
{ source: 'node',
event: 'value updated',
nodeId: 27,
args:
{ commandClassName: 'Configuration',
commandClass: 112,
property: 8,
propertyKey: 65280,
newValue: 10,
prevValue: 10,
propertyName: 'LED Effect Brightness' } } }
{ type: 'event',
event:
{ source: 'node',
event: 'value updated',
nodeId: 27,
args:
{ commandClassName: 'Configuration',
commandClass: 112,
property: 8,
propertyKey: 16711680,
newValue: 25,
prevValue: 10,
propertyName: 'LED Effect Duration' } } }
{ type: 'event',
event:
{ source: 'node',
event: 'value updated',
nodeId: 27,
args:
{ commandClassName: 'Configuration',
commandClass: 112,
property: 8,
propertyKey: 2130706432,
newValue: 3,
prevValue: 4,
propertyName: 'LED Effect Type' } } } |
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
|
What do we need to change if zwave-js adds more native support for this feature? |
|
Not sure, because I am not sure what adding more native support means. I'm guessing that the main change would be to not calculate the raw value to send by doing the bit shift operations and just passing the individual bitmasks and values directly to zwave-js. All the other validation I would think we want to do in the library because we can raise more relevant exceptions to the caller |
|
Ok, so there's no risk of breaking changes for the user if this would happen? |
|
I can't guarantee that there will be no breaking change in the future, but I don't believe so. This method should work as long as the |
This has been an in demand request for some time. The new function will either accept a raw integer value or a dictionary of
{bitmask: value}and will convert the dictionary to the raw integer value before calling thenode.set_valuecommand.The logic all works, what I am not sure of is if we can useEDIT: Tests confirmed that we can in fact usenode.set_valueto bulk set parameters. I asked @petro to test this for me because I don't have any nodes with partial parametersnode.set_valueto bulk set parameters, so this PR is good to merge