You have
var array_status_base2 =
{payload:(context.global.wBetriebsStatus_01.toString(2)).split("")};
var heiz = {payload:array_status_base2[15]};
array_status_base2 is an object not an array, so
array_status_base2[15] is undefined. so you need something like
var heiz = {payload:array_status_base2.payload[15]};
though I have not analysed your code sufficiently to know whether that
is the only problem.
Note that you can do simple debugging in a function node by doing things like
node.warn( "value is " + array_status_base2.payload[15]});
then that string will appear in the server terminal window or log.
Colin
On 25 April 2017 at 14:03, Patrick <
in...@digitalbuilding.de> wrote:
> hi.. new here and first steps in node-red.
>
> I try to convert a global integer to a 16Bit-Array.
> in different cases I want to get out a message.
>
> but it get an info msg.payload : undefined
>
> why can I not call up p.e.
> what do I wrong?
>
> thanks in advance.. Patrick
>
>
> output 1 = 32785
> output 2 = array with 16 Bit
> output 3 = msg.payload : undefined
> output 4 = msg.payload : undefined
>
> here's my flow:
>
> [{"id":"56f842d.16df13c","type":"debug","z":"d27eace5.68918","name":"","active":true,"console":"false","complete":"false","x":510,"y":60,"wires":[]},{"id":"c4cadc76.48a9a8","type":"function","z":"d27eace5.68918","name":"Test","func":"var
> status = {payload:context.global.wBetriebsStatus_01};\nvar
> array_status_base2 =
> {payload:(context.global.wBetriebsStatus_01.toString(2)).split(\"\")};\nvar
> heiz = {payload:array_status_base2[15]}; \nvar kuehl =
> {payload:array_status_base2[14]}; \n\n if (array_status_base2[15] ===
> \"1\") var Status_text = \"Heiz-Betrieb\" ;\n if (array_status_base2[14]
> === \"1\") var Status_text = \"Kühl-Betrieb\" ;\n if
> (array_status_base2[13] === \"1\") var Status_text = \"Totzone\" ;\n if
> (array_status_base2[12] === \"1\") var Mode_text = \"Automatik\" ;\n if
> (array_status_base2[11] === \"1\") var Mode_text = \"Handbetrieb\" ;\n
> \nreturn [status,
> array_status_base2,heiz,kuehl];\n","outputs":"4","noerr":0,"x":290,"y":60,"wires":[["56f842d.16df13c"],["56f842d.16df13c"],["56f842d.16df13c"],["56f842d.16df13c"]]},{"id":"b474b5e9.eb98","type":"inject","z":"d27eace5.68918","name":"Test
> Trigger","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"x":130,"y":60,"wires":[["c4cadc76.48a9a8"]]}]
>
> --
>
http://nodered.org
>
> Join us on Slack to continue the conversation:
http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
node-red+u...@googlegroups.com.
> To post to this group, send email to
node...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
>
https://groups.google.com/d/msgid/node-red/11feec2f-55df-4a8d-9919-7b61ea644ccd%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.