Michael, in your flow you have two nodes feeding into one. That means the Function node will be triggered by either the text node or the colour node - but not both at the same time.
Both of those nodes also emit their value as msg.payload, but your Function is trying to access msg.payload.colour and msg.payload.test (also note you have 'test' not 'text'...) - so their values will always be undefined.
You need to use a different approach to do this.
This is where you can use Flow Context to store values between each message event:
- when a message comes from the colour node, store its payload value in flow.colour
- when a message comes from the text node, store its payload value in flow.text
- in both cases then construct a complete message for the sensehat, pulling the latest values from flow context for both color and text. Something like:
The 4 rule change node looks like this:
