Control RO with Direct switch by Mervis
I have controled light on RO, it is connected with wall button with DirectSwitch functionality. I want control RO from Mervis as well but it does not work. How can I do it?
@martin-trojan Please check DirectSwitch_force from the Lib.UniPi
Hello, it works.
I want control light from web(digital setter) and HW button with direct switch. But I dont know how to create this funcionality. My solution blinking the lights and I am succesfull to turn on/off lights after 2-3 attempts. Can someone help me?
Can @tomas_hora recommend how to setup web button when it is swithed by hw button to match the current state of light and not swich at the same time?
Martin Kudláček last edited by
Hello @martin-trojan, this isn't as easy as it looks like. We are preparing a solution as we speak and we will get back to you as soon as possible.
Thanks for your patience,
@Martin-Kudláček any progress?
This is just one possible solution, but you can use a custom ST FunctionBlock with this code (use the name "DigitalMemoryMultiplexer" if you do use it):
FUNCTION_BLOCK DigitalMemoryMultiplexer (* EXTENDS //base type IMPLEMENTS //interface type list *) VAR previous_inp_1: BOOL; previous_inp_2: BOOL; previous_outp: BOOL; END_VAR VAR_INPUT inp1: BOOL; inp2: BOOL; END_VAR VAR_OUTPUT outp: BOOL; END_VAR INIT previous_inp_1 := inp1; previous_inp_2 := inp2; previous_outp := inp1; END_INIT IF inp1 <> previous_inp_1 THEN outp := inp1; previous_inp_1 := inp1; ELSIF inp2 <> previous_inp_2 THEN outp := inp2; previous_inp_2 := inp2; ELSE outp := previous_outp; END_IF; previous_outp := outp; END_FUNCTION_BLOCK
And connect it like this:
The DO_2_01 is set as DirectSwitch Trigger and the WEB_LIGHT_BUTTON is tied to a HMI Digital Setter. Whenever you are using DirectSwitch remember to set the Debounce value on the DI sufficiently high for your input device.
Again, there are many other options for doing this, including using two HMI elements on top of each other (Digital Indicator and Digital Setter).
Here is the project file, for reference: https://www.mediafire.com/file/1o8kq9iici2qc8g/ForumProject.7z/file