Skip to content

Setting the status code of a node to "bad" through OPCUA doesn't work #2

@lovasoa

Description

@lovasoa

When setting up variables in WAGO's eCockpit, they have the StatusWrite bit disabled in their OPCUA node's AccessLevel. This means that when trying to set the StatusCode of the value to any other value than Good, the server answers with the following error:

0x80730000 (BadWriteNotSupported): The server does not support writing the combination of value, status and timestamps provided.

We haven't found any way to change this AccessLevel.

Here is a small python script that can be run to trigger the error :

import asyncio
from datetime import datetime

from asyncua import Client, ua  # type:ignore


async def main():
    client = Client("opc.tcp://ip_of_the_wago_device:4840")
    await client.connect()
    params = ua.WriteParameters()
    attr = ua.WriteValue()
    attr.NodeId = ua.NodeId.from_string("ns=4;s=|var|WAGO 750-8212 PFC200 G2 2ETH RS.Application.GVL.BESS_WATCHDOG_FEEDBACK")
    attr.AttributeId = ua.AttributeIds.Value
    attr.Value.Value = ua.Variant(42, ua.VariantType.UInt16)
    attr.Value.SourceTimestamp = datetime.now()
    attr.Value.StatusCode = ua.StatusCode(ua.StatusCodes.Bad)
    params.NodesToWrite.append(attr)
    write_results = await client.uaclient.write(params)
    for status_code in write_results:
        status_code.check()


if __name__ == "__main__":
    asyncio.run(main())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions