Device: Command x Allen-Bradley Write

Hello

I’m trying to set a 3 single bits in my PLC (Allen-Bradley CompactLogix 1769-L18ER Cpu). To do this, I started using 3 different Allen-Bradley Write data blocks and 3 Device Command each. The device commands are set by 3 different trigger buttons… Then, I discover that it doesnt work like that (because when I press any button, the command set all the 3 bits at the same time).

Is there a way to send individual commands to set different bits individually? how to do that?

Thanks in advance,

Thiago

Hello @Thiago_Lima,

Welcome to the Losant forums, we’re happy you’re here!

Would you be able to send along some screenshots of your workflows and Allen-Bradley write node configuration?

Also, a common mistake is that when sending multiple different device commands to a single device you may need to use a Switch Node after the Device command trigger to switch on the name of the command so you know which command is sent.

Thank you,
Heath

Hi @Heath,

Yes, you’re damn right, I did not use a Switch Node.
I was taking a look over Switch Nodes documentation, It’s a kind of hard to me to understand all those web design and IT languages (my school is the school of automation, machines, ladder etc). I did not undertand how the syntax works.
What I know is: my commands have a name. And thats it. I really dont know where and how to proceed.

When I press the button, I can see this at Device page:

image

Thank you so much for helping
ThiagoThis text will be blurred

Hey @Thiago_Lima,

No worries at all. Help is what I’m here for :slight_smile:

The Switch Template field is usually a string template for a payload path that you would like to switch based on what the value is.

For example, let’s say I am sending a number on my payload with the path data.number and that number can be either 0, 1, or 2. My switch node configuration would look like:

So, in your case, you’re switching on the device command name, which should be at the payload path data.name. So, your switch template would be something like {{data.name}} and then your Case Template options would be the values that the name could be.

I would recommend you check out some of our Losant University videos, they do a great job of introducing some of these concepts in Losant. You can also read more about switch statements online.

Let me know if this helps.

Thank you,
Heath