minix1234 / hacore_opcua

opcua custom component for home assistant
MIT License
10 stars 1 forks source link

OPC-UA #8

Closed joeduck closed 1 year ago

joeduck commented 1 year ago

Hi,

try this component, but it does not work with the actual HA Version because "setup_Sensors". Can you help?

Thanks, Jochen

minix1234 commented 1 year ago

howdy,

which HA version. I have the latest and it's still functional

minix1234 commented 1 year ago

also can you provide the your config and OPC us target details.

without any of that info there is limit help I can provide

minix1234 commented 1 year ago

for example here as some 'hub' configuration examples

opcua:
  - name: target1
    url: "opc.tcp://192.168.50.113:4840/"
    session_timeout: 600000
    secure_timeout: 600000

  - name: target2
    url: "opc.tcp://192.168.50.113:4840/"
    application_uri: "urn:example.org:FreeOpcUa:python-opcua"
    session_timeout: 600000
    secure_timeout: 600000
    security_string: "Basic256Sha256,SignAndEncrypt,/ssl/certificate-example.der,/ssl/private-key-example.pem"

  - name: prosys
    url: "opc.tcp://192.168.50.113:53530/OPCUA/SimulationServer"
    session_timeout: 600000
    secure_timeout: 600000
    username: "prosys"
    password: "prosys"    
    #application_uri: "urn:example.org:FreeOpcUa:python-opcua"
    #security_string: "Basic256Sha256,SignAndEncrypt,/ssl/certificate-example.der,/ssl/private-key-example.pem"
minix1234 commented 1 year ago

and some tag type configs

sensor:

  - platform: opcua
    scan_interval: 3600
    nodes:
      - name: Sensor-1
        hub: target1
        nodeid: "ns=1;i=43840"
        unit_of_measurement: degrees

      - name: Sensor-2
        hub: target1
        nodeid: "ns=1;i=51028"
        unit_of_measurement: degrees
joeduck commented 1 year ago

Hi, many thanks! Will try this

minix1234 commented 1 year ago

10-4

to use certificate based authentication you will need to generate a x509 client certificate for HA to use.

I simply borrowed one from the freeopcua example files for testing. but any platform with OpenSSL can make the needed cert.

https://github.com/FreeOpcUa/opcua-asyncio/tree/master/examples/certificates

minix1234 commented 1 year ago

closing since I haven't heard back and I can confirm it is working as of latest Home assistant.