Controling a valve through a faceplate

Hey, I am trying to make a faceplate for a valve in perspective. I already manged to read values from my PLC, but when i make a button for opening or closing the valve i just doens't work. I work with parameters, i link my PLC tags with parameter.

Did you make the parameters bidirectional? Is the view embedded with the outer view's parameters bidirectionally bound to the tag?

Consider not using parameters for the tag value, but instead passing a tag path as a string parameter, pointing to the tag to be controlled, or to the folder/UDT instance containing the relevant tags. Then, your faceplate view can use an indirect binding set to bidirectional.

Yeah i put them on bidriectional. I will try the tag path method. Thanks for replying!

Did you get it to work?
I am not an expert, but I have made some faceplates for valves, using different methods.
pturmel is an expert! He helped me.

Assuming you expect this button to only ever toggle the state of the valve from open to closed or from closed to open, you could do this as your script (assuming the button and valve are siblings):

def runAction(self, event):
	self.getSibling("Valve").props.state = "open" if self.getSibling("Valve").props.state == "closed" else "closed"

Yeah i tested it and it worked!

Thanks it worked!

1 Like

No i want to use two separate buttons, one to close and one to open the valve.

What kind of Valve do you have? What is the valve for?
Perspective has built in multi-state-button.
The can tight an INT to this button; you can also change it to 2 positions; it is like a selector, not really a push button.


image

It is a solenoid operated valve. In the PLC logic it is controlled through a PlantPax 3.5 addon. I am trying to recreate the PlantPax library in perspective.

Yuck!

Have you looked at this:

4 Likes

Yes i did but it is only for vision and i need to do it in perspective.