question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot connect to OPC server

See original GitHub issue

Hello, Apologies for the noob question, I have setup an OPC server on a Rasberry Pi, and I’m trying to get the TB Gateway to connect to it, without success. The connector.log shows error ''2020-02-06 13:22:50' - INFO - opcua_connector - 86 - Starting OPC-UA Connector' ''2020-02-06 13:22:50' - DEBUG - opcua_connector - 97 - error on connection to OPC-UA server.' ''2020-02-06 13:22:50' - ERROR - opcua_connector - 98 - 'Client' object has no attribute 'load_type_definitions''

I have updated the opcua python package to the latest version (0.98.9). My TB installation runs on a Ubuntu VM, otherwise working without problems. I have setup the gateway as a device and configured the tb_gateway.yaml correctly. On the Raspberry Pi, I am running the server_example.py of the python-opcua package from https://github.com/FreeOpcUa/python-opcua/blob/master/examples/server-example.py. Using the ProSys OPC browser I can connect and retrieve the data successfully. Same applies when running the client_example.py code (from python-opcua). I have also tried running the Open62541 server, again I can connect successfully with the ProSys browser and the client_example.py script, but not with the gateway.

Any ideas what might be causing this? Thanks in advance!

[edit: just updated to the latest release, but the problem persists (error lines 99 and 100)]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:30 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
komis1commented, Feb 13, 2020

hi @zbeacon I just tried the latest pre-release (2.1.0.5). Thank you for fixing the subscriptions bug, I see where you have made the replacement in the code. The timeseries values are now updated regularly as should be.

The attributes are still not changing. The change event is picked up, but the uplink converter still only tries to update telemetry data - of course, the path is different, so no change is effected. I believe this is because the uplink converter is set to work with telemetry data after the initial load (since this is the last bit of information that is picked up by it). Therefore I think the fix should be something like an additional parameter in the uplink converter to say that we want to work with attribute or telemetry data types.

More specifically, in the uplink converter code, in line 33

for information in self.__config[information_type]:

this loop executes only once - the value of self.__config[information_type] is only “telemetry”.

—Edit— OK I found it. In opcua_connector.py, remove line 237 - after that, it works fine, updating both attributes and timeseries.

        device_configuration.update(**device_info)
1reaction
komis1commented, Feb 12, 2020

@ki-do @zbeacon Here is a fix, applied to opcua_connector.py (line 109). Basically just add the little for loop to the code and restart the gateway service.

        log.debug('Subscriptions: %s', self.subscribed)
        log.debug("Available methods: %s", self.__available_object_resources)
        for key in self.subscribed.keys():        
            log.debug("NODE %s",key)
            self.__sub.subscribe_data_change(key)

Screenshot 2020-02-12 at 16 44 05

Still not a perfect fix, as it’s picking up attribute changes but not sending them to Thingsboard. Need to look into that. It’s working for telemetry data though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

2. Possible Solutions when an OPC Client cannot Connect to ...
Start your OPC client application. Each client application will provide a unique method of referencing OPC servers. One common method is to display...
Read more >
Why I am not able to connect to an OPC server on a remote ...
Stop all OPC server and OPCEnum services from the services panel. · Browse to Windows\System32. · Rename OPCEnum.exe to OPCEnum.exe.old · Try to ......
Read more >
Troubleshooting DCOM Part 2 - Can't Connect to OPC Servers
Can't connect to OPC Server on remote PC; Polling succeeds but automatic (asynchronous) data updates fail; All items on OPC server show Bad...
Read more >
OPC Connection Issues - Exele Information Systems, Inc.
If you cannot connect to your running OPC Server or have problems reading or writing tag values, you may need to adjust the...
Read more >
Cannot Connect to NI OPC Server after Running the ... - Support
Solution · Close the NI OPC Servers application and ensure that servermain.exe is not running in the task manager under Processes. · Stop...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found