Skip to content

Read and use data from another Site

Prerequisites: B has a valid collected Tag and A has joined B. On A, select B’s IO, save PLC scope and reference the Tag. IO selection does not copy Devices, Tags or values.

Operating tutorial

Operating tutorial: Read and use data from another Site

On A, select B’s IO and PLC scope, obtain a source reference and read it with Python, then configure alarms and trends.

1. Prepare source and consumer

Prerequisites: B has a valid collected Tag and A has joined B. On A, select B’s IO, save PLC scope and reference the Tag. IO selection does not copy Devices, Tags or values.

2. Open B’s Device catalog

  1. Add B’s node under Sites → Local Capabilities → IO and verify that it is selected and available.
  2. Select Browse Devices beside the node, or select B directly in Sites and Devices.
  3. In Devices, search by name, code or protocol. Search covers loaded Devices; use Load More Devices to read additional pages.
  4. Check the source Site and Device enablement before editing the PLC usage scope.

Expected result The source maintains this catalog; A creates no PLC connection. Saved scope survives an outage, and the catalog reloads after recovery.

3. Preview and save the PLC usage scope

  1. Check Use in the target Device’s Usage Scope column. Review Saved PLCs and Current Selection counts.
  2. Review Selected Outside Loaded Pages. Those Devices remain selected even if the current page does not show them.
  3. Select Preview PLC Scope Changes and review additions, removals and existing business dependencies.
  4. Check the confirmation that you reviewed additions, removals and dependencies, then select Confirm and Save PLC Usage Scope.
  5. Wait for the saved-and-effective result. Check that neither Scope Not Effective nor Catalog Update Required remains.

Expected result After the save is effective, this Site can use source Tags within the scope. Checking Devices changes only the draft; preview does not submit the change.

If the result differs

  • If removal would break existing references, preview lists dependencies and blocks saving. Update those references and preview again.
  • If source catalog or configuration versions change, refresh and preview again. A catalog update may be required even when the Device set is unchanged.
  • Changing the browsed Site prompts before discarding unsaved PLC selections. Switching workspace views retains the draft.

4. Obtain a source reference from Site Tags

A TagRef is a stable source reference: hq://io/<io-domain-uuid>/<device-uuid>/<tag-uuid>. Expand Source Reference in synchronized Site Tags and copy it. If you already have the target Tag’s complete reference, continue to the next step.

  1. Open Tag Management → Site Tags and confirm that Target Site and Target Database belong to A. Catalog access requires admin:view, Site view or management permission, and IO or Tag view permission. Synchronization also requires io:manage.
  2. Choose B as Source Site and the admitted PLC as Source Device. Use Load More Devices when another page is available.
  3. Select Preview Device Tag Synchronization. Review this batch’s new, updated, unchanged or conflicting definitions. This operates on pages of the Device catalog, rather than a single checked Tag.
  4. Review the batch target and changes, check confirmation and select Confirm and Save Batch. Use Preview Next Batch and confirm each remaining batch.
  5. Find the desired Tag by code or name in Synchronized Tags. Expand its Source Reference, then select and copy the complete hq://io/... text.

Expected result Synchronization saves only local Tag definitions and source bindings. It creates no acquisition Devices, copies no live values, rules or history, and enables no writes. Copy references from the catalog, not Site names or IPs.

If the result differs

  • A conflicting batch cannot be saved. Review source/local differences and preview again; earlier confirmed batches remain.
  • If the save outcome is unconfirmed, select Check This Batch. Confirm whether it was saved before continuing to the next batch.

5. Run read-only Python from a remote Tag event

The built-in hqcontrol reads collected state without another package. Run Test supports local Tags only; use a Point Change event to include a remote TagRef in the action scope.

  1. On A, prepare the project and permissions using the Python tutorial. Create scripts/read_value.py in Configuration Center → script → Code and paste the example.
  2. Replace the complete source reference inside the quotes in tags.read(...) with the URI copied above and save the source. Then set this script’s entrypoint and runtime limits in Settings → Python → Python Packages → Advanced Project Settings → Project Runtime Configuration and check the application state. The script must read the same Tag selected by the event below.
  3. Open Run → New Event and choose Point Change. Under Choose a Trigger Tag, select B, the target Device and the same Tag. Set the required condition and minimum interval.
  4. Add a Script Action, select the entrypoint under Script, check Action Enabled and save the action binding. Enable the event, select Save Event and check the save and application results.
  5. Wait for a valid change meeting the condition. In Records, compare script Value and Quality with B. The first valid value after reconnection may only establish a baseline.
  6. When continued reads are no longer needed, disable and save the event.
