Docs
Connecting
- Shared server
opc.tcp://opcua-sendbox.electroman.by:4840/electroman/- Personal servers
- ports
4841–5000 - Security
None(anonymous login) иBasic256Sha256(Sign/SignAndEncrypt): user and passwordsendbox/sendbox- Namespace
urn:electroman:opcua-sendbox(ns=2)- Nodes
Objects/SendBox/Tags/*,Objects/SendBox/Alarms/*
UaExpert
Add Server → Custom Discovery → paste the address, policy None, Anonymous (or Basic256Sha256, Sign/SignAndEncrypt, Username with sendbox/sendbox). Events: Document → Add → Event View, drag the Server node; alarms — Alarms & Conditions View.
ModbusToolkit
OPC UA tab: paste the address, security None (or Basic256Sha256 with login sendbox), Connect. History is on the History page, events on Events → subscribe to SendBox or Server.
Python (asyncua)
import asyncio
from asyncua import Client, ua
async def main():
async with Client("opc.tcp://opcua-sendbox.electroman.by:4840/electroman/") as client:
sine = client.get_node("ns=2;s=Tags.Sine")
print("Sine =", await sine.read_value())
asyncio.run(main())
Python (asyncua): subscription with reconnection
auto_reconnect=True: on connection loss the client reconnects and restores subscriptions on its own. UaExpert also restores subscriptions automatically, and the open62541 (C/C++) library has session and subscription recovery built in.
import asyncio
from asyncua import Client
class Handler:
def datachange_notification(self, node, value, data):
print(node, "=", value)
async def main():
# auto_reconnect=True: при обрыве клиент переподключается
# и восстанавливает подписки сам
async with Client("opc.tcp://opcua-sendbox.electroman.by:4840/electroman/", auto_reconnect=True) as client:
node = client.get_node("ns=2;s=Tags.Sine")
subscription = await client.create_subscription(500, Handler())
await subscription.subscribe_data_change(node)
while True:
await asyncio.sleep(3600)
asyncio.run(main())
REST API
KEY=$(curl -s -X POST http://opcua-sendbox.electroman.by/api/keys | jq -r .key)
curl -s -X POST -H "X-API-Key: $KEY" http://opcua-sendbox.electroman.by/api/sessions
What the server does
- Double, Float, Int16/32, UInt16/32 and Boolean tags with generators: sine, sawtooth, triangle, meander, counter, noise, random walk, steps, your own point profile and more.
- Writes to constant tags marked as writable.
- HistoryRead Raw: the last 1000 values of every tag.
- ExclusiveLimitAlarmType and AlarmConditionType alarms: threshold with deadband, periodic, manual; ConditionRefresh is supported.
Limits
- Sessions: 2 per key, 4 per IP, 50 in total.
- Up to 100 tags and 20 alarms per session.
- Acknowledge and Confirm are not supported: an alarm is treated as acknowledged at once. Events carry no LimitState.
- The server certificate is self-signed: on a Basic256Sha256 connection the client will ask you to trust it.
Source code
The server is open source: you can run your own copy on a local network.
git clone https://github.com/StarLeG/opcua-sendbox.git
SendBox is free and ad-free. The server and the test bench are paid for by donations.