Using BinEnum expression

I’ve got an actuated valve that has a tag for open and a tag for closed. If it is closed and you push the button for open, both tags for open and closed are = 1 until limit switch is hit, changing the closed tag value to 0.

I am trying to make an expression where a multistate will be red when closed tag =1 and green when opened tag = 1, and flash green/red and display “operating” when both tags = 1. Is it possible to do this?

The binEnc expression should do just that - pass it the two tags and you’ll get 0/1/2/3 as a result

Yes. A simple label can do this with a few expressions. First, bind its ‘text’ property to an expression like:if({[Client]Opened} && {[Client]Closed}, "Operating", "")That’ll make the text only appear when both bits are true. Then create a custom property “Blink” and bind it to an expression like:dateExtract(now(250), 'second') % 2That’ll make it toggle every second. Finally, set the “Fill Background” property, and bind the background color to another expression, like:if({[Client]Opened}, if({[Client]Closed}, if({Root Container.Label.Blink}, "red", "green"), "green"), if({[Client]Closed}, "red", "orange"))Note the “orange” at the end. That allows an operator to see a device failure that leaves both signals off.

Phil’s solution would work, but I think it would be a lot easier to:

  1. Make an integer custom property called “state”, bind it to “binEnc({tag1}, {tag2})”
  2. Use Styles feature to drive color/text/blinking etc

Yeah, Styles. Can you tell I don’t use them often? :slight_smile:

Yes, I got that impression!