minix1234 / hacore_opcua

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

OPCUA Broken after 2024.1 update #11

Open Kassem-ajjan opened 6 months ago

Kassem-ajjan commented 6 months ago

Hello,

can you help me with this please ? after updating to 2024.1 no more data is coming from the opc server and the error is

ns=2;s=Siemens s7 300.data.1, Read Value Error: argument to node must be a NodeId object or a string defining a nodeid found ns=2;s=Siemens s7 300.data.1 of type <class 'homeassistant.util.yaml.objects.NodeStrClass'>

my configuration opcua:

sensor:

Thank you

JanHre commented 6 months ago

Hi at init.py

  nodeid = service.data[ATTR_NODEID]

replace all

 nodeid = str(service.data[ATTR_NODEID])

at sensor.py

    hub = hass.data[OPCUA_DOMAIN][hub_name]

    sensors.append(
        OpcuaNodeidSensor(
            hub,
            node[CONF_NAME],
            node str([CONF_NODEID]),

replace

    hub = hass.data[OPCUA_DOMAIN][hub_name]
    node_id = str(node[CONF_NODEID])

    sensors.append(
        OpcuaNodeidSensor(
            hub,
            node[CONF_NAME],
            node_id,
JanHre commented 6 months ago

Also change at more thinks like replace txt to py switch.txt binary_sensor.txt

Kassem-ajjan commented 5 months ago

Thanks you very much, i tested it and its working now !