Help with injecting a boolean value into a payload?

#1

I am trying to inject a true or false value into my Siemens S7-300 PLC. I can only manage to send numbers trough inject node JSON for example: {"Value":[5]}. I need to toggle inputs on my PLC with a boolean value. Here is my node red flow:

[{"id":"91d339ac.1bae68","type":"debug","z":"2a98a51b.fd07aa","name":"msg.payload","active":true,"console":"false","complete":"payload","x":684,"y":272,"wires":[]},{"id":"ef00622f.98f69","type":"inject","z":"2a98a51b.fd07aa","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":160,"y":275,"wires":[["1d9af56d.4c456b"]]},{"id":"1d9af56d.4c456b","type":"write","z":"2a98a51b.fd07aa","connection":"1b5001ca.703bae","topic":"write","globallist":{"items":[{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"0","S7_BitOffset":"0","S7_Length":"1","S7_Name":"ON"}]},"payload":"{\"S7_Type\":\"DB\",\"S7_DBnum\":\"1\",\"S7_Datatype\":\"X\",\"S7_Offset\":\"0\",\"S7_BitOffset\":\"0\",\"S7_Length\":\"1\",\"S7_Name\":\"ON\"}","name":"write","x":405,"y":269,"wires":[["91d339ac.1bae68"]]},{"id":"1b5001ca.703bae","type":"connection","z":"2a98a51b.fd07aa","ip":"192.168.50.20","port":"102","rack":"0","slot":"0","payload":[{"S7_Type":"DB","S7_DBnum":"1","S7_Datatype":"X","S7_Offset":"0","S7_BitOffset":"0","S7_Length":"1","S7_Name":"ON"}],"globallist":null}]

0 Likes

#2

Please see this post for how to share flows so that they are importable. You can edit your previous post to fix it.

0 Likes

#3

I think you may be using a contrib node, if so please tell us what it is, probably node-red-contrib-something.

0 Likes

#4

It should be now fixed!

0 Likes

#5

Yes, ok now, but we need to know which node you are using, node-red-contrib-???

0 Likes

#6

Sorry it's my first time using node red and I didn't know I was using such a node. I am using node-red-contrib-s7.

0 Likes

#7

Hi and welcome.

I don't use the s7 nodes so I'm guessing but have you tried feeding Number 1 or 0 to your Boolean PLC tags instead of Boolean true/false?

0 Likes

#8

Yes I tried using 1 and 0 and it didn't work.

0 Likes

#9

I think you must be using another one. Your flow has a node of type write that does not appear to be in the S7 node. If you go to manage palette in node-red it will show you all the nodes you have installed.

0 Likes