joshendriks / pimatic-node-red

Node-red for pimatic
Apache License 2.0
3 stars 3 forks source link

Input for device node should support msg.payload as action parameter #18

Open mwittig opened 7 years ago

mwittig commented 7 years ago

Currently, the device node tries to read msg.parameter if the Parameter field is left empty. In my opinion, the node should (also) support to use msg.payload instead as otherwise a transformation must be added each time when the device is used as part of a flow chain with other nodes, e.g. dashboard UI items:

Suggested alternatives for fixture:

For the latter I have drafted an implementation which perhaps is not yet perfect as I am still a beginner with the node-red API. I can push it to a seperate branch if you wish to review. See: https://github.com/mwittig/pimatic-node-red/commit/e05701b63f4a0bfe7066dd02f8e41d5362c39361

image

joshendriks commented 7 years ago

This makes sense. I do not recall why I decided to use msg.parameter in the first place. Maybe it will pop up ...

I think it should be built in a way that the user may choose which value to take. Similar to 'Output' on the debug node: image

Default should be msg.parameter for backwards compatibility. The option to provide a value should remain.

What do you think?