Python client library for i3X servers.
pip install i3x-clientFor development:
pip install -e ".[dev]"import i3x
# Connect to an i3X server
client = i3x.Client("http://localhost:8080")
client.connect()
# Explore the data model
namespaces = client.get_namespaces()
object_types = client.get_object_types()
objects = client.get_objects(type_id="some-type")
# Read values
value = client.get_value("element-id-1")
print(value.data[0].value, value.data[0].quality)
# Read historical values
history = client.get_history("element-id-1", start_time="2026-01-01T00:00:00Z")
# Write values
client.update_value("element-id-1", {"temperature": 72.5})
# Disconnect
client.disconnect()with i3x.Client("http://localhost:8080") as client:
namespaces = client.get_namespaces()client = i3x.Client("http://localhost:8080")
client.on_value_change = lambda client, change: print(f"{change.element_id}: {change.data}")
client.connect()
# Subscribe to value changes (creates subscription + registers + starts SSE stream)
sub = client.subscribe(["element-id-1", "element-id-2"])
# ... on_value_change fires automatically when values change ...
# Unsubscribe when done
client.unsubscribe(sub)
client.disconnect()client = i3x.Client("http://localhost:8080", auth=("api-key", "secret"))connect()— Connect to the serverdisconnect()— Disconnect and stop all subscriptionsis_connected— Property indicating connection state
on_connect(client)— Called after successful connectionon_disconnect(client)— Called after disconnectionon_value_change(client, change)— Called when a subscribed value changeson_subscribe(client, subscription)— Called after a subscription is createdon_error(client, error)— Called on stream/subscription errors
get_namespaces()— List all namespacesget_object_types(namespace_uri=None)— List object typesquery_object_types(element_ids)— Query types by IDget_relationship_types(namespace_uri=None)— List relationship typesquery_relationship_types(element_ids)— Query relationship types by IDget_objects(type_id=None, include_metadata=False)— List object instancesget_object(element_id)— Get a single objectlist_objects(element_ids)— Get multiple objects by IDget_related_objects(element_ids, relationship_type)— Get related objects
get_value(element_id, max_depth=1)— Get last known valueget_values(element_ids, max_depth=1)— Get multiple last known valuesget_history(element_id, start_time=None, end_time=None, max_depth=1)— Get historical values
update_value(element_id, value)— Update an element's valueupdate_history(element_id, value)— Update historical values
subscribe(element_ids, max_depth=0)— Create subscription + register + start streamunsubscribe(subscription)— Stop stream and delete subscriptionsync_subscription(subscription)— Poll queued updates
create_subscription()— Create an empty subscriptionregister_items(subscription_id, element_ids, max_depth=0)— Register itemsunregister_items(subscription_id, element_ids)— Unregister itemsget_subscriptions()— List all subscriptionsget_subscription(subscription_id)— Get subscription detailsstart_stream(subscription_id)— Start SSE for an existing subscriptionstop_stream(subscription_id)— Stop SSE without deleting subscription
All models are frozen dataclasses with from_dict() classmethods.
Namespace—uri,display_nameObjectType—element_id,display_name,namespace_uri,schemaRelationshipType—element_id,display_name,namespace_uri,reverse_ofObjectInstance—element_id,display_name,type_id,namespace_uri,parent_id,is_compositionVQT—value,quality,timestampLastKnownValue—element_id,data(list of VQT),childrenValueChange—element_id,data(list of VQT),childrenSubscription—subscription_id,created,is_streaming,queued_updates,objects
All errors inherit from i3x.I3XError:
ConnectionError— Failed to connectAuthenticationError— Auth rejected (401/403)NotFoundError— Resource not found (404)ServerError— Server error (5xx)TimeoutError— Request timed outSubscriptionError— Subscription operation failedStreamError— SSE streaming error
MIT