-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Describe the bug
Hello, I'm using your library to connect to an OPC DA server hosted on a different machine (not localhost). However, no matter how I specify the host (via environment variables or constructor), it always defaults to localhost.
To Reproduce
Steps to reproduce the behavior:
Try to connect to an OPC DA server running on a remote machine (e.g., 192.168.1.100).
Set OPC_HOST via environment variable or pass it explicitly to OpenOpcConfig.
The client still connects to localhost instead of the specified IP.
I believe the issue stems from the following hardcoded values:
config.py
class OpenOpcConfig:
def init(
self,
opc_host: str = "localhost", # Hardcoded default
Suggested fix:
opc_host: str = os.environ.get("OPC_HOST", "localhost")
da_com.py
def connect(self, host: str, server: str):
self.server = server
self.host = "localhost" # <- This overrides the passed-in host
Suggested fix:
self.host = host
maybe this is also intentional but for me it was an issue trying to use the library.
Expected behavior
It should connect to my specified IP address either through enviroment variables or the given IP in OPC Config
Desktop (please complete the following information):
- OS: Windows
- OPC Server: Kepserver
- Python Version: 10.11 32bit