I have created the python web service using rest api and build UI using pyside6. when i give post values from UI using rest api it should be able to then write/post to opcua server.How can i achieve this or what will be the approach.

Need with code example. Big thank you.here i have to make changes in api service written in python ->

@requires_logindef post_car_setting(api_key, id: str, car_settings_schema: CarSettingsSchema, login=None) -> Response:carModel:CarModel=CarModel.fetch_by_id(id)if carModel is not None:car_settings = CarSettingsModel.from_schema(car_settings_schema)carModel.car_settings=car_settingscarModel.modified_by=logincarModel.modified_on=datetime.now()carModel.update()##opcua call hookreturn Response(body=carModel.car_settings).send_response()else:return Response(False,ErrorCodes.NOT_FOUND)

this code says that it save my car settings such as speed as 30 to local schema.in my UI app which is written in python+qml im using post method to save setting.i have to save car speed to opcua server from api service (in above code snippets). how the code/ logic is going to be.

2

Best Answer


I´m not sure if you want to make a OPC UA Server (with a UI) or you want to make an OPC UA Client that connect to an existing server.

For both solutions there are examples:

Write an variable server-side

Write an variable client-side

You can use asyncua to access the server data. If you need a example how access the server use this as starting point. For the integration I can't help you without knowing which framework you are using.