$BEREMIZPYTHONPATH - > >(
# Wait for server to print modified value
if [[ "$line" == 3.4 ]]; then
echo "PLC could write value"
from asyncua import Server
host = os.environ.get("OPCUA_DEFAULT_HOST", "127.0.0.1")
endpoint = "opc.tcp://"+host+":4840/freeopcua/server/"
server.set_endpoint(endpoint)
uri = "http://beremiz.github.io"
idx = await server.register_namespace(uri)
objects = server.get_objects_node()
testobj = await objects.add_object(idx, "TestObject")
testvarout = await testobj.add_variable(idx, "TestOut", 1.2)
testvar = await testobj.add_variable(idx, "TestIn", 5.6)
await testvar.set_writable()
print(await testvar.get_value())
# Start PLC with opcua test
setsid $BEREMIZPYTHONPATH $BEREMIZPATH/Beremiz_cli.py -k \
--project-home $BEREMIZPATH/tests/projects/opcua_client build transfer run > >(
# Wait for PLC runtime to output expected value on stdout
if [[ "$line" == 1.2 ]]; then
echo "PLC could read value"
echo all subprocess started, start polling results
res=110 # default to ETIMEDOUT
if [[ -a ./SRVOK && -a ./PLCOK ]]; then
# Kill PLC and subprocess
echo will kill PLC:$PLC_PID and SERVER:$SERVER_PID