I use UaExpert client to test the communication with a Wago PFC100 and all is good.
On this WAGO, I need to configure the OPC UA Endpoint with Security Policy - None, and unlimited anonymous acccess. And now I haven’t HA crash.
I will increase security little by little…
By the way, what is the syntax to define login/password in configuration.yaml file ?
I haven’t implement any automatic client certificate generation. So that will be step one.
each certificate has a specific Uri, so both need to be listed in the yaml.
below is an example of mine connecting to a freeopcua server I have running in docker. I borrowed the client certificate from the freeopcua GitHub examples found on GitHub. I then copied those files into my ssl directory and listed them as per below.
I’m not familiar with Wago, or what you’ll need to do to get that opc ua server to trust your clients certificate. hopefully they have good documentation.
is your Wago also using user rights access as well? you can add the following to your yaml
username: ####
password: ####
refresh is fixed at the moment. but can be something we look at making variable. I believe it is 30 seconds default. what kind of rates are you looking for?
Also out of curiosity, what are you looking to achieve with the opcua add-on?
that is a slick piece of industrial automation, I see it supports modbus TCP, which is baked into home assistant by default and may be more stable. though less secure.
refresh is fixed at the moment. but can be something we look at making variable. I believe it is 30 seconds default. what kind of rates are you looking for?
A variable would be a good thing. From 1second to 1 hour.
I also provided an update on github, to try and catch the error before it crashes HA.
would it be too much to ask to update your custom component and trying to connect again to your WAGO without the username/password. my HA wont crash on the socket error so it is hard for me to test this particular issue.
I have also a problem to write to a node on my WAGO PLC.
I created automation script like your example and I have the following message in the log
Error: “The server does not support writing the combination of value, status and timestamps provided.”(BadWriteNotSupported) encountered when attempting to write a value of: 5448123 to nodeid: ns=4;s=|var|WAGO 750-8101 PFC100 2ETH.Application.GVL.OPCUA_WritedVar
I have no problem with other OPC_UA client (like UAExpert)
It looks to be an issue with the client code from freeopcua. Somehow the freeopcua client node.set_value() code generated these errors. The proposed fix was to utilize node.set_attribute() code instead.
I created a tandem service opcua.set_attribute which can be utilized exactly like opcua.set_value. please update and give it a try.
I also found that in an attempt to mitigate a potential sensor unique_id naming collision i introduced a bug that would generate stale entries on HA restarts. I have reverted that change and it is working fine.