scripts/read_value.py · Complete read-only entryPython
# scripts/read_value.py
from hqcontrol import tags

def main(ctx):
    response = tags.read("hq://io/<io-domain-id>/<device-uid>/<tag-uid>")
    if not response or response.get("ok") is not True:
        raise RuntimeError("Tag read failed")
    snapshot = response["value"]
    if not tags.is_good_quality(snapshot):
        raise RuntimeError("Tag quality is not good")
    print("Value:", snapshot.get("value"), "Quality:", snapshot.get("quality"))
    return {"value": snapshot.get("value")}

if __name__ == "__main__":
    main({})

Expected result After triggering, the script reads the event-scoped remote value on A. If nothing fires, check enablement, conditions and source changes; for execution failures, check quality and permissions. The example does not write PLC values or archive trends.

6. Check quality and collection demand

The default reuse-only reads collected source values without another PLC connection. On-demand Tags need valid source collection demand and the required scope and subscription permissions.

Scroll horizontally to view the full table

ResultWhere to check
Current value with good qualityCompare value and time with the source Tag before connecting a consumer.
No value / not collectedSource Device and Tag enablement, collection mode and actual collection demand.
Invalid quality / source unavailableSource Device, IO service and Site connection. Wait for valid new data after recovery.
Scope or permission deniedPLC usage scope, caller permissions and capability authorization.
Reference not foundCheck whether the source Tag was removed or recreated, and obtain its current stable reference from the catalog.

Expected result Reading a remote value does not establish alarm evaluation or trend recording on A. Configure those consumers separately.

7. Open B’s alarms, trends or screens

  1. In A’s Sites → Local Capabilities, add B’s node for each required capability and verify that it is selected and available.
  2. Select View Alarms, View Trends or Open Screens beside the node. The current Portal opens the selected source’s runtime content. B’s screens use B’s Tag bindings.
  3. In History Trends, select Tags and start/end times to query records B still retains for that period. Remote alarms over ordinary LAN connections are read-only. Sign in directly to B with an authorized account to acknowledge, shelve or unshelve.
  4. If no accessible menu exists for the capability, check runtime menus and user access on B. If the source is unavailable, restore its service or connection first.

Expected result Alarm and Trend have separate entry points and do not require Screens to be selected. Results still belong to B; a failure does not substitute A’s same-named menu or data.

8. Use remote inputs on A

Scroll horizontally to view the full table

UseCurrent entry pointMeaning after saving
Read-only PythonConfiguration Center → script → Code: call tags.read with the complete source reference, then bind an event for the same remote Tag as described above.The script runs on A and reads collected state from B.
Point-change script triggerConfiguration Center → script → Run → New Event. Choose Point Change, then select B, a Device and one Tag under Choose a Trigger Tag.After the event and actions are configured and enabled, only continuous, current, valid value changes participate in triggering.
A’s own alarms and trendsTag Management → Site Tags → Synchronized Tags → Alarm / Trend Configuration. Also choose the Devices processed by the service in Local Capabilities.A maintains its own rules and retention. B’s alarm rules, trend policies and history are not copied.
Custom pageDeclare read scope and runtime context according to the page SDK tutorial.The page uses its authorized interfaces, with the FullCode or reference format required by each interface.
External applicationConfigure IO State API credentials, Profiles and read scopes.API access is authorized separately. Site membership does not automatically expand an API Key’s permissions.

Expected result Save Device scopes, Tag definitions, alarms, trends and events separately, then check services, input quality and results. Synchronizing Tag definitions does not automatically bind Tags in runtime screens.

Click the image again or press Esc to